Hi devs, I working on qtile bar to update only on keypress. For this I followed
this conversation from Jan last year but it doesn't work anymore.
This is my lazy function
@lz.function
def update_brightness(qtile):
"""Update the brightnesswidget on keypress
Args:
qtile (libqtile.qtile): By default passed by lz.function
"""
w = qtile.widgets_map["backlight"]
widgets = ",".join(qtile.widgets_map)
logger.warn("widget names = " + widgets)
w.tick()
Then in keys array I have
Key(
"<XF86MonBrightnessUp>",
lazy.spawn("brightnessctl set +10"),
update_brightness(),
desc="Inc Brightness",
),
And finally this is my widget
widget.GenPollText(
name="backlight",
func=lambda: subprocess.run(
["brightnessctl", "g"], stdout=subprocess.PIPE
)
.stdout.decode("utf-8")
.strip(),
),
Output of log:
2022-03-31 07:48:13,526 WARNING libqtile config.py:update_brightness():L90 widget names = groupbox,prompt,tasklist,textbox,cpu,textbox_1,memory,textbox_2,clock,textbox_3,backlight,textbox_4,volume,net,textbox_5,battery,wttr,currentlayouticon,systray
2022-03-31 07:48:13,527 ERROR libqtile base.py:cmd_function():L214 Exception calling "<function update_brightness at 0x7fe9c84b70a0>":
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/libqtile/command/base.py", line 211, in cmd_function
function(self, *args, **kwargs)
File "/home/shubham/.config/qtile/config.py", line 91, in update_brightness
w.tick()
File "/usr/lib/python3.10/site-packages/libqtile/configurable.py", line 48, in __getattr__
raise AttributeError("%s has no attribute: %s" % (cname, name))
AttributeError: GenPollText has no attribute: tick
General Info:
Qtile: 0.21.0
OS: ArchLinux 5.17