rkeys
Version:
A platform for creating tablet/HTML5 virtual-keyboard apps to send keystrokes to remote X11
119 lines (102 loc) • 4.04 kB
text/jade
// example.jade -- compiled and served as html at runtime
// use the built-in keys template
extend /template/keys
// append to the head block as we want to keep what's already there
append head
title rkeys examples
// example.css is generated on-the-fly from example.styl
+css('example.css')
block layout
h1 rkeys examples
// see ../ui/mixin/keys.jade for +key() and +keys() documentation
section
h2 Single keys
p.
Press and hold for native auto-repeat.
Try pressing Shift with a key (requires a multi-touchpoint tablet).
Also try to 'latch' the Shift by releasing your finger away from the key
(this is similar to caps-lock on a traditional keyboard). To unlatch,
simply tap the key again.
// See the full list of keysyms at https://github.com/sidorares/node-x11/blob/master/lib/keysyms.js
// single keysym without the XK_
+key('a')
// set of keys with implied labels
+keys('b c 1 2 3')
// keys with explicit labels
+key('Shift_L Shift').latchable.w-2
+key('BackSpace Back- space')
section
h2 Key chords
p.
Key chords are denoted by infix `+`.
Standard modifiers are S+ for Shift, C+ for Control and A+ for Alt.
Press and hold for native auto-repeat.
// modifier aliases (like S+ for Shift_L+) are defined in ../io/command.yaml
+keys('S+a', 'C+F5', 'C+Page_Down next tab', 'type-an-asterisk *')
section
h2 Key sequences with delay and non-native auto-repeat
p Press and hold for non-native auto-repeat.
// integers 0..9 are digits, otherwise time delay in milliseconds
// a trailing delay denotes auto repeat
+key('a,b,c a,b,c')
+key('a,500,b,500,c a,b,c (slow)')
+key('0,1,2,1000 0,1,2 (repeat)')
+key('A,500,S+b,500,c,1000 A,S+b,c (repeat slow)')
// defined in command.yaml
+key('345 3 4 5 (repeat slow)')
+key('HelloWorld Hello World')
section
h2 Compose key sequences for special characters
p Note: these examples will only work if your compose key is set up as Super_L.
// defined in command.yaml
+keys('£ ¶ ½')
section
h2 Mouse buttons
// button command is defined in ../io/command.yaml
+keys('button:1 left', 'button:2 middle', 'button:3 right')
+keys('button:4 wheel up', 'button:5 wheel down')
+keys('button:6 button 6', 'button:7 button 7', 'button:8 button 8')
section
h2 Layout switching
// layout command is defined in ../io/command.yaml
+keys('layout:numbers', 'layout:symbols').w-3.latchable
.layout.default
+keys('a b c')
.layout.numbers
+keys('1 2 3')
.layout.symbols
+keys('[ ] .')
section
h2 Custom scripts
p Snippets of JavaScript or LiveScript can create commands at runtime.
+keys('0to9', 'jkl:3')
+key('type:Hello!').w-2
+key('now date-time now').w-2
section
h2 Shell exec
p Check rkeys node console for standard output messages.
+keys('echo:foo,bar,baz exec echo', 'xterm exec xterm')
section
h2: a(href='http://fortawesome.github.io/Font-Awesome/icons') Font Awesome icons
// include fa-* in the label
+keys('C+c edit copy fa-copy', 'C+x edit cut fa-cut', 'C+v edit paste fa-paste')
section
h2 Context sensitivity
p Moving the active window focus to/from a xterm will reveal/hide some text beneath.
+show-if(activeWindowTitle='xterm|@')
p This text will show only if the active window title contains 'xterm' or '@'.
section
h2 Server-side sound
p.
Sounds are played via shell-exec on the target Linux box and are assigned in command.yaml.
This example uses ALSA's aplay command but you can easily reconfigure
for different sound architectures. The latency seems very low.
+keys('d e f g h')
section
h2 Client-side sound (experimental)
p.
Sounds are played in the browser.
Unfortunately the latency seems significantly higher than server-side.
+keys('i j k l m n o')
prepend script
+script('client-side-sound.js')