mirror of
https://github.com/powerline/powerline.git
synced 2025-07-24 06:15:41 +02:00
Add Qtile widget
This commit is contained in:
parent
fb929b76cc
commit
597f67b85a
@ -179,3 +179,23 @@ Then add the ``powerline_widget`` to your ``wibox``:
|
|||||||
.. code-block:: lua
|
.. code-block:: lua
|
||||||
|
|
||||||
right_layout:add(powerline_widget)
|
right_layout:add(powerline_widget)
|
||||||
|
|
||||||
|
Qtile widget
|
||||||
|
------------
|
||||||
|
|
||||||
|
Add the following to your :file:`~/.config/qtile/config.py`:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from powerline.bindings.qtile.widget import Powerline
|
||||||
|
|
||||||
|
screens = [
|
||||||
|
Screen(
|
||||||
|
top=bar.Bar([
|
||||||
|
# ...
|
||||||
|
Powerline(timeout=2),
|
||||||
|
# ...
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
0
powerline/bindings/qtile/__init__.py
Normal file
0
powerline/bindings/qtile/__init__.py
Normal file
33
powerline/bindings/qtile/widget.py
Normal file
33
powerline/bindings/qtile/widget.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from libqtile import bar
|
||||||
|
from libqtile.widget import base
|
||||||
|
|
||||||
|
from powerline.core import Powerline as PowerlineCore
|
||||||
|
|
||||||
|
|
||||||
|
class Powerline(base._TextBox):
|
||||||
|
def __init__(self, timeout=2, text=" ", width=bar.CALCULATED, **config):
|
||||||
|
base._TextBox.__init__(self, text, width, **config)
|
||||||
|
self.timeout_add(timeout, self.update)
|
||||||
|
self.powerline = PowerlineCore(ext='wm', renderer_module='pango_markup')
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
self.text = self.powerline.renderer.render(side='right')
|
||||||
|
self.bar.draw()
|
||||||
|
|
||||||
|
def cmd_update(self, text):
|
||||||
|
self.update(text)
|
||||||
|
|
||||||
|
def cmd_get(self):
|
||||||
|
return self.text
|
||||||
|
|
||||||
|
def _configure(self, qtile, bar):
|
||||||
|
base._TextBox._configure(self, qtile, bar)
|
||||||
|
self.layout = self.drawer.textlayout(
|
||||||
|
self.text,
|
||||||
|
self.foreground,
|
||||||
|
self.font,
|
||||||
|
self.fontsize,
|
||||||
|
self.fontshadow,
|
||||||
|
markup=True)
|
Loading…
x
Reference in New Issue
Block a user