Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Keyboard layout: persistent setxkbmap?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Wantoast
n00b
n00b


Joined: 14 Aug 2013
Posts: 16

PostPosted: Sat Aug 24, 2013 11:57 am    Post subject: [Solved] Keyboard layout: persistent setxkbmap? Reply with quote

Hi, I need to change my keyboard layout (the Xorg one), but solutions found on the internet didn't work:

I read that I should put a conf file like "10-keyboard.conf" in the "xorg.conf.d" directory. The problem is that there wasn't such a directory, so I decided to create it manually, I put in it the .conf file but it didn't work.
Anyway that's what I wrote in it (according to Xorg config's Gentoo page):

Code:

Section "InputClass"
   Identifier "keyboard-all"
   Driver "evdev"
   Option "XkbLayout" "us,it"
   Option "XkbModel" "logitech_g15"   <---- I don't think this is my keyboard. Is this relevant?
   Option "XkbRules" "xorg"
   Option "XkbOptions" "grp:alt_shift_toggle,grp:switch,grp_led:scroll,compose:rwin,terminate:ctrl_alt_bksp"
   Option "XkbVariant" ",qwerty"
   MatchIsKeyboard "on"
 EndSection


Then: I found a partial solution:

Code:
 setxkbmap layout ("it" in this case)


But with that command I've to change the layout every time I start X, so my question is:
Is it possible to automatically load setxkbmap at X boot (I've already tried to add the command in the .xinitrc file but it didn't work neither)?
If not, is there something that I can to to solve my problem (or did I made any mistake with that .conf file?)?
Thanks in advance!


Last edited by Wantoast on Sun Aug 25, 2013 11:42 am; edited 1 time in total
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Sat Aug 24, 2013 1:06 pm    Post subject: Reply with quote

Hi,
by experience, the best thing you can do is to set the keyboard layout as late as possible in the X boot process. I do not set it in /etc/X11/xorg.conf or in a file in the directory etc/X11/xorg.conf.d/. I set it with setxkbmap in my ~/.xinitrc, but it will stay untouched only if the X client do not set the keyboard layout itself.

Gnome, Kde, Xfce and other desktop environnements have the possibility to set the keyboard layout and they do unless you tell them explicitly to not touch it. It do not always work. So I use the utility of the desktop environnement to set the keyboard layout and keep the keyboard layout with setxkbmap in .xinitrc that load the .Xmodmap file too with xmodmap to modify the layout. Some desktop environnements can do that themselves.

An other possibility is to tell your desktop environnement to execute setxkbmap and xmodmap via a script. The problem can be that it will be execute before the desktop keyboard layout utility. The sames problems can appear for the mouse setup and other things.

If you use a display manager, you can use the file ~/.xsessionrc to configure things like you do in .xinitrc when you start X with the startx command, with the same overwrite possible problem.
_________________
Paul


Last edited by Logicien on Sat Aug 24, 2013 1:10 pm; edited 3 times in total
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Sat Aug 24, 2013 1:07 pm    Post subject: Reply with quote

setxkbmap usually isn't a solution, just a proof you're doing something wrong.

For evdev driver, XkbRules are meaningless and XkbModel shouldn't matter, but you need to filter paths.
As for the initial value, just swap the order in both Layout and Variant.

But do you really need two layouts or are you just copy/pasting results of your googling ?

As for where where the conf snippet should go, :roll: 'man xorg.conf'.
Back to top
View user's profile Send private message
Wantoast
n00b
n00b


Joined: 14 Aug 2013
Posts: 16

PostPosted: Sat Aug 24, 2013 2:10 pm    Post subject: Reply with quote

Logicien wrote:
Hi,
by experience, the best thing you can do is to set the keyboard layout as late as possible in the X boot process. I do not set it in /etc/X11/xorg.conf or in a file in the directory etc/X11/xorg.conf.d/. I set it with setxkbmap in my ~/.xinitrc, but it will stay untouched only if the X client do not set the keyboard layout itself.

Gnome, Kde, Xfce and other desktop environnements have the possibility to set the keyboard layout and they do unless you tell them explicitly to not touch it. It do not always work. So I use the utility of the desktop environnement to set the keyboard layout and keep the keyboard layout with setxkbmap in .xinitrc that load the .Xmodmap file too with xmodmap to modify the layout. Some desktop environnements can do that themselves.

