I do not know what is the best or proper way to do that, but I am using following pattern:
def switch_group(index): @lazy.function def __inner(qtile): qtile.groups[index].cmd_toscreen() return __inner And use it: Key([mod, ctrl], "BackSpace", switch_group(1)), Best wishes, Andrius Semionovas On Wed, Oct 2, 2019 at 4:09 PM 'Kevin' via qtile-dev < [email protected]> wrote: > I try to call a function when pressing a key. A lot of the examples in the > examples repository use lazy.function(). > I tried that, but it doesn't work. I also couldn't find any documentation > for lazy.function(). > > My code: > > def test(): > def wrap(): > lazy.group['1'].toscreen() > return wrap > > keys = [ > Key([mod], "Right", lazy.function(test)), > ] > > the lazy.group['1'].toscreen() is only for testing, the function will be > more complex later on. > > What am I doing wrong? > > -- > 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/99cab1bc-2e1a-4a61-936b-9c563338140d%40googlegroups.com > <https://groups.google.com/d/msgid/qtile-dev/99cab1bc-2e1a-4a61-936b-9c563338140d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAOquYrPieZTwJbCzG%3DNttZpH%2Bq72mjBmEk6qmXskJ9Kg1QFxTw%40mail.gmail.com.
