Mouse callbacks in Qtile bar won't work
Hi, I've been working on my first rice in Qtile, and there's a problem that I couldn't solve. I tried to add mouse callbacks for some of my bar widgets, but I just couldn't get it to work.
Here's the snippet for opening pavucontrol when clicking on the volume widget:
def open_pavu(qtile):
qtile.cmd_spawn("pavucontrol")
topBar = bar.Bar([
# ...
# Volume
widget.TextBox(
text="墳", foreground=colors["green"], fontsize=17,
mouse_callbacks={
'Button1': open_pavu},
volume_app="pavucontrol"),
widget.Volume(foreground=colors["green"],
mouse_callbacks={'Button1': open_pavu},),
],
# ...
)
# ...
But it just doesn't work.
I tried the stable qtile release, and qtile-git from the AUR, still doesn't work.
How could I fix this?
Edited 18 Jun 2021. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 3 · 100% up
- Kind
- Text
- ID
- o2grcb
3 comments
Apparently, mouse callbacks don't take Qtile arguments anymore, you just need to use
Try it with a lambda like, I am not 100% if this works, but it would eliminate the need for defining a separate function.
Also .cmd_spawn accepts a list of strings, instead a string too, if you need arguments to the program. Like
["program", "arg1", "arg2"]Yeah this exactly what I've done :)