Page 1 of 2

Need help setting new keyboard layout Swiss-French

Posted: Fri Oct 22, 2010 1:24 am
by nomnex
Fedora 13 Lxde (pcman 0.9.7)

My system language is set to English, and the keyboard layout is set to Japanese (the notebook is Japanese).

1. I need to have a Swiss-French keyboard layout (to write in French).
2. I have installed the panel applet keyboard switcher.
3. I looked at this link http://www.xfree86.org/current/XKB-Config2.html, but I don't know exactly how and what to edit. to keep Japanese keyboard layout as default and add Swiss-French layout.

Can you help? Thank you.

Re: Need help setting new keyboard layout Swiss-French

Posted: Sun Nov 07, 2010 4:19 pm
by lyovushka
just execute the command

setxkbmap -layout "jp,ch(fr)" -option "grp:alt_shift_toggle"

In older versions (the one presented in Lubuntu 10.04) this used to crash the keyboard layout indicator applet, so you would need to execute it before starting the applet. In the version presented in Lubuntu 10.10 it is fixed.

If you need this permanently just add it to a file which is being sourced during login (e.g. ~/.profile).

Hope this helps

Re: Need help setting new keyboard layout Swiss-French

Posted: Sat Nov 13, 2010 5:31 am
by nomnex
lyovushka, thank you very much. Fortunately, the command does not crash the panel applet (Fedora 13 LXDE Spin, here). Forgive me for answering late. I haven't been notified by email, or I did not see it (I will check my board settings, anyway).
If you need this permanently just add it to a file which is being sourced during login (e.g. ~/.profile).
I don't have a ~/.profile file in my /home dir. Do I create a text file named ~/.profile and past the single line 'command' you gave me, or do I past it into ~.bash_profile?

Kind regards,
nomnex

Re: Need help setting new keyboard layout Swiss-French

Posted: Sat Nov 13, 2010 1:21 pm
by Marty Jack
If you are on Linux and run bash as your shell, you would normally put initialization in .bashrc and have .bash_profile source .bashrc

"man bash" and read the section INVOCATION for how the profile files work

The easiest way to get something to run once when you log in is to add it to /etc/xdg/lxsession/LXDE/autostart

Re: Need help setting new keyboard layout Swiss-French

Posted: Sun Nov 14, 2010 12:42 am
by nomnex
hi, Marty, I have read the man page and this link http://freeunix.dyndns.org:8088/site2/howto/Bash.shtml

I copied the command in the 'bash_profile' file. I works when I log-in. I use bash as default shell. I am not clear with the definitions 'sub-shell', 'log-in shell', 'non-interactive shell', 'initialization' and 'source'. If you can explain in easy to understand terms, I am all ears.

EDIT: I think I understood, re-reading the article, and your answer (see below).

> If you are on Linux and run bash as your shell, you would normally put initialization in .bashrc and have .bash_profile source .bashrc

initialization = (means) to type my command in the .barshrc file.
.bash_profile source .bashrc = (means) to type '.bashrc' in the '.bash_profile' file.
doing so will run my command, no matter the shell I log-in. Currently my command (in .barsh_profile) will run when I log-in, but not if I enter a sub-shell (TTY 1 to 6 console)

I am I correct?

> The easiest way to get something to run once when you log in is to add it to /etc/xdg/lxsession/LXDE/autostart

This confuses me a bit. Do you explain a different option of running the command (e.g. create a text file 'commands' and copy it in /etc/xdg/lxsession/LXDE/autostart). Or is it about copying my barshrc or/and bashrc_profile to this location?

Re: Need help setting new keyboard layout Swiss-French

Posted: Sun Nov 14, 2010 4:31 am
by Marty Jack
It's a second method. You would append just the extra command lines you want to run to the existing contents. If you aren't completely sure what you are doing with the autostart file, and you have it working, we have a saying in English "leave well enough alone."

Re: Need help setting new keyboard layout Swiss-French

Posted: Sun Nov 14, 2010 5:11 am
by nomnex
Marty Jack wrote:It's a second method. You would append just the extra command lines you want to run to the existing contents.
I am always glad to learn something new :) The autostart entries are preceded by a '@' character. Do I also add a '@' to my command when I past it on the autostart file?

a. setxkbmap -layout "jp,ch(fr)" -option "grp:alt_shift_toggle"
or
b. @setxkbmap -layout "jp,ch(fr)" -option "grp:alt_shift_toggle"

Re: Need help setting new keyboard layout Swiss-French

Posted: Tue Nov 16, 2010 12:17 pm
by Marty Jack
The '@' indicates that lxsession should restart the command if it crashes. In this case you do not need the '@'.

Re: Need help setting new keyboard layout Swiss-French

Posted: Tue Nov 16, 2010 6:09 pm
by lyovushka
Boot sequence is a bit messy in Linux and varies among distributions. If you have find some way of getting commands executed just stick with it :)

Re: Need help setting new keyboard layout Swiss-French

Posted: Sat Jan 15, 2011 3:54 pm
by nomnex
I have a new annoyance with this command:

Code: Select all

setxkbmap -layout "jp,ch(fr)" -option "grp:alt_shift_toggle"
some applications use 'Alt+Shift' as shortcut for some their functions (e.g. gnumeric for a line break, or Anki to change the model template).

how can I modify the alt_shift_toggle part? I have tried ctrl_shift_toggle without success. Thank you.