UNPKG

rkeys

Version:

A platform for creating tablet/HTML5 virtual-keyboard apps to send keystrokes to remote X11

41 lines (40 loc) 1.13 kB
// Generated by LiveScript 1.3.0 (function(){ var _, Cmd, Keyco, Keysim, split$ = ''.split; _ = require('lodash'); Cmd = require('../../command'); Keyco = require('../../x11/keycode'); Keysim = require('../../x11/keysim'); module.exports = function(arg$){ var command, direction, id, ref$, keys, ks, i$, len$, k, c; command = arg$.command, direction = arg$.direction, id = arg$.id; if (command != null) { if (_.isArray(command)) { return false; } if (_.contains(command, ' ')) { return false; } if (_.contains(command, ',')) { return false; } if ((ref$ = (keys = command)[0]) === '+' || ref$ === '-') { return false; } } else { if (id.length > 1 && _.contains(id, ',')) { return false; } keys = Cmd.applyAliases(id); } ks = split$.call(keys, '+'); for (i$ = 0, len$ = ks.length; i$ < len$; ++i$) { k = ks[i$]; if (Keyco.isKeysym(c = Cmd.getCommand(k))) { k = c; } [Keysim.down, Keysim.up][direction](k); } return true; }; }).call(this);