forked from tgrosinger/aenea-grammars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_screen.py
47 lines (38 loc) · 1.13 KB
/
_screen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Created for aenea using libraries from the Dictation Toolbox
# https://github.com/dictation-toolbox/dragonfly-scripts
#
# Commands for interacting with Git
#
# Author: Tony Grosinger
#
# Licensed under LGPL
import aenea
import aenea.configuration
from aenea.lax import Key
from aenea import IntegerRef
import dragonfly
screen_context = aenea.ProxyPlatformContext('linux')
grammar = dragonfly.Grammar('screen', context=screen_context)
screen_mapping = aenea.configuration.make_grammar_commands('screen', {
'screen (right|next)': Key("c-a, n"),
'screen (left|previous)': Key("c-a, p"),
'screen create': Key("c-a, c"),
'screen <n>': Key("c-a, %(n)d"),
'screen rename': Key("c-a, s-a"),
'screen exit': Key("c-a, backslash"),
'screen [split] vertical': Key("c-a, bar"),
'screen [split] horizontal': Key("c-a, s-s"),
'screen split next': Key("c-a, tab")
})
class Mapping(dragonfly.MappingRule):
mapping = screen_mapping
extras = [
IntegerRef('n', 0, 10)
]
grammar.add_rule(Mapping())
grammar.load()
def unload():
global grammar
if grammar:
grammar.unload()
grammar = None