You are not logged in.
Hi,
Is there a way to query & change the keyboard layout from the command-line?
Something analogus to the mouse theme:
xfconf-query -c xsettings -p /Gtk/CursorThemeName -s "CURSOR_THEME_NAME"
Thanks
Offline
# to query:
xfconf-query -c keyboard-layout -p /Default/XkbLayout
# to set:
xfconf-query -c keyboard-layout -p /Default/XkbLayout -s us,ru,tr
Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please!
Offline
Thanks
I have 2 layouts defined &
xfconf-query -c keyboard-layout -p /Default/XkbLayout
shows both regardless of the active layout .
How do I check which layout is active?.
Last edited by jt1122 (2022-09-25 11:34:54)
Offline
Bump.
Any suggestions?.
Offline
setxkbmap LAYOUT
...and replace LAYOUT with the layout code you want to use.
And to query the current layout:
setxkbmap -query | grep layout | awk '{print $2}'
Last edited by ToZ (2022-09-26 14:33:40)
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks but
setxkbmap -query | grep layout | awk '{print $2}'
returns both layouts defined, not the one which is active.
Offline
For me, I get:
$ setxkbmap hr
$ setxkbmap -query | grep layout | awk '{print $2}'
hr
$ setxkbmap us
$ setxkbmap -query | grep layout | awk '{print $2}'
us
The flag on the Keyboard Layouts plugin changes as I use setxkbmap.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks, but you have only 1 layout defined at each point.
What happens if you define 2 layouts in settings->keyboard->layout ?
Offline
Perhaps I'm misunderstanding, but I do have 2 layouts defined.
$ xfconf-query -c keyboard-layout -p /Default/XkbLayout
us,hr
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
OK, it seems like there's an issue:
- If the layout is switched with a keyboard shortcut (settings->keyboard->layout->change layout option) or with the layout panel app but w/o calling setxkbmap then both layouts are shown.
- Once the layout has been set with setxkbmap the keyboard shortcut and the panel layout plugin stop working & the query returns only the layout by setxkbmap.
Can u try this on your machine to confirm?. Thanks
Last edited by jt1122 (2022-09-26 18:21:24)
Offline
And yes, I do see the same when I use that approach.. Good catch. It appears to be a bug.
Edit:
$ setxkbmap hr,us
$ setxkbmap us,hr
also works for me, and keeps in sync with the panel plugin.
Last edited by ToZ (2022-09-26 18:28:42)
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
great, thanks.
Offline
[ Generated in 0.014 seconds, 7 queries executed - Memory usage: 560.66 KiB (Peak: 577.5 KiB) ]