From 120e15ee161cfe0091c6f1e86138101d63dc64c3 Mon Sep 17 00:00:00 2001 From: Bart Verhagen Date: Fri, 29 May 2020 17:53:10 +0200 Subject: New: Usr: Added user customizable button press behaviour for the volumearc widget This allows the user to override the default implementation in his/her own config upon the widget creation --- volumearc-widget/volumearc.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'volumearc-widget/volumearc.lua') diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua index eb2ff68..c582c10 100644 --- a/volumearc-widget/volumearc.lua +++ b/volumearc-widget/volumearc.lua @@ -69,7 +69,7 @@ local function worker(args) or { main_color } end - volumearc:connect_signal("button::press", function(_, _, _, button) + local button_press = args.button_press or function(_, _, _, button) if (button == 4) then awful.spawn(inc_volume_cmd, false) elseif (button == 5) then awful.spawn(dec_volume_cmd, false) elseif (button == 1) then awful.spawn(tog_volume_cmd, false) @@ -78,7 +78,8 @@ local function worker(args) spawn.easy_async(get_volume_cmd, function(stdout, stderr, exitreason, exitcode) update_graphic(volumearc, stdout, stderr, exitreason, exitcode) end) - end) + end + volumearc:connect_signal("button::press", button_press) watch(get_volume_cmd, 1, update_graphic, volumearc) -- cgit v1.2.3