Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/samples/get_current_config.py
blob: 10d14295fdb26c7d1555baac79200c300bef2459 (plain)
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])