diff options
-rw-r--r-- | .config/awesome/awesome.lua | 3 | ||||
-rwxr-xr-x | .scripts/toggle_mute.sh | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/.config/awesome/awesome.lua b/.config/awesome/awesome.lua index a3614d6..a704ed5 100644 --- a/.config/awesome/awesome.lua +++ b/.config/awesome/awesome.lua @@ -234,6 +234,9 @@ globalkeys = awful.util.table.join( awful.key({ }, "XF86MonBrightnessDown", function () awful.util.spawn("sudo brightness down") end), awful.key({}, "XF86TouchpadToggle", function () awful.util.spawn(cmd.tggle_tpd) end), awful.key({}, "XF86TouchpadOn", function () awful.util.spawn(cmd.tggle_tpd) end), + -- Manually mapped x220 micmute button to XF86Launch2 (prog2) in udev: keymap.rules + awful.key({}, "XF86AudioMute", function () awful.util.spawn(os.getenv("HOME") .. "/.scripts/toggle_mute.sh output") end), + awful.key({}, "XF86Launch2", function () awful.util.spawn(os.getenv("HOME") .. "/.scripts/toggle_mute.sh input") end), awful.key({ modkey, "Shift" }, "r", awesome.restart), awful.key({ modkey, "Shift" }, "q", awesome.quit), diff --git a/.scripts/toggle_mute.sh b/.scripts/toggle_mute.sh new file mode 100755 index 0000000..0d6edd1 --- /dev/null +++ b/.scripts/toggle_mute.sh @@ -0,0 +1,11 @@ +dev="alsa_output.pci-0000_00_1b.0.analog-stereo" +tp=ink + +if [[ "x$1" = "xinput" ]]; then + dev="alsa_input.pci-0000_00_1b.0.analog-stereo" + tp=ource +fi + +LC_ALL=C pactl list | \ + sed -n -e:a -eN -e"/^S$tp.*Name: $dev.*Mute: no/q1" -e'/\n$/d' -eba +pactl "set-s$tp-mute" $dev $? |