diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-01-05 20:50:14 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-01-05 20:50:14 +0100 |
commit | 626bd5b7f1dbb0b330b6bdbf9aaf702241abda43 (patch) | |
tree | 52b8cc8a67668a5a66c8a0455033fafb0354e4fc | |
parent | 3d0f7e6211f3873417f8d0c69821dedd6879dbc0 (diff) | |
download | dotfiles-626bd5b7f1dbb0b330b6bdbf9aaf702241abda43.tar.gz dotfiles-626bd5b7f1dbb0b330b6bdbf9aaf702241abda43.tar.bz2 dotfiles-626bd5b7f1dbb0b330b6bdbf9aaf702241abda43.zip |
Add keybindings + scripts to mute mic and speakers on x220
-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 $? |