You are not logged in.

#1 2017-11-29 11:58:29

adammartincote
Member
Registered: 2017-11-29
Posts: 8

Unable to remap control key and have multiple layout at the same time

I am on a new Arch Linux installation on my Asus k501ux using xfce4 and I want to achieve 2 simple things: 

  1. remap the caps lock key to control (left control is still control so someone else can use the keyboard too)
  2. be able to switch between 2 keyboard layout (us and Canadian french)

I have tried different methods:

method 1:

setxkbmap -layout us,ca -variant altgr-intl, -option grp:alt_shift_toggle,caps:escape

Sets the 2 layouts properly but the control key has a weird behavior: caps_lock+c does not produce ctrl+c as expected but doesn't toggle cap locks either

method 2:

localectl --no-convert set-x11-keymap us,fr pc104 grp:alt_shift_toggle,caps:escape

the control is properly remapped but the layouts are not available, they are visible in the GUI toolbar but toggling, either with the toolbar or with alt_shift has no effect (always us keyboard)

content of /etc/X11/xorg.conf.d/00-keyboard.conf:

# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,ca"
        Option "XkbModel" "pc104"
        Option "XkbVariant" "altgr-intl,"
        Option "XkbOptions" "grp:alt_shift_toggle,caps:escape"
EndSection

I could also remap the control key with xmodmap but I reverted this change to the default to avoid conflicts

Offline

#2 2017-11-29 14:34:10

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to remap control key and have multiple layout at the same time

"caps:escape"??
=> "caps:ctrl_modifier" or do you other mapping?

Also lmg: emacs? ;-)

Offline

#3 2017-11-29 15:54:27

adammartincote
Member
Registered: 2017-11-29
Posts: 8

Re: Unable to remap control key and have multiple layout at the same time

My bad, I tried different things and posted the wrong version.

Here's an update:

sudo setxkbmap -layout us,ca -variant altgr-intl,multi -option grp:alt_shift_toggle,caps:ctrl_modifier

produce the result I want but the change is lost at reboot

I tried:

sudo localectl set-x11-keymap us,ca pc104 altgr-intl,multi grp:alt_shift_toggle,caps:ctrl_modifier

correctly update /etc/X11/xorg.conf.d/00-keyboard.conf but after reboot:
  * control is still correctly mapped
  * only Us keyboard is available (both show up in the status bar but switching has no effect)

Is there a clean way of making the config stick around?

Vim uses a lot of Ctrl keys too wink

Thanks!

Offline

#4 2017-11-29 16:11:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to remap control key and have multiple layout at the same time

You desktop session (which?) likely nukes the settings on login.

Edit: "setxkbmap -print -query" to check the currently used config.

Last edited by seth (2017-11-29 16:12:15)

Offline

#5 2017-11-29 17:16:41

adammartincote
Member
Registered: 2017-11-29
Posts: 8

Re: Unable to remap control key and have multiple layout at the same time

output of setxkbmap -print -query (after localect command from last post + reboot):

xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us(altgr-intl)+ca(multi):2+inet(evdev)+group(alt_shift_toggle)+capslock(ctrl_modifier)"	};
	xkb_geometry  { include "pc(pc104)"	};
};
rules:      evdev
model:      pc104
layout:     us,ca
variant:    altgr-intl,multi
options:    grp:alt_shift_toggle,caps:ctrl_modifier

I made sure xfce settings are set to "use system default"

the multiple keyboard layout are still not conserved

Thanks for your help

Offline

#6 2017-12-05 15:39:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to remap control key and have multiple layout at the same time

Sorry for the delay, but this somehow makes no sense.
What's the resp. output after getting the desired result with setxkbmap?

Also, why are you running setxkbmap as root (and why does that impact your current user instead of yelling an authority error?)

Offline

#7 2017-12-05 17:25:56

adammartincote
Member
Registered: 2017-11-29
Posts: 8

Re: Unable to remap control key and have multiple layout at the same time

Sorry but I'm not sure what you mean by "resp. output", but here some more infos:

*reboot*

{12:07}~ ➭ localectl status
   System Locale: LANG=en_CA.UTF-8
       VC Keymap: us
      X11 Layout: us,ca
     X11 Variant: altgr-intl,multi
     X11 Options: grp:win_space_toggle,caps:ctrl_modifier

toggling with win+space has no effect, in spite of the above output (same if susbtituted for alt_shift), however, caps_lock is properly remapped

{12:07}~ ➭ setxkbmap -layout us,ca -variant altgr-intl,multi -option grp:win_space_toggle,caps:ctrl_modifier
{12:10}~ ➭ éééééèâèà  

This command works has expected (with or without sudo)
I tried adding it to "~/.xprofile", "~/.xsession" and "~/.profile" but it has no effect either, so I have to type it manually at each reboot
(still using xfce)

It does not make much sense indeed,

Thanks again

Offline

#8 2017-12-05 21:47:04

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to remap control key and have multiple layout at the same time

"respecitve output of setxkbmap -print -query" - the initial one should reflect a working setup, so I wonder what difference the additional setxkbmap call causes.

with or without sudo

Do you by any chance login as root?

xfce autostart: https://wiki.archlinux.org/index.php/Xf … plications

Offline

#9 2017-12-05 22:16:07

adammartincote
Member
Registered: 2017-11-29
Posts: 8

Re: Unable to remap control key and have multiple layout at the same time

Here's the before and after output:

{17:08}~ ➭ setxkbmap -print -query
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us(altgr-intl)+ca(multi):2+inet(evdev)+group(win_space_toggle)+capslock(ctrl_modifier)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
rules:      evdev
model:      pc105
layout:     us,ca
variant:    altgr-intl,multi
options:    grp:win_space_toggle,caps:ctrl_modifier
{17:09}~ ➭ /////////{}{
zsh: no such file or directory: /////////{}{
{17:10}~ ➭ setxkbmap -layout us,ca -variant altgr-intl,multi -option grp:win_space_toggle,caps:ctrl_modifier

{17:10}~ ➭ /////{}{éééééé¨ÇÇ                                                                                
zsh: no such file or directory: /////{}{éééééé¨ÇÇ
{17:11}~ ➭ setxkbmap -print -query                                                                          
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us(altgr-intl)+ca(multi):2+inet(evdev)+group(win_space_toggle)+capslock(ctrl_modifier)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
rules:      evdev
model:      pc105
layout:     us,ca
variant:    altgr-intl,multi
options:    grp:win_space_toggle,caps:ctrl_modifier,grp:win_space_toggle,caps:ctrl_modifier
{17:11}~ ➭ 

The first options seems to be ignored for some reason

No I am using a normal user which is sudoer
I ran localectl with sudo as it was required

Offline

#10 2017-12-06 08:58:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to remap control key and have multiple layout at the same time

- options:    grp:win_space_toggle,caps:ctrl_modifier
+ options:    grp:win_space_toggle,caps:ctrl_modifier,grp:win_space_toggle,caps:ctrl_modifier

...

Offline

#11 2017-12-14 21:04:54

adammartincote
Member
Registered: 2017-11-29
Posts: 8

Re: Unable to remap control key and have multiple layout at the same time

Yes, it is there twice, and the first grp:win_space has no effect, I'd like to know why

Offline

#12 2017-12-14 21:17:12

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,863

Re: Unable to remap control key and have multiple layout at the same time

I think you need it for both layouts.

Offline

Board footer

Powered by FluxBB