Last active
September 17, 2016 19:40
-
-
Save strycore/9748bfbdb55bb3ffb704bc74ab60487f to your computer and use it in GitHub Desktop.
Test layout switching in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import subprocess | |
print("Set layout to 'us'") | |
setxkbmap_command = ['setxkbmap', '-model', 'pc101', 'us', '-print'] | |
xkbcomp_command = ['xkbcomp', '-', os.environ.get('DISPLAY', ':0')] | |
xkbcomp = subprocess.Popen(xkbcomp_command, env=os.environ, stdin=subprocess.PIPE).stdin | |
subprocess.Popen(setxkbmap_command, | |
env=os.environ, | |
stdout=xkbcomp, | |
stdin=subprocess.PIPE).communicate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment