summaryrefslogtreecommitdiff
path: root/volume-widget/volume.lua
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2020-05-24 14:14:32 -0400
committerGitHub <noreply@github.com>2020-05-24 14:14:32 -0400
commitcbfb12590a6d3f7d4d49ec016fc0017139984d91 (patch)
treeecc60c7874b4e748f8f3d7ebd5d681224e08ae4e /volume-widget/volume.lua
parent6018416588071e2817f59ea6fde5c15fbbfd2c8f (diff)
parenta44a3591ebfe1c119138c67cb334ab2b5fb40a12 (diff)
Merge pull request #146 from nevillelyh/neville/volume
make volume +/- delta configurable
Diffstat (limited to 'volume-widget/volume.lua')
-rw-r--r--volume-widget/volume.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua
index f04e829..1a670ef 100644
--- a/volume-widget/volume.lua
+++ b/volume-widget/volume.lua
@@ -19,17 +19,17 @@ local PATH_TO_ICONS = "/usr/share/icons/Arc/status/symbolic/"
local volume_icon_name="audio-volume-high-symbolic"
local GET_VOLUME_CMD = 'amixer sget Master'
-local volume = {device = '', display_notification = false, notification = nil}
+local volume = {device = '', display_notification = false, notification = nil, delta = 5}
function volume:toggle()
volume:_cmd('amixer ' .. volume.device .. ' sset Master toggle')
end
function volume:raise()
- volume:_cmd('amixer ' .. volume.device .. ' sset Master 5%+')
+ volume:_cmd('amixer ' .. volume.device .. ' sset Master ' .. tostring(volume.delta) .. '%+')
end
function volume:lower()
- volume:_cmd('amixer ' .. volume.device .. ' sset Master 5%-')
+ volume:_cmd('amixer ' .. volume.device .. ' sset Master ' .. tostring(volume.delta) .. '%-')
end
--{{{ Icon and notification update
@@ -98,6 +98,7 @@ local function worker(args)
if volume_audio_controller == 'pulse' then
volume.device = '-D pulse'
end
+ volume.delta = args.delta or 5
GET_VOLUME_CMD = 'amixer ' .. volume.device.. ' sget Master'
--}}}
--{{{ Check for icon path