From a44a3591ebfe1c119138c67cb334ab2b5fb40a12 Mon Sep 17 00:00:00 2001 From: Neville Li Date: Sat, 23 May 2020 09:30:22 -0400 Subject: make volume +/- delta configurable --- volume-widget/volume.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'volume-widget/volume.lua') 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 -- cgit v1.2.3