Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save nekromoff/4d31c32be9fa06bf9a4288719f4c0d41 to your computer and use it in GitHub Desktop.

Select an option

Save nekromoff/4d31c32be9fa06bf9a4288719f4c0d41 to your computer and use it in GitHub Desktop.
KDE Plasma lockscreen script - always switch keyboard to English (US) on locking for easy password prompts for multilingual keyboards
#!/bin/bash
dbus-monitor --profile --session "type='signal',interface='org.kde.screensaver',path='/ScreenSaver',member='AboutToLock'" |
while read -r line; do
qdbus6 org.kde.keyboard /Layouts setLayout 0
#echo "switching"
done
@n1ret
Copy link
Copy Markdown

n1ret commented Mar 24, 2026

Thanks! I changed this a bit. Here's a version without the extra startup triggers:

#!/bin/bash
dbus-monitor --profile --session "type='signal',interface='org.kde.screensaver',path='/ScreenSaver',member='AboutToLock'" |
  grep --line-buffered "org.kde" |
  while read -r _; do
    qdbus6 org.kde.keyboard /Layouts setLayout 0 >/dev/null
  done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment