Skip to content

Commit

Permalink
bugfix: volume level was not displayed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Luka5W committed Oct 7, 2023
1 parent 390f501 commit c76ea14
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions volume-widget/volume.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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, mixctrl) return 'amixer -c '..card..' -D '..device..' sget '..mixctrl end
local function GET_VOLUME_CMD(card, device, mixctrl, value_type) return 'amixer -c '..card..' -D '..device..' sget '..mixctrl..' '..value_type 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
Expand Down Expand Up @@ -214,7 +214,7 @@ local function worker(user_args)
if toggle_cmd == nil then
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, mixctrl), 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, value_type), function(stdout) update_graphic(volume.widget, stdout) end) end)
end
end

Expand All @@ -241,7 +241,7 @@ local function worker(user_args)
)
)

watch(GET_VOLUME_CMD(card, device, mixctrl), refresh_rate, update_graphic, volume.widget)
watch(GET_VOLUME_CMD(card, device, mixctrl, value_type), refresh_rate, update_graphic, volume.widget)

return volume.widget
end
Expand Down

0 comments on commit c76ea14

Please sign in to comment.