Setxkbmap not working - changing kb layout

Hey I’m new here and also quite new to Manjaro. Hope I can get some help here :slight_smile:

Just yesterday I switch to an American keyboard layout on my tower and I’m quite happy. Today I wanted to do the same on my notebook bit it didn’t work (both are running Manjaro i3 (Release 20.2.1/ Kernel 5.9.16-1).

EDIT: removed posting this question twice :smiley:

The problem is, that setxkbmap seems to have absolutely no effect on my system. I tried:

  • adding exec --no-startup-id "setxkbmap -layout us,en -option grp:alt_shift_toggle" to my i3 config,
  • simply entering setxkbmap -layout us,en -option grp:alt_shift_toggle in the terminal,
  • just entering setxkbmap us in my terminal,
  • changing via locatectl: localectl --no-convert set-x11-keymap de,us pc104 grp:alt_shift_toggle
  • manually editing /etc/X11/xorg.conf.d/00-keyboard.conf (I know one should not do that :smiley: But I found someone suggesting that on reddit :D)
  • using the third party tool “xkb-switch” (https://github.com/grwlf/xkb-switch)

And nothing happens, no matter what, the keyboard-layout stays German. The Manjaro-Settings-Manager shows US Keyboard layout btw :smiley:

The “/etc/X11/xorg.conf.d/00-keyboard.conf” is getting updated as should be btw. Also xkb-switch -l (which should show all layouts) reflects exactly the layout set up by setxkbmap.

So I guess it might have something to do with setxkbmap itself? Hope I can get some help here, I’m starting to turn really frustrated :smiley:

Kernel: 5.9.16-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0
Desktop: i3 4.19 info: i3bar dm: LightDM 1.30.0 Distro: Manjaro Linux
Machine: Type: Laptop System: LENOVO product: 20KS0039GE v: ThinkPad E580

Update:
I now also tried: exec --no-startup-id "setxkbmap -layout us,de -option 'grp:lalt_lshift_toggle'" as suggested in the reply down below, but still I can’t switch layouts.

And just to be clear, it is not about the switching. I think setxkbmap might just not have an effect at all. F.e.

~ >>> setxkbmap us                                                                                     
~ >>> setxkbmap -query                                                                                 
rules:      evdev
layout:     us
options:    grp:lalt_lshift_toggle

looks great right? But still my keyboard remains german :frowning:

1 Like

Hello,

Try this:
exec --no-startup-id "setxkbmap -layout us,de -option 'grp:lalt_lshift_toggle'"

also make sure you do not have duplicate entries … it seems you pasted the same information here twice too :slight_smile:

Hey, thanks for the kind reply, and sorry, for the double-posting :smiley:

The problem still remains. Now setxkbmap -query prints

rules: evdev
layout:     us,de
options:    grp:lalt_lshift_toggle"

but still no effect.

As even setxkbmap us doesn’t change anything, I’m assuming the problem lies somewhere else.

So, one step to the solution was presented to be on reddit. The trick was, to connect an external keyboard to my notebook, which allowed me to change from German to US layout. And even after disconnecting the external keyboard, I was able to switch back and forth. After rebooting however, the problem was back. Reconnecting the external help, but that is no long term solution. Maybe someone out there has some ideas. These are the shell commands, I entered before and after I connected the keyboard, and I think this might help finding the actual problem:

# [notebook keyboard]
> setxkbmap us
> setxkbmap -query
rules: evdev
layout: us
# [but acctually: nope, still german]
# [connecting external keyboad]
> setxkbmap -query
rules: evdev
model: pc105 # [so this is new]
layout: de # [this automatically changed to german, as if there was some settings suddenly restored or something]
> setkbmap us
rules: evdev
model: pc105 
layout: us
# [and voila, suddenly it's not just _saying_ that the layout is us, but it actually is :D]

Again: after disconnecting the external keyboard, switching back and forth was possible, until reboot.

The problem is the missing -model options.

This is mine, which is working for me:

exec_always --no-startup-id setxkbmap us,us ,swerty grp:shifts_toggle -model pc105
2 Likes