-
-
Save anonymous/b2367596e6fd35c4e84a to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
import time | |
import os | |
import subprocess | |
_XKBS=os.path.expanduser("~/.i3/xkblayout-state") | |
class Py3status(object): | |
def EmitMessage(self, i4status_output_json, i3status_config): | |
response = { | |
"name" : "keyboard", | |
"cached_until": time.time()+1, | |
"full_text":"O", | |
} | |
out, err = subprocess.Popen([_XKBS,"print","%s"], stderr=subprocess.DEVNULL, stdout=subprocess.PIPE).communicate() | |
response["full_text"] = out.decode() | |
return (0,response) | |
def on_click(self, i3status_output_json, i3status_config, evt): | |
subprocess.call([_XKBS,"set","+1"], | |
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment