xorgwizard - resets keyboard settings

Please post any bugs you have found
Post Reply
Message
Author
naena
Posts: 48
Joined: Mon 14 Mar 2011, 20:34

xorgwizard - resets keyboard settings

#1 Post by naena »

This is about version 5.6.1 (may be all versions).

When I run xorgwizard, it resets the xorg.conf file destroying my keyboard settings. Perhaps the wizard should offer the user an option to retain keyboard settings?

DETAILS:
I use two keymaps, one for English and one for romanized Singhala. Both use the same familiar US key layout.

In order to switch between the two maps, I set up the combination Ctrl-Shift by using the mouse/keyboard wizard. This matches what Windows XP does by default. Since Puppy does not have a floating keyboard selector to visually indicate which keymap is currently active, I set the scroll-lock lamp to come on when Singhala is on. Beautiful!

There are three things you need to do to add a new keymap:
1. Write the keyboard program -- very simple and straightforward
Add it to your country page here:
/etc/X11/xkb/symbols/pc
2. Register the keymap as a Variant under your country here:
/etc/X11/xkb/rules/base.lst
3. Run mouse/keyboard wizard to setup the way you want to switch
between keymaps. The wizard modifies the
Section "InputDevice" - Identifier "Keyboard0"
in the following page:
/etc/X11/xorg.conf

I wrote an instruction page for other users that like to use simple romanized Singhala as opposed to the 'UNICODE Sinhala' atrocity:
http://ahangama.com/apiapi/singhala/linuxkb-e.php <-- English
http://ahangama.com/apiapi/singhala/linuxkb-s.php <-- Singhala

My clueless friends would be terribly confused if they suddenly lose the Singhala keymap. (I am trying gingerly to bring these people from Windows to Puppy).

This is kind of a semi-bug, I think, don't you?

naena.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hello, naena.

About a keyboard flag, you may want to consult : http://puppylinux.org/wikka/fbxkb
You might have to add/provide a miniature copy of the flag of your country in the proper folder.

As to X.org being fussy about preserving keymap codes at next boot, you may want to
try putting a little script in ~/Startup, such as
/usr/bin/setxkbmap [2 letter code for your country/language]

For ex., in some Puppies, I have to use

Code: Select all

#!/bin/sh
# vieux clavier canadien-français # (Legacy French-Canadian keyboard)
/usr/bin/setxkbmap qc
to make my favorite keyboard "stick" from boot to boot.

I hope this helps.

Best regards.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#3 Post by Karl Godt »

In a way I think so too .

Nevertheless there is the possibility to add a setxkbmap line like

setxkbmap -rules xorg -model pc102 -layout us,de -variant "" -option grp:rwin_toggle,lv3:ralt_switch

into /root/.xinitrc
, which I had done for my preferences .

Easier than to patch several if/grep/grep -v/cp -f/then blocks in xorgwizard for such occurrence .

For a keyboard indicator , you might look/search for fbxkb http://murga-linux.com/puppy/viewtopic.php?t=39298 in the additional software section .

[ Christian was faster this time ]
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Karl Godt wrote:(...)
[ Christian was faster this time ]
:lol: That's really funny!
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

naena
Posts: 48
Joined: Mon 14 Mar 2011, 20:34

Thank you both wizards!

#5 Post by naena »

Thank you guys. You have given enough information to mull over. I think both are equally good alternatives.

musher0, I read the readme.txt inside the /startup folder you suggested. It says this:
''Note, if you want to execute something at bootup and prior to X desktop
loading, edit /etc/rc.d/rc.local."

Don't I have to set the keymap before X desktop loads? (I am a Linux newbie and cannot be trusted for my judgments).

Your script seems to set the default keymap to the French Canadian one. In my case, I want to keep US English as the default and let the user use the hot key Ctrl-Shift to switch from it to the romanized Singhala one and back.

Karl's mention of /root/.xinitrc is a lucky discovery for me because I was wondering how to choose a background image depending on the screen resolutions 8x6 and 16x9.

The setting Karl writes in that file is similar to what I have in the xorg.conf file:

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc102"
Option "XkbLayout" "us,lk" #xkeymap0
Option "XkbVariant" "la,si"
Option "XkbOptions" "grp:ctrl_shift_toggle,grp_led:scroll"
EndSection

Karl's script says:
setxkbmap -rules xorg -model pc102 -layout us,de -variant "" -option grp:rwin_toggle,lv3:ralt_switch

I need to experiment with this.

Thanks immensely to both of you.

naena

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Re: Thank you both wizards!

#6 Post by musher0 »

naena wrote:Thank you guys. You have given enough information to mull over. I think both are equally good alternatives.

musher0, I read the readme.txt inside the /startup folder you suggested. It says this:
''Note, if you want to execute something at bootup and prior to X desktop
loading, edit /etc/rc.d/rc.local."

Don't I have to set the keymap before X desktop loads? (I am a Linux newbie and cannot be trusted for my judgments).

Your script seems to set the default keymap to the French Canadian one. In my case, I want to keep US English as the default and let the user use the hot key Ctrl-Shift to switch from it to the romanized Singhala one and back.
(...)

Thanks immensely to both of you.

naena
Hi, naena.

Thanks for the thanks! :)

I do not know your language, so I could not be more precise. My post was intended more to point you in a direction than to provide a definitive solution.

As to putting the script in ~/Startup, it is common practice for us Francophones not using fr_FR ("French-from-France" azerty keyboard). It does change the keyboard "on the fly", so to speak. I know it works, but I cannot explain the "mechanics" of it.

I must add that I also have the parameter " pkeys=cf " in the initial start line for the Puppy. pkeys installs the " cf " variant of my keyboard for me to use in the initial console, and the " setxkbmap qc " script takes over once I get to X.org.

You could probably develop this little script into a switch based on a "signal" file in /tmp. For example...

Supposing you start with "en", and then want to change to romanized Singhala (this is just a very rough draft):

Code: Select all

#!/bin/sh
# ~/Startup/lang-switch.sh
# Purpose: two-languages switch
####
# When you start you have no "signal" file, so...
if [ ! -f /tmp/lang-signal ];then
echo en > /tmp/lang-signal
setxkbmap en &
# supposing you always start with English; 
# you could start with your language as well
fi

####
# Some code needed here for whenever you re-start with xwin 
####

# To change keyboards:
if [ "`grep en /tmp/lang-signal`" ];then
setxkbmap [language code for romanized Singhala] &
echo [language code for romanized Singhala] > /tmp/lang-signal
else
setxkbmap en &
echo en > /tmp/lang-signal
fi
You would access this script through an icon you have put on the desktop.
You click on the icon when you want to change languages. Also, you could have a hot key (perhaps Ctrl-Shift+another character) linked to that icon.

How it works:
grep reads the signal file. If it reads "English" (en), it loads the other language. And vice-versa.

This is a suggestion only, written from imagination! It has NOT been TESTED in the real world and probably contains errors! But I hope it brings a little progress! :)

Best regards.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply