You are not logged in.

#1 2014-11-20 12:08:23

AlexanderHolmgaard
Member
Registered: 2014-11-18
Posts: 57

[SOLVED] Cannot change keymap

Hello,

I cannot seem to change my keymap. I have tried adding:

setxkbmap -layout dk

to

/etc/skel/.xinitrc , so it looks like this:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

setxkbmap -layout dk,us -option grp:alt_shift_toggle

# exec gnome-session
# exec startkde
 exec startxfce4
# ...or the Window Manager of your choice

but it doesn't change anything. Both languages are uncommented in

/etc/locale.gen.

Is there anything that I am missing here? Please help! smile

Last edited by AlexanderHolmgaard (2014-11-20 17:01:06)

Offline

#2 2014-11-20 12:27:36

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: [SOLVED] Cannot change keymap

What happens when you run the setxkbmap command in a terminal?

Also, is there a reason why you don't want to set the keyboard layout via the X config files (and localectl)?

Offline

#3 2014-11-20 12:30:50

AlexanderHolmgaard
Member
Registered: 2014-11-18
Posts: 57

Re: [SOLVED] Cannot change keymap

Tried running the setxkbmap -layout dk,us -option grp:alt_shift_toggle command in a terminal now. It worked, perfect. Thanks a lot!

Offline

#4 2014-11-20 12:35:11

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: [SOLVED] Cannot change keymap

So, does this mean that you are going to change the keymap every time you log in?

As for changing the layout on login, which display manager or desktop enviornment do you use?

Last edited by runical (2014-11-20 12:36:39)

Offline

#5 2014-11-20 12:41:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Cannot change keymap

Read the wiki. Don't edit /etc/skel/.xinitrc, copy it to ~/.xinitrc and edit it there.


When posting configs, code or command output, please use [ code ] tags https://bbs.archlinux.org/help.php#bbcode

like this

It makes the code more readable and - in case of longer listings - more convenient to scroll through.

Offline

#6 2014-11-20 14:48:17

AlexanderHolmgaard
Member
Registered: 2014-11-18
Posts: 57

Re: [SOLVED] Cannot change keymap

Tried copying the /etc/skel/.xinitrc to the home directory and editing it there, adding the command I mentioned above. Still doesn't work. When I run the command in a terminal it works, but then after reboot its gone.
I use XFCE and LightDM.
And Karol, yes, I shall do that from now on, my apologies smile
Any thoughts on what I can do from here? Thanks for helping me out, guys!

Offline

#7 2014-11-20 15:39:41

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: [SOLVED] Cannot change keymap

LightDM does not source xinitrc if I am not mistaken, so it is not really a surprise. There are 2 things you can do:

1. Change your keymap via X config files (as mentioned in the wiki for keyboard layout in X)
2. Add the setxkbmap command to the startup commands for XFCE

Personally, I'd go for solution 1 as it will give you a consistent keymap across all users and DE/WM. Solution 2 is quick and easy, but it will only work in XFCE and require setting up in every DE/WM you want to use.

P.S. This is all info you can find in the wiki, please do your research.

Last edited by runical (2014-11-20 15:41:27)

Offline

#8 2014-11-20 17:00:42

AlexanderHolmgaard
Member
Registered: 2014-11-18
Posts: 57

Re: [SOLVED] Cannot change keymap

Okay. First I tried changing it via the X config files. That didn't work, I have no idea as to why... So now I added it as one of the startup commands and it is working now. Thanks a lot!

Offline

#9 2014-11-20 19:33:49

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: [SOLVED] Cannot change keymap

Strange. Did you try using localectl? The point with localectl is that you need to provide all of the optional arguments, even if you just want to use one (found that out the hard way as well).

Offline

#10 2014-11-20 21:04:59

AlexanderHolmgaard
Member
Registered: 2014-11-18
Posts: 57

Re: [SOLVED] Cannot change keymap

Yes. I ran this command:

localectl set-x11-keymap dk,us pc104 ,qwerty grp:alt_shift_toggle

But still nothing. Checked in the /etc/X11/xorg.conf.d/10-keyboard.conf, and the changes are actually there, but it seemed it still wasn't enabled.. Don't remember if I ran the command as root though, if that makes any difference in this case.

Offline

#11 2014-11-20 21:58:58

cedeel
Member
From: ~
Registered: 2009-08-25
Posts: 176
Website

Re: [SOLVED] Cannot change keymap

There's also the Xfce configuration utilities. One of them can manage keyboard layouts.
I haven't used it myself since I'm used to configuring my keyboard layout with X configs.

Offline

#12 2014-11-20 22:03:36

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: [SOLVED] Cannot change keymap

AlexanderHolmgaard wrote:

Yes. I ran this command:

localectl set-x11-keymap dk,us pc104 ,qwerty grp:alt_shift_toggle

But still nothing. Checked in the /etc/X11/xorg.conf.d/10-keyboard.conf, and the changes are actually there, but it seemed it still wasn't enabled.. Don't remember if I ran the command as root though, if that makes any difference in this case.

Yeah, you should run the command as root. Also, after changing the layout this way, you have to restart your X server (X configs are read on X start).

Offline

Board footer

Powered by FluxBB