An other possibility is to tell your desktop environnement to execute setxkbmap and xmodmap via a script. The problem can be that it will be execute before the desktop keyboard layout utility. The sames problems can appear for the mouse setup and other things.

If you use a display manager, you can use the file ~/.xsessionrc to configure things like you do in .xinitrc when you start X with the startx command, with the same overwrite possible problem.


Well, I don't use a desktop environment, but a windows manager: awesome. And I don't think it has options for the keyboard layout.

VoidMage wrote:
setxkbmap usually isn't a solution, just a proof you're doing something wrong.

For evdev driver, XkbRules are meaningless and XkbModel shouldn't matter, but you need to filter paths.
As for the initial value, just swap the order in both Layout and Variant.

But do you really need two layouts or are you just copy/pasting results of your googling ?

As for where where the conf snippet should go, :roll: 'man xorg.conf'.


I'm just copy/pasting results of my googling. :D
So: /usr/share/X11/xkb?
I edited the .conf file as you said and put it there, but layout isn't changed.

Anyway: so the italian version of "Gentoo desktop documentation" contains deprecated info, just to report (although I don't know who should know this) <--- EDIT: It doesn't


Last edited by Wantoast on Sun Aug 25, 2013 11:45 am; edited 1 time in total
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Sat Aug 24, 2013 4:38 pm    Post subject: Reply with quote

Just in case you didn't get what I mean by "filter paths", see /usr/share/X11/xorg.conf.d/10-evdev.conf.
Put your snippet in /etc/X11/xorg.conf.d/.

You probably need just a single layout, so the value should just be "it" and (most likely) you don't need any variant value.
Back to top
View user's profile Send private message
Wantoast
n00b
n00b


Joined: 14 Aug 2013
Posts: 16

PostPosted: Sat Aug 24, 2013 8:34 pm    Post subject: Reply with quote

VoidMage wrote:
Just in case you didn't get what I mean by "filter paths", see /usr/share/X11/xorg.conf.d/10-evdev.conf.
Put your snippet in /etc/X11/xorg.conf.d/.

You probably need just a single layout, so the value should just be "it" and (most likely) you don't need any variant value.


Exactly what I didn't understand. I added "Options" "it" to evdev.conf and it worked. Thanks!
Just one other thing:

With my layout the "Alt Gr" key (or "Alt_R") should be used in order to type, for example, square bracket.
But now it doesn't work, if I press in doesn't be recognized.

Infact, using Xev:

Code:

KeyPress event, serial 33, synthetic NO, window 0x1200001,
    root 0x92, subw 0x0, time 8277374, (-358,80), root:(301,100),
    state 0x0, keycode 108 (keysym 0xff7e, Mode_switch), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x1200001,
    root 0x92, subw 0x0, time 8277446, (-358,80), root:(301,100),
    state 0x0, keycode 108 (keysym 0xff7e, Mode_switch), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False


It becomes "Mode_switch", which I don't think is its exact name.
Is this because of that keyboard.conf file?


Last edited by Wantoast on Sun Aug 25, 2013 9:58 am; edited 1 time in total
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Sun Aug 25, 2013 4:06 am    Post subject: Reply with quote

I'm almost scared to ask: what exactly did you change and where ?

Anyway, you might need 'nodeadkeys' variant after all. See /usr/share/X11/xkb/rules/evdev.lst.
Back to top
View user's profile Send private message
Wantoast
n00b
n00b


Joined: 14 Aug 2013
Posts: 16

PostPosted: Sun Aug 25, 2013 11:36 am    Post subject: Reply with quote

VoidMage wrote:
I'm almost scared to ask: what exactly did you change and where ?

Anyway, you might need 'nodeadkeys' variant after all. See /usr/share/X11/xkb/rules/evdev.lst.


Ok, I did a lot of things that I didn't have to do (e.g. editing that evdev.conf file or copying the keyboard layout wherever I could, haha).
Anyway, I realized that the unique file I've to edit is 10-keyboard.conf, so I removed all those copies I've created.

Then, this is my actual 10-keyboard.conf file:
Code:

 Section "InputClass"
   Identifier "keyboard-all"
   Driver "evdev"
   Option "XkbLayout" "it"
   Option "XkbVariant" "nodeadkeys"
   MatchIsKeyboard "on"
 EndSection


It works. Layout loads correctly and Alt Gr is recognized. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum