This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Create a script for enabling/disabling keyboard layout

Tags: None
(comma "," separated)
slumpgod
Registered Member
Posts
2
Karma
0
OS
So my problem is, because of some sort of a bug I have to disable all keyboard layouts except English to use some application, because they don't recognize Russian letters probably. So before I launch these apps I always have to go to keyboard settings and remove Russian layout, and when I'm done I switch it back.
Is there any way to write a script which will switch it for me? I mean, I have to know where files with keyboard configuration are, or some commands like setxkbmap?

Distro: KDE Neon 5.11(Ubuntu 16.04)
slumpgod
Registered Member
Posts
2
Karma
0
OS
So first script that I did is this
Code: Select all
#!/bin/bash
# Change keyboard layout

if [ "$(setxkbmap -v | awk -F "+" '/symbols/ {print $2}')" = "us" ]; then
    setxkbmap ru
else
    setxkbmap us
fi


But I'm not sure if it's a right way to do it in KDE...
User avatar
an7ar3s
Registered Member
Posts
19
Karma
0
You shouldn't have to write any scripts. If you go into the settings

Hardware > Input Devices > Keyboard
and then select the Layouts tab

you can assign shortcuts to change to a different keyboard layout. It might take a bit of fiddling to get it right.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]