changed the name to match the suggested name in #396

This commit is contained in:
Luka5W 2023-10-05 23:12:05 +00:00
parent 48df364e20
commit 3f9c9b93e6
1 changed files with 10 additions and 10 deletions

View File

@ -17,10 +17,10 @@ local utils = require("awesome-wm-widgets.volume-widget.utils")
local LIST_DEVICES_CMD = [[sh -c "pacmd list-sinks; pacmd list-sources"]] local LIST_DEVICES_CMD = [[sh -c "pacmd list-sinks; pacmd list-sources"]]
local function GET_VOLUME_CMD(card, device, mixer) return 'amixer -c '..card..' -D '..device..' sget '..mixer end local function GET_VOLUME_CMD(card, device, mixctrl) return 'amixer -c '..card..' -D '..device..' sget '..mixctrl end
local function INC_VOLUME_CMD(card, device, mixer, value_type, step) return 'amixer -c '..card..' -D '..device..' sset '..mixer..' '..value_type..' '..step..'%+' end local function INC_VOLUME_CMD(card, device, mixctrl, value_type, step) return 'amixer -c '..card..' -D '..device..' sset '..mixctrl..' '..value_type..' '..step..'%+' end
local function DEC_VOLUME_CMD(card, device, mixer, value_type, step) return 'amixer -c '..card..' -D '..device..' sset '..mixer..' '..value_type..' '..step..'%-' end local function DEC_VOLUME_CMD(card, device, mixctrl, value_type, step) return 'amixer -c '..card..' -D '..device..' sset '..mixctrl..' '..value_type..' '..step..'%-' end
local function TOG_VOLUME_CMD(card, device, mixer) return 'amixer -c '..card..' -D '..device..' sset '..mixer..' toggle' end local function TOG_VOLUME_CMD(card, device, mixctrl) return 'amixer -c '..card..' -D '..device..' sset '..mixctrl..' toggle' end
local widget_types = { local widget_types = {
@ -169,7 +169,7 @@ local function worker(user_args)
local step = args.step or 5 local step = args.step or 5
local card = args.card or 1 local card = args.card or 1
local device = args.device or 'pulse' local device = args.device or 'pulse'
local mixer = args.mixer or 'Master' local mixctrl = args.mixctrl or 'Master'
local value_type = args.value_type or '-M' local value_type = args.value_type or '-M'
local toggle_cmd = args.toggle_cmd or nil local toggle_cmd = args.toggle_cmd or nil
@ -190,18 +190,18 @@ local function worker(user_args)
end end
function volume:inc(s) function volume:inc(s)
spawn.easy_async(INC_VOLUME_CMD(card, device, mixer, value_type, s or step), function(stdout) update_graphic(volume.widget, stdout) end) spawn.easy_async(INC_VOLUME_CMD(card, device, mixctrl, value_type, s or step), function(stdout) update_graphic(volume.widget, stdout) end)
end end
function volume:dec(s) function volume:dec(s)
spawn.easy_async(DEC_VOLUME_CMD(card, device, mixer, value_type, s or step), function(stdout) update_graphic(volume.widget, stdout) end) spawn.easy_async(DEC_VOLUME_CMD(card, device, mixctrl, value_type, s or step), function(stdout) update_graphic(volume.widget, stdout) end)
end end
function volume:toggle() function volume:toggle()
if toggle_cmd == nil then if toggle_cmd == nil then
spawn.easy_async(TOG_VOLUME_CMD(card, device, mixer), function(stdout) update_graphic(volume.widget, stdout) end) spawn.easy_async(TOG_VOLUME_CMD(card, device, mixctrl), function(stdout) update_graphic(volume.widget, stdout) end)
else else
spawn.easy_async(toggle_cmd, function(stdout) spawn.easy_async(GET_VOLUME_CMD(card, device, mixer), function(stdout) update_graphic(volume.widget, stdout) end) end) spawn.easy_async(toggle_cmd, function(stdout) spawn.easy_async(GET_VOLUME_CMD(card, device, mixctrl), function(stdout) update_graphic(volume.widget, stdout) end) end)
end end
end end
@ -228,7 +228,7 @@ local function worker(user_args)
) )
) )
watch(GET_VOLUME_CMD(card, device, mixer), refresh_rate, update_graphic, volume.widget) watch(GET_VOLUME_CMD(card, device, mixctrl), refresh_rate, update_graphic, volume.widget)
return volume.widget return volume.widget
end end