qtile: Toggle input language
This commit is contained in:
parent
fc5def267a
commit
abc9656562
@ -50,6 +50,8 @@ alt = "mod1"
|
||||
terminal = "kitty"
|
||||
kbd_lights = ["off", "low", "med", "high"]
|
||||
current_kbd_light = [0]
|
||||
current_language = ["en"]
|
||||
|
||||
def kbd_brightness_up(qtile):
|
||||
idx = current_kbd_light[0]
|
||||
current_kbd_light[0] = min(len(kbd_lights) - 1, idx+1)
|
||||
@ -62,6 +64,15 @@ def kbd_brightness_down(qtile):
|
||||
value = kbd_lights[current_kbd_light[0]]
|
||||
qtile.spawn(f"asusctl -k {value}")
|
||||
|
||||
def toggle_language(qtile):
|
||||
logger.warning(current_language[0])
|
||||
if current_language[0] == "en":
|
||||
qtile.spawn("setxkbmap -layout th")
|
||||
current_language[0] = "th"
|
||||
else:
|
||||
qtile.spawn("setxkbmap -layout us -variant altgr-intl")
|
||||
current_language[0] = "en"
|
||||
|
||||
keys = [
|
||||
# A list of available commands that can be bound to keys can be found
|
||||
# at https://docs.qtile.org/en/latest/manual/config/lazy.html
|
||||
@ -139,6 +150,7 @@ keys = [
|
||||
Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
|
||||
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
|
||||
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
||||
Key([mod, alt], "space", lazy.function(toggle_language), desc="Toggle Language Layout"),
|
||||
Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
|
||||
Key([], "XF86AudioLowerVolume", lazy.spawn("amixer sset Master 5%-")),
|
||||
Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer sset Master 5%+")),
|
||||
|
Loading…
x
Reference in New Issue
Block a user