mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-17 07:49:09 +01:00
Merge pull request #153 from bverhagen/master
New: Usr: Added user customizable button press behaviour for the volumearc widget
This commit is contained in:
commit
2cab18315b
2 changed files with 9 additions and 3 deletions
|
@ -25,6 +25,7 @@ It is possible to customize widget by providing a table with all or some of the
|
|||
| `inc_volume_cmd` | `amixer -D pulse sset Master 5%+` | Increase volume level |
|
||||
| `dec_volume_cmd` | `amixer -D pulse sset Master 5%-` | Decrease volume level |
|
||||
| `tog_volume_cmd` | `amixer -D pulse sset Master toggle` | Mute / unmute |
|
||||
| `button_press` | `function(_, _, _, button) <sane default logic> end` | Overwrite the 'button\_press' signal for this widget |
|
||||
|
||||
### Example:
|
||||
|
||||
|
@ -33,7 +34,11 @@ volumearc_widget({
|
|||
main_color = '#af13f7',
|
||||
mute_color = '#ff0000',
|
||||
thickness = 5,
|
||||
height = 25
|
||||
height = 25,
|
||||
button_press = function(_, _, _, button) -- Overwrites the button press behaviour to open pavucontrol when clicked
|
||||
if (button == 1) then awful.spawn('pavucontrol --tab=3', false)
|
||||
end
|
||||
end
|
||||
})
|
||||
```
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue