What you did should work, I think it's just the keybinding that's wrong.
You should use switch_screen (that will return the inner lazy function),
not lazy.function, i.e.: Key([mod, "mod1"], "h", switch_screen(-1))


Le mer. 13 janv. 2021 à 09:16, Pablo Eduardo Martínez <
[email protected]> a écrit :

> Currently i move to Screens with Super+alt+h (previous) and Super+alt+l
> (next).
>
> Key([mod, "mod1"], "h", lazy.to_screen(0)),
> Key([mod, "mod1"], "l", lazy.to_screen(1)),
>
> it works ok, but i want to do it dinamically, but i dont know how to call
> a lazy spawn from qtile arg and how to call lazy.to_screen(current_screen),
> or i can pass a lazy object on the primary function?
>
> something like this
> def switch_screen(index):
> @lazy.function
> def __inner(qtile):
>     global current_screen, max_screens
>     current_screen += index
>     if current_screen > 0 and current_screen < monitors:
>         qtile.to_screen(current_screen)
>         qtile.spawn(f'notify-send "Move to Screen {current_screen}"')
>     else:
>         current_screen -= index
>         qtile.spawn(f'notify-send "Move to Screen {current_screen}"')
> return __inner
>
> Key([mod, "mod1"], "h", lazy.function(-1)),
> Key([mod, "mod1"], "l", lazy.function(1)),
>
> --
> 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/1547d562-66f4-4b89-a915-830086f22bbfn%40googlegroups.com
> <https://groups.google.com/d/msgid/qtile-dev/1547d562-66f4-4b89-a915-830086f22bbfn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Guillaume Gelin

-- 
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/CAPn4x%2Bo%2BsCHXN5f4Gpt_aAoM1L%3DzdWaKt0_31LttaZA%3Drd%3Dv1A%40mail.gmail.com.

Reply via email to