update dotool wrapper to use keyd layout
output
This commit is contained in:
parent
fe9f18c43d
commit
70ec6f36da
@ -1,2 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
DOTOOL_XKB_LAYOUT=us DOTOOL_XKB_VARIANT=$(get_plasma_keyboard_layout) /usr/bin/dotool "$@"
|
|
||||||
|
current_layer=$(timeout 0.1s keyd listen | grep -m 1 '^/' | sed 's/^\///')
|
||||||
|
if [ "$current_layer" = "qwerty" ]; then
|
||||||
|
current_layer="basic"
|
||||||
|
fi
|
||||||
|
DOTOOL_XKB_LAYOUT=us DOTOOL_XKB_VARIANT=$current_layer /usr/bin/dotool "$@"
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import dbus
|
|
||||||
|
|
||||||
def get_keyboard_info():
|
|
||||||
bus = dbus.SessionBus()
|
|
||||||
keyboard = bus.get_object('org.kde.keyboard', '/Layouts')
|
|
||||||
keyboard_interface = dbus.Interface(keyboard, dbus_interface='org.kde.KeyboardLayouts')
|
|
||||||
|
|
||||||
layouts_list = keyboard_interface.getLayoutsList()
|
|
||||||
current_layout_index = keyboard_interface.getLayout()
|
|
||||||
|
|
||||||
return layouts_list, current_layout_index
|
|
||||||
|
|
||||||
def set_keyboard_layout_env(layouts_list, current_layout_index):
|
|
||||||
current_layout = layouts_list[current_layout_index]
|
|
||||||
_, _, name = current_layout
|
|
||||||
|
|
||||||
if "Dvorak" in name:
|
|
||||||
keyboard_layout = "dvorak"
|
|
||||||
elif "US" in name:
|
|
||||||
keyboard_layout = "basic"
|
|
||||||
else:
|
|
||||||
keyboard_layout = "unknown"
|
|
||||||
|
|
||||||
return keyboard_layout
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
layouts_list, current_layout_index = get_keyboard_info()
|
|
||||||
keyboard_layout = set_keyboard_layout_env(layouts_list, current_layout_index)
|
|
||||||
print(keyboard_layout)
|
|
Loading…
Reference in New Issue
Block a user