1

I want to execute a method when one of my wibox.widget.textbox widgets is clicked, and according to the documentation I should use the button::press signal.

However I didn't find anything about these signals, I can't even figure if it is a native lua thing of if they are tied with AwesomeWM.

Thus, I don't know how to implement them. Any help would be appreciated. (Please note that I have barely no knowledge in lua).

Sample code:

mywidget = wibox.widget.textbox()
mywidget:set_align("right")
-- I want to execute awful.util.spawn_with_shell("pavucontrol") if the widget is clicked
Antoine C.
  • 3,730
  • 5
  • 32
  • 56

1 Answers1

3

Probably something like this. The button::press signal needs a callback which is called with the parameters listed in the docs you linked. Untested:

local box = wibox.widget.textbox(...)
local box_pressed = function(lx, ly, button, mods, find_widgets_result)
    // some code ...
end
box:connect_signal("button::press", box_pressed)
Henri Menke
  • 10,705
  • 1
  • 24
  • 42