Created
September 14, 2013 20:07
-
-
Save ar-nelson/6565186 to your computer and use it in GitHub Desktop.
Initial skeleton version of wmiirc.js, the user-modifiable configuration file for my node.js wmii config.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dialog = require('./lib/dialog.js'); | |
var wmii = require('./lib/wmii.js'); | |
var wmiir = require('./lib/wmiir.js'); | |
var modkey = 'Mod4'; | |
var terminal = 'urxvt'; | |
function attachModKey(mode) { | |
var newMode = {}; | |
for (var key in mode) { | |
if (key.indexOf('+' === 0)) | |
newMode[modkey + '-' + key.slice(1)] = mode[key]; | |
else | |
newMode[key] = mode[key]; | |
} | |
return newMode; | |
} | |
function tagctl(command) { | |
return function() { | |
wmiir.write('/tag/sel/ctl', command); | |
}; | |
} | |
function clientctl(command) { | |
return function() { | |
wmiir.write('/tag/client/ctl', command); | |
}; | |
} | |
wmii.defineAction('quit', function() { | |
wmii.events.emit('Exit'); | |
wmiir.write('/ctl', 'quit'); | |
}); | |
// The '+' will be replaced with the modkey in the actual keybindings. | |
var defaultMode = { | |
'+Left': tagctl('select left'), | |
'+Right': tagctl('select right'), | |
'+Up': tagctl('select up'), | |
'+Down': tagctl('select down'), | |
'+space': tagctl('select toggle'), | |
'+Shift-Left': tagctl('send sel left'), | |
'+Shift-Right': tagctl('send sel right'), | |
'+Shift-Up': tagctl('send sel up'), | |
'+Shift-Down': tagctl('send sel down'), | |
'+Shift-space': tagctl('send sel toggle'), | |
'+d': tagctl('colmode sel default-max'), | |
'+s': tagctl('colmode sel stack-max'), | |
'+m': tagctl('colmode sel stack+max'), | |
'+Shift-c': clientctl('kill'), | |
'+f': clientctl('Fullscreen toggle'), | |
'+Return': function() {wmiir.setsid(terminal);}, | |
'+p': wmii.programsMenu, | |
'+a': wmii.actionsMenu | |
}; | |
wmii.keys.defineMode('default', attachModKey(defaultMode)); | |
wmii.keys.setMode('default'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment