From 3f9c9b93e6d34a76f75a38bba2902021efe99ddf Mon Sep 17 00:00:00 2001 From: Luka5W <74739057+Luka5W@users.noreply.github.com> Date: Thu, 5 Oct 2023 23:12:05 +0000 Subject: [PATCH] changed the name to match the suggested name in #396 --- volume-widget/volume.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua index 6de3ef8..fdcc2a0 100644 --- a/volume-widget/volume.lua +++ b/volume-widget/volume.lua @@ -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 function GET_VOLUME_CMD(card, device, mixer) return 'amixer -c '..card..' -D '..device..' sget '..mixer 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 DEC_VOLUME_CMD(card, device, mixer, value_type, step) return 'amixer -c '..card..' -D '..device..' sset '..mixer..' '..value_type..' '..step..'%-' end -local function TOG_VOLUME_CMD(card, device, mixer) return 'amixer -c '..card..' -D '..device..' sset '..mixer..' toggle' 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, mixctrl, value_type, step) return 'amixer -c '..card..' -D '..device..' sset '..mixctrl..' '..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, mixctrl) return 'amixer -c '..card..' -D '..device..' sset '..mixctrl..' toggle' end local widget_types = { @@ -169,7 +169,7 @@ local function worker(user_args) local step = args.step or 5 local card = args.card or 1 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 toggle_cmd = args.toggle_cmd or nil @@ -190,18 +190,18 @@ local function worker(user_args) end 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 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 function volume:toggle() 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 - 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 @@ -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 end