Sound volume controls fixed: .spawn() runs multiple amixer commands so right/left controls changes not synchronously.

This commit is contained in:
Kolan Sh 2016-10-13 15:32:44 +03:00
parent ff4e8ba2d4
commit 738c403532
2 changed files with 8 additions and 8 deletions

8
rc.lua
View File

@ -391,17 +391,17 @@ root.buttons(awful.util.table.join(
globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(
-- Volume control -- -- Volume control --
awful.key({ modkey }, ".", function () awful.key({ modkey }, ".", function ()
awful.util.spawn("amixer set Master 9%+") end), os.execute("pgrep -x amixer || amixer set Master 1%+") end),
awful.key({ modkey }, ",", function () awful.key({ modkey }, ",", function ()
awful.util.spawn("amixer set Master 9%-") end), os.execute("pgrep -x amixer || amixer set Master 1%-") end),
awful.key({ modkey }, "/", function () awful.key({ modkey }, "/", function ()
awful.util.spawn("amixer sset Master toggle") end), awful.util.spawn("amixer sset Master toggle") end),
-- Volume control -- -- Volume control --
awful.key({ }, "XF86AudioRaiseVolume", function () awful.key({ }, "XF86AudioRaiseVolume", function ()
awful.util.spawn("amixer set Master 9%+") end), os.execute("pgrep -x amixer || amixer set Master 1%+") end),
awful.key({ }, "XF86AudioLowerVolume", function () awful.key({ }, "XF86AudioLowerVolume", function ()
awful.util.spawn("amixer set Master 9%-") end), os.execute("pgrep -x amixer || amixer set Master 1%-") end),
awful.key({ }, "XF86AudioMute", function () awful.key({ }, "XF86AudioMute", function ()
awful.util.spawn("amixer sset Master toggle") end), awful.util.spawn("amixer sset Master toggle") end),

8
wi.lua
View File

@ -73,16 +73,16 @@ volicon:set_image(beautiful.widget_vol)
volicon:buttons( volicon:buttons(
awful.util.table.join( awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn("urxvt -e alsamixer --view=all") end), awful.button({ }, 1, function () awful.util.spawn("urxvt -e alsamixer --view=all") end),
awful.button({ }, 4, function () awful.util.spawn("amixer set Master 1%+") end), awful.button({ }, 4, function () os.execute("pgrep -x amixer || amixer set Master 1%+") end),
awful.button({ }, 5, function () awful.util.spawn("amixer set Master 1%-") end) awful.button({ }, 5, function () os.execute("pgrep -x amixer || amixer set Master 1%-") end)
) )
) )
volpct = wibox.widget.textbox() volpct = wibox.widget.textbox()
volpct:buttons( volpct:buttons(
awful.util.table.join( awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn("urxvt -e alsamixer --view=all") end), awful.button({ }, 1, function () awful.util.spawn("urxvt -e alsamixer --view=all") end),
awful.button({ }, 4, function () awful.util.spawn("amixer set Master 1%+") end), awful.button({ }, 4, function () os.execute("pgrep -x amixer || amixer set Master 1%+") end),
awful.button({ }, 5, function () awful.util.spawn("amixer set Master 1%-") end) awful.button({ }, 5, function () os.execute("pgrep -x amixer || amixer set Master 1%-") end)
) )
) )
vicious.register(volpct, vicious.widgets.volume, "$1% ", nil, "Master") vicious.register(volpct, vicious.widgets.volume, "$1% ", nil, "Master")