elParaguayo / qtile-extras

Somewhere to store things I create for qtile that probably won't end up in the official repo
MIT License
166 stars 21 forks source link

Make `UPowerWidget` shows text by default and permanently #278

Closed egolep closed 12 months ago

egolep commented 1 year ago

Maybe it's already possible to do so and I am missing something, but I would like to make the UPowerWidget to always display the text instead of having to click on it. Also, I would like to have the possibility to set the timer in order to never hide the text again (maybe setting text_displaytime = 0)

elParaguayo commented 1 year ago

I'd happily look at a Pull Request if you want to make those changes.

Alternatively, there are a couple of ways you could fix this:

from libqtile import hook, qtile

@hook.subscribe.startup
def set_upower_text_display():
    upower = qtile.widgets_map["upower"]
    upower.show_text = True
    upower.bar.draw()

or

from qtile_extras import widget

class UpowerWidgetPlusText(widget.UPowerWidget):
    def __init__(self, **config):
        widget.UPowerWidget.__init__(self, **config)
        self.show_text = True

    def toggle_text(self):
        pass

# You can then then add an instance of this widget in your widget list.