diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-03-06 23:30:51 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-03-06 23:30:51 +0100 |
commit | a0763e0442c998db9f71074b35ba9a3376357bae (patch) | |
tree | f1bd43a5e69eb00bd3d449f9260d0c7fd2b9f306 | |
parent | m (diff) | |
download | xpybar-a0763e0442c998db9f71074b35ba9a3376357bae.tar.gz xpybar-a0763e0442c998db9f71074b35ba9a3376357bae.tar.bz2 xpybar-a0763e0442c998db9f71074b35ba9a3376357bae.tar.xz |
fix and use xkb lock keys
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | examples/plugin-test | 9 | ||||
-rw-r--r-- | src/plugins/xkb.py | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/examples/plugin-test b/examples/plugin-test index a012542..5c5d84a 100644 --- a/examples/plugin-test +++ b/examples/plugin-test @@ -18,6 +18,7 @@ from plugins.moc import MOC from plugins.cpu import CPU from plugins.clock import Clock from plugins.network import Network +from plugins.xkb import XKB OUTPUT, HEIGHT, YPOS, TOP = 0, 3 * 12, 24, True @@ -187,14 +188,18 @@ def redraw(): net_total = '%.2fGB|%.2fGB' % (sum([rx for _, rx, tx in net_]), sum([tx for _, rx, tx in net_])) net = '%s : %s' % (' '.join(net_each), net_total) + xkb_ = XKB() + locks = ' '.join([x.lower() for x in xkb_.get_locks_str()]) + xkb = 'Xkb:%s' % ('' if len(locks) == 0 else ' ' + locks) + text = ['%s │ %s │ %s │ %s │ %s │ %s %s │ %s │ %s │ %s │ %s' ,'%s │ %s │ %s' - ,'%s'] + ,'%s │ %s'] text = '\n'.join(text) text %= (date, uptime, idle, loadavg, users, uname, xdisplay, mem, swp, shm, moc, discs, discstats, cpu, - net) + net, xkb) bar.clear() bar.draw_coloured_text(0, 10, 0, 2, text) diff --git a/src/plugins/xkb.py b/src/plugins/xkb.py index 362dba0..004f1bf 100644 --- a/src/plugins/xkb.py +++ b/src/plugins/xkb.py @@ -50,7 +50,7 @@ class XKB: ''' self.__root = get_screen().root - lockkey = lambda lock : self.__display.keysym_to_keycode(Xlib.XK.string_to_keysym(lock + '_Lock')) + lockkey = lambda lock : get_display().keysym_to_keycode(Xlib.XK.string_to_keysym(lock + '_Lock')) find = lambda array, item : (1 << array.index(item)) if item in array else -1 mods = [x[0] for x in get_display().get_modifier_mapping()] |