Shortcut for switching between keyboard layouts (languages)?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
beansandjeans

Shortcut for switching between keyboard layouts (languages)?

Post by beansandjeans »

So I recently installed Mint 13 XFCE on a netbook, and this computer is shared with someone who uses the German keyboard layout. I have both keyboard layouts (German and US English) set-up, but the process of switching between them is somewhat tedious - I have to go into the keyboard settings menu, and from there to the layout tab, and then switch from one language to the other. I put a shortcut to this menu on the desktop, so at least I don't have to navigate through the menu to get to it, but it's still rather tedious.

This is the first time I've worked used multiple keyboard layouts on a Linux computer. On Windows it was always just a matter of Alt-Shift.

So I'm wanting to know if there's any existing shortcut that could be used, or if one could be set up...

In that same keyboard menu there's an "application shortcuts" tab, and I've made a new shortcut already for an application, but I imagine this might also work for other keyboard shortcuts in general. But for that I need a command, and I don't know what the command is to switch between keyboard layouts. I hope there is one, and preferably one that can be used to toggle it in either direction (the same command to switch from English to German and vice versa), but if has to be two separate commands that's not a big deal.

All help much appreciated! Thanks :-)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
beansandjeans

Re: Shortcut for switching between keyboard layouts (languag

Post by beansandjeans »

UPDATE:

Nobody had replied here, so I did a bit more digging and finally found a thread on a PC Linux forum which discussed this: http://www.pclinuxos.com/forum/index.php?topic=95438.0

One of the replies gave this command: "setxkbmap XX" (excluding the quotation marks), with the "XX" for the keyboard layout language.

So for the shortcuts then, "setxkbmap de" ended up working for German. "setxkbmap en" DOESN'T work for English, but "setxkbmap us" did, and I would imagine similar commands for other variants would as well, like "setxkbmap uk" for the UK English layout.

I'm not sure if these commands also work in Gnome/MATE or other environments, or if they're just for XFCE.

Also still don't know if there's one command that would toggle it in both directions. If anyone knows if that's possible, please let me know...

But at least it's working a lot better now than having to go into the menu each time! :-)
nissimnanach

Re: Shortcut for switching between keyboard layouts (languag

Post by nissimnanach »

LINUX MINT 14: LEFT SHIFT + CAPS LOCK is default

Change default by:
1. Right-click on keyboard language indicator in right
2. Select "Layouts" tab
3. Options: KEYS TO CHANGE LAYOUT
OxidE

Re: Shortcut for switching between keyboard layouts (languag

Post by OxidE »

Can someone explain in simple way how to change keyboard languages with alt+shit combination?
User avatar
dman
Level 3
Level 3
Posts: 100
Joined: Sat May 05, 2012 9:28 am
Location: Wiesbaden, Germany
Contact:

Re: Shortcut for switching between keyboard layouts (languag

Post by dman »

In xfce, this works:

Code: Select all

setxkbmap -option grp:alt_shift_toggle "de,us"

That's to switch between English-US and German-DE on the command line using Alt+Shift.

I'm trying to figure out where to put that for a permanent setting. I know where in Lubuntu, but that path and file are not applicable to xfce.

/dman
yarlipo

Re: Shortcut for switching between keyboard layouts (languag

Post by yarlipo »

It amazes me that Linux Mint doesn't have a built in solution for toggling languages. Nevertheless, I used the solution posted above, and I figured out a way to store it between sessions. Hopefully people can find this straight away, it took me days to find a solution.

Go to Menu - Settings - Session and Startup. Chose application autostart. Click on add. Fill in the first two lines with whatever you prefer, and then in the Command field paste the code dman kindly provided:

setxkbmap -option grp:alt_shift_toggle "de,us"

replacing de and us with your own language code.

Note that the language mentioned first will be activated as the default language when you boot.

That's it! Now your linux mint install remembers the toggle between sessions.
gikos

Re: Shortcut for switching between keyboard layouts (languag

Post by gikos »

really helpful for newbies.
thanks a lot.
User avatar
cipricus
Level 1
Level 1
Posts: 34
Joined: Fri Feb 08, 2013 8:23 am

Re: Shortcut for switching between keyboard layouts (languag

Post by cipricus »

nissimnanach's answer is the good one, although it refers to Xfce 14 Nadia: in 13 Maya things are the same, as it already includes Xfce version 4.10

The solution seemed so obvious that the only explanation i imagined for the reportred problem was that the keyboard layout app was not added to the panel and therefore was not there to be seen.

I really do not understand how come "Linux Mint doesn't have a built in solution for toggling languages"! It has.

First be sure that the xfce4-xkb-plugin is visible on the Xfce panel: right click on the panel, 'Panel/Add new items' and search for 'Keyboard Layouts'. After that the list of keyboard layouts is displayed there, and you can select the one you want
111.png
(so, there's no need to "go into the keyboard settings menu, and from there to the layout tab, and then switch from one language to the other" - as the author of the question says.)

To set shortcut, right-click on the panel applet and in Properties there's the option of setting Alt-Shift or anything you want, under 'Change layout option'.

(By the way, it is better to set Right-Alt under 'Compose key position', or the AltGr key might not work under Wine.)
2222.png
fazecasciprian

Re: Shortcut for switching between keyboard layouts (languag

Post by fazecasciprian »

regional settings -->layouts-->options-->key(s) to change layout-->select and close
Locked

Return to “Xfce”