Author Topic: Peppermint 7 - Multiple keyboard layout switching, with panel notification.  (Read 4270 times)

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Let's say you would like to have the gb (GB English) and us (US English) and es (Spanish) keyboard layouts and be able to switch between them with the keyboard shortcut Left_Alt+Left_Shift and have a panel applet that displays the current layout.

First test layout toggling works, by opening a terminal and running
Code: [Select]
setxkbmap -option grp:lalt_lshift_toggle "gb,us,es"now test that Alt+Shift switches your keyboard layout.

If it does, we need to autostart that command at login, so back in the terminal run:
Code: [Select]
sudo pluma /etc/xdg/autostart/keyboard-layout-switcher.desktopwhen a BLANK file opens, make it read:
Code: [Select]
[Desktop Entry]
Type=Application
Name=Keyboard Layout Switcher
Comment=Toggle between keyboard layouts
Exec=sh -c 'sleep 10 ; setxkbmap -option grp:lalt_lshift_toggle "gb,us,es"'
SAVE the file and exit pluma.

Now we need to add the panel applet to show the currently selected layout .. so back in the terminal run:
Code: [Select]
sudo apt-get install xfce4-xkb-pluginNow right-click on the panel and select Panel > Panel Preferences > Items (tab), then click the "Add" (+) button .. highlight the "Keyboard Layouts" applet and click the "+Add" button at the bottom, then the "Close" button .. back in the panel items list highlight the "Keyboard Layout"item, and you can now use the up/down arrow buttons to move the applet to where you want it on the panel.

Obviously, you can use other layouts than gb,us,es .. just use whichever you want (and as many as you want as long as they're separated by comma's) ;)





To UNDO

Remove the "Keyboard Layouts" panel applet, then run:
Code: [Select]
sudo rm -v /etc/xdg/autostart/keyboard-layout-switcher.desktopthen reboot.
« Last Edit: October 01, 2016, 05:13:33 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline berliner58

  • Member
  • ***
  • Posts: 68
  • Karma: 7
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 8
Thank you very much for the tutorial.

I need  german und russian keyboard layout and followed your instructions.
The xfce-icon in the panel works fine.
One click on it an it changes to russian flag.

Only problem I noticed:
When I click on the shut-down button in the main menu in order to decide whether to shut-down the PC or to just log out of the session or other options, the options now are not in my german language, but every second option is in russian language.
Only my wife can read russian, so I have to guess what option it could be.

In another preference (don't remember the name of it) I installed russian language.
Maybe that was a mistake ?

I installed Peppermint 7 today and in the installer I chose german language.
Firefox and all the menus are in german, but now I have the problem at logout or shutdown with these russian buttons.
What should I do ?

Here is the info about my PC:
inxi -Fz
[close]
« Last Edit: October 03, 2016, 04:48:16 am by berliner58 »
P8 x64 Desktop Dual core Pentium E5400 (-MCP-) RAM: 8GB

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Hi berliner58, and welcome to the forum :)

This is a keyboard layout switcher .. it is NOT a language/locale selector.

ONLY the keyboard layout switches, if you want to change the default language/locale you'll have to do that via the peppermint-settings-panel.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline berliner58

  • Member
  • ***
  • Posts: 68
  • Karma: 7
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 8
I see.

I uninstalled the russian language packages.
The keyboard layout switcher does ist job and switches between german and russian.

The shutdown-menu though now shows the buttons in english which were russian before and the rest in german.
I will upload a screenshot as soon as I find out how.

So something is messed up in my new Peppermint installation but I can live with it because I understand some english.



« Last Edit: October 01, 2016, 12:26:47 pm by berliner58 »
P8 x64 Desktop Dual core Pentium E5400 (-MCP-) RAM: 8GB

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
All I can tell you at this point is I can see no way for the above instructions to have caused that .. they have nothing to do with locale settings.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline berliner58

  • Member
  • ***
  • Posts: 68
  • Karma: 7
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 8
PCNetSpec,
I agree.

Your instructions for implementing a multiple keyboard layout switching work.

My lxsession-logout mixture of  different languages have nothing to do with it, so maybe you just delete my postings in this thread.

Since I can live with the mixture of german and english in menues I won't even spend hours of searching for a solution for it.
Thank you.

Edit:
I have several Distros installed on my PC.  ( Linux Mint 18 Mate,  LMDE 2 Betsy with LXDE Desktop, Sparky Linux and now Peppermint 7 because somebody mentioned it as good in the linuxmintusers - forum )
Just started LMDE2 with LXDE Desktop an guess what ?  The logout menu is identical to the lxsession-logout menu in Peppermint 7 . No big thing an expert would say, but for a newbie like me this is a surprise somehow.

So the mixture of english and german in the session-logout is just LXDE code in action and indeed has nothing to do with Peppermint or the keyboard-switcher of Xfce.
« Last Edit: October 02, 2016, 05:28:00 am by berliner58 »
P8 x64 Desktop Dual core Pentium E5400 (-MCP-) RAM: 8GB

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
You're welcome :)

PS. I'll leave the contents "as is" for now, just on the off-chance someone else has a similar issue .. then we'll need to look into it.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline gkiritsop

  • Newly Subscribed
  • *
  • Posts: 1
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 7
It worked!
Fast and easy.
 :) :)

I was searching inside all the menus,but no luck. I was not sure what was the problem and couldn't find the settings to add the language switcher. I didn't know that I had to write a 'script' to make it run!

Thanks a lot!

Offline murraymint

  • Trusted User
  • Veteran
  • *****
  • Posts: 2169
  • Karma: 415
  • soft boiled with a yolk of gold
    • View Profile
  • Peppermint version(s): 7, 8, 9

I have several Distros installed on my PC.  ( Linux Mint 18 Mate,  LMDE 2 Betsy with LXDE Desktop, Sparky Linux and now Peppermint 7 because somebody mentioned it as good in the linuxmintusers - forum )
Just started LMDE2 with LXDE Desktop an guess what ?  The logout menu is identical to the lxsession-logout menu in Peppermint 7 .

Are you using the same home partition for different distros?

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
It worked!
Fast and easy.
 :) :)

Great stuff :)

Quote
I didn't know that I had to write a 'script' to make it run!

Ah, but don't you feel a sense of accomplishment :)

There's always a trade-off between "lightness" and "feature packed", but we're looking into a better/easier GUI solution for Peppermint 8 as this is really a pretty basic requirement ;)

Quote
Thanks a lot!

You're most welcome :)
« Last Edit: November 08, 2016, 02:55:52 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline berliner58

  • Member
  • ***
  • Posts: 68
  • Karma: 7
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 8
Re: Peppermint 7 - Multiple keyboard layout switching, with panel notification.
« Reply #10 on: November 10, 2016, 03:55:37 am »
Quote
Are you using the same home partition for different distros?
No.
I tried that a few times and it works, but now each distro has it's own home partition.
P8 x64 Desktop Dual core Pentium E5400 (-MCP-) RAM: 8GB