adds variant to xkblayout
This commit is contained in:
parent
79c773184a
commit
0a63932c62
@ -20,7 +20,7 @@ class Xkblayout(IntervalModule):
|
|||||||
on_leftclick = "change_layout"
|
on_leftclick = "change_layout"
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
kblayout = subprocess.check_output("setxkbmap -query | awk '/layout/{print $2}'", shell=True).decode('utf-8').strip()
|
kblayout = subprocess.check_output("setxkbmap -query | awk '/layout/,/variant/{print $2}'", shell=True).decode('utf-8').replace("\n"," ").strip()
|
||||||
|
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(name=kblayout).upper(),
|
"full_text": self.format.format(name=kblayout).upper(),
|
||||||
@ -29,12 +29,12 @@ class Xkblayout(IntervalModule):
|
|||||||
|
|
||||||
def change_layout(self):
|
def change_layout(self):
|
||||||
layouts = self.layouts
|
layouts = self.layouts
|
||||||
kblayout = subprocess.check_output("setxkbmap -query | awk '/layout/{print $2}'", shell=True).decode('utf-8').strip()
|
kblayout = subprocess.check_output("setxkbmap -query | awk '/layout/,/variant/{print $2}'", shell=True).decode('utf-8').replace("\n"," ").strip()
|
||||||
if kblayout in layouts:
|
if kblayout in layouts:
|
||||||
position = layouts.index(kblayout)
|
position = layouts.index(kblayout)
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(["setxkbmap", layouts[position + 1]])
|
subprocess.check_call(["setxkbmap"] + layouts[position + 1].split())
|
||||||
except IndexError:
|
except IndexError:
|
||||||
subprocess.check_call(["setxkbmap", layouts[0]])
|
subprocess.check_call(["setxkbmap"] + layouts[0].split())
|
||||||
else:
|
else:
|
||||||
subprocess.check_call(["setxkbmap", layouts[0]])
|
subprocess.check_call(["setxkbmap"] + layouts[0].split())
|
||||||
|
Loading…
Reference in New Issue
Block a user