Last active
February 2, 2023 21:52
-
-
Save luluco250/5b8f06c2191f6de0ac3738e1b0311611 to your computer and use it in GitHub Desktop.
Bash script that forcibly shows or hides the virtual keyboard in KDE/KWin, useful for mobile devices. Works with Maliit.
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
#!/bin/bash | |
call_dbus() { | |
dbus-send \ | |
--print-reply=literal \ | |
--session \ | |
--dest=org.kde.KWin \ | |
/VirtualKeyboard \ | |
"$@" | |
} | |
active=$(call_dbus \ | |
org.freedesktop.DBus.Properties.Get \ | |
string:org.kde.kwin.VirtualKeyboard \ | |
string:active | awk '{ print $3 }' \ | |
) | |
case "$active" in | |
true) | |
call_dbus \ | |
org.freedesktop.DBus.Properties.Set \ | |
string:org.kde.kwin.VirtualKeyboard \ | |
string:active \ | |
variant:boolean:false | |
;; | |
false) | |
call_dbus \ | |
org.kde.kwin.VirtualDesktop.willShowOnActive | |
boolean:true | |
call_dbus \ | |
org.kde.kwin.VirtualKeyboard.forceActivate | |
;; | |
*) exit 1;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment