-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprocess_key.py
23 lines (19 loc) · 858 Bytes
/
process_key.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# the magic script that gets called by all the others to filter and forward the key combo
#import logging # see the logs in ~/.config/autokey/autokey.log
import re
#logging.basicConfig(level=logging.DEBUG)
h = store.get_global_value('hotkey')
s = engine.get_return_value()
#logging.debug("combo got: " + str(s)) # autokey-gtk -l
#logging.debug(window.get_active_class())
#if re.match('^((?!.*Emacs).)*$', window.get_active_class()):
if re.match('.*(Emacs|gnome-terminal|konsole)', window.get_active_class()):
#logging.debug('passing through (%s) for %s' % (h, window.get_active_class()))
#print('Ignored')
keyboard.send_keys(h)
store.set_global_value('ignored', True)
else:
#logging.debug('replacing for: %s' % window.get_active_class())
#print('Not Ignored')
keyboard.send_keys(s)
store.set_global_value('ignored', False)