Hit send too soon. Meant to say:
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(foo)}I do wonder if we should allow mouse callbacks to take lazy objects too... On Sun, 3 Oct 2021 at 18:49, el Paraguayo <[email protected]> wrote: > Writing it like that means you're binding the result of > `qtile.cmd_spawn(foo)` to the button. > > You can do it like this: > mouse_callbacks={'Button1': lambda: qtile.function(foo)} > > On Sun, 3 Oct 2021 at 18:45, Gibranlp <[email protected]> wrote: > >> What is the right implementation of mouse callback on functions? >> >> I have already imported qtile >> >> from libqtile import qtile >> >> I have a working function, called by key shortcut that works fine, but >> hen i use mouse callbacks i just dont know how to make it work. >> >> foo(); >> >> I have tried this so far on mouse callbacks >> >> - mouse_callbacks={'Button1':qtile.cmd_spawn(foo)} >> >> which gives the error: >> >> AttributeError: 'NoneType' object has no attribute 'cmd_spawn' >> >> I have also tried >> >> - mouse_callbacks={'Button1':qtile.function(foo)} >> >> and i get the error: >> >> mouse_callbacks={'Button1':qtile.function(set_rand_wallpaper)}, >> AttributeError: 'NoneType' object has no attribute 'function' >> >> I have tryed with lazy object which i know now that are not callable, >> >> mouse_callbacks={'Button1':lazy.function(foo)} >> >> Can anyone point me in the right direction? >> >> thanks >> >> >> >> -- >> 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/51ae9659-875a-426c-8a84-1a21aa565781n%40googlegroups.com >> <https://groups.google.com/d/msgid/qtile-dev/51ae9659-875a-426c-8a84-1a21aa565781n%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/CADPQLhC8P%2B9Kfk4hbSbRVz4hjhsT-sgnRxjvcm6CBoVpU7AEmQ%40mail.gmail.com.
