File: get_current_config.py

package info (click to toggle)
python-xklavier 0.4-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch, wheezy
  • size: 1,348 kB
  • ctags: 130
  • sloc: sh: 10,147; python: 85; makefile: 53; ansic: 17
file content (38 lines) | stat: -rw-r--r-- 910 bytes parent folder | download
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
#!/usr/bin/env python
#
# I, Sayamindu Dasgupta <sayamindu@laptop.org, am the original author of 
# this work.  I hereby donate it into the public domain, and relinquish any 
# rights I may have in it.

import xklavier
import gtk

display = gtk.gdk.display_get_default()
engine = xklavier.Engine(display)

crec = xklavier.ConfigRec()
crec.get_from_server(engine)

print "Layouts:"
for layout in crec.get_layouts():
    print "\t%s" % layout

print "Variants:"
for variant in crec.get_variants():
    print "\t%s" % variant

print "Options:"
for option in crec.get_options():
    print "\t%s" % option

print "Model:"
print "\t%s" % crec.get_model()

engine.start_listen(xklavier.XKLL_TRACK_KEYBOARD_STATE)
state = engine.get_current_state()
engine.stop_listen()

active_group = state['group']
print "Active group:"
print "\t%s(%s)" % (crec.get_layouts()[active_group], \
    crec.get_variants()[active_group])