[SOLVED] Qtile - mouse_callbacks

Lobo1980

Member
Joined
Feb 12, 2022
Messages
37
Reaction score
20
Credits
323
Hello guys.

I'm trying to get a widget.TextBox to open a terminal and run the
Code:
free -h
command but is not working.

This is how it look:

widget.TextBox(
text = '@',
padding = 2,
margin = 12,
fontsize=22,
foreground = colors[6],
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e free -h')}
),

It opens a terminal for less than a second and close immediately.

I have also try:

mouse_callbacks = {'Button1':lambda: qtile.cmd_spawn(["alacritty", "-e", "--noclose", "free -h"])}),
mouse_callbacks = {'Button1':lambda: qtile.cmd_spawn(["alacritty", "-e", "--hold", "free -h"])}),

They also open and close at the moment.

mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(alacritty + ' -e free -h')}),

This don't work at all.

Can you help me please?

OS: Arch updated
WM: Qtile
 


This was not the way I was looking for but I found a solution that I liked:

I installed "yad" and made a executable bash script:

Code:
#! /usr/bin/bash


free -h | \


yad --text-info --geometry=770x200

Then, I linked the callback to the script:

Code:
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn("sh /home/User_Name/.config/Scripts/Free.sh"),},),

And now it opens a text dialog with the information I was looking for.
 

Attachments

  • 2022-04-04-010913_795x226_scrot.png
    2022-04-04-010913_795x226_scrot.png
    50.8 KB · Views: 250

Members online


Top