diff --git a/rc.lua b/rc.lua index c219fdf..8ed6f1e 100644 --- a/rc.lua +++ b/rc.lua @@ -391,17 +391,17 @@ root.buttons(awful.util.table.join( globalkeys = awful.util.table.join( -- Volume control -- 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.util.spawn("amixer set Master 9%-") end), + os.execute("pgrep -x amixer || amixer set Master 1%-") end), awful.key({ modkey }, "/", function () awful.util.spawn("amixer sset Master toggle") end), -- Volume control -- 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.util.spawn("amixer set Master 9%-") end), + os.execute("pgrep -x amixer || amixer set Master 1%-") end), awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer sset Master toggle") end), diff --git a/wi.lua b/wi.lua index aa5fcf6..ee1a425 100644 --- a/wi.lua +++ b/wi.lua @@ -73,16 +73,16 @@ volicon:set_image(beautiful.widget_vol) volicon:buttons( awful.util.table.join( 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({ }, 5, 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 () os.execute("pgrep -x amixer || amixer set Master 1%-") end) ) ) volpct = wibox.widget.textbox() volpct:buttons( awful.util.table.join( 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({ }, 5, 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 () os.execute("pgrep -x amixer || amixer set Master 1%-") end) ) ) vicious.register(volpct, vicious.widgets.volume, "$1% ", nil, "Master")