On Fri, Jul 10, 2020 at 04:21:23AM -0700, Nick H wrote: > Can someone help with a question about the Qtile bar? > > I use several GenPollText widgets to display the output of scripts in a top > bar, like this: > > screens = [ > Screen( > top = bar.Bar([ > widget.GenPollText( > func = qtb_1, > update_interval = 1800, > ), > widget.GenPollText( > func = qtb_2, > update_interval = 600, > ), > ... > > This works very well, but sometimes I want to update one of the values on > demand rather than wait for the poll interval (the bash scripts are > expensive). If I click on the bar widget with the mouse, the script > triggers and the value updates immediately. I'd like to achieve the same > thing with a key-press. > > Looking at the GenPollText class, it seems a left click calls button_press > from InLoopPollText in libqtile.widget.base, which updates the widget > content. > > How can I call button_press or, better still, whatever function actually > does the widget update, from a Key() in my config? I'm very new to Python > and I need hand-holding with how to create/call the lazy.lazy function and > have it index the correct widget.
On master you could use: https://github.com/qtile/qtile/pull/1728 Otherwise, open code it with: def my_update(qtile): w = qtile.widgets_map["thing_to_update"] w.tick() Key(..., lazy.function(my_update)) Tycho -- You received this message because you are subscribed to the Google Groups "qtile-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/qtile-dev/20200710135451.GT7423%40cisco.
