Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for the volume and mute keys on my Thinkpad

  • Loading branch information...
commit 74207f686c420bc1fd8eb6fb78448ed5463a5e4c 1 parent 8cafc9c
Mikito Takada authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 nwm-user.js
23 nwm-user.js
View
@@ -203,6 +203,29 @@ keyboard_shortcuts.forEach(function(shortcut) {
}
});
+
+// /usr/include/X11/XF86keysym.h
+
+var XF86keysym = {
+ AudioLowerVolume: 0x1008FF11, /* Volume control down */
+ AudioMute: 0x1008FF12, /* Mute sound from the system */
+ AudioRaiseVolume: 0x1008FF13 /* Volume control up */
+};
+
+// Experimental volume key support for my thinkpad
+
+nwm.addKey( { key: XF86keysym.AudioLowerVolume, modifier: 0 }, function() {
+ child_process.spawn('amixer', ['set', 'Master', '2dB-', 'unmute'], { env: process.env });
+});
+
+nwm.addKey( { key: XF86keysym.AudioMute, modifier: 0 }, function() {
+ child_process.spawn('amixer', ['set', 'Master', 'toggle'], { env: process.env });
+});
+
+nwm.addKey( { key: XF86keysym.AudioRaiseVolume, modifier: 0 }, function() {
+ child_process.spawn('amixer', ['set', 'Master', '2dB+', 'unmute'], { env: process.env });
+});
+
// REPL
// list windows
Please sign in to comment.
Something went wrong with that request. Please try again.