You are not logged in.

#1 2021-03-06 03:23:13

rodopoulos
Member
Registered: 2018-05-24
Posts: 8

[SOLVED] Dead keys not working in terminal emulators only

Hello all,

I have a Lenovo Thinkpad T480 with US keyboard layout, using i3-wm.

I'm from Brazil and I regularly use accents with dead keys (e.g. ' + e = é). I got this configuration right for GUI apps like Firefox, VSCode and other apps. However, I cannot make it work on terminal emulators. More specifically, I'm using Alacritty, a terminal emulator, and, whenever I type keys that would be dead keys (~, ", '), nothing happens. This issue happens on other terminals, such as xterm.

Here are some outputs:

$ ~ localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: us-acentos
      X11 Layout: us
       X11 Model: pc105
     X11 Variant: intl
     X11 Options: Compose
$ ~ cat /etc/vconsole.conf
KEYMAP=us-acentos

I am really struggling with this. Any help is appreciated.

Thanks in advance.

Last edited by rodopoulos (2021-03-07 14:56:03)

Offline

#2 2021-03-06 08:07:18

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,097

Re: [SOLVED] Dead keys not working in terminal emulators only

vconsole.conf isn't relevant for alacritty or xterm

Afaiu "~" is a dead key for you (to generate "ñ", I assume)?
If so what happens if you enter ~+n in a terminal? Do you get a ñ?
So is the "problem" that you can't write "cd ~" because "~" acts as dead key?

In that case you'll either have to use a multi-layout setup (I assume one could even script i3 to cycle to the proper layout depending on the focused window) or steer away from deadkey accents and enter them w/ a compose key in order to be able to use the dead key by itself. Also pressing space after the dead key produces the dead key by itself (at least in my layout)

For additional information, please post the output of

setxkbmap -print -query

Offline

#3 2021-03-06 14:57:20

rodopoulos
Member
Registered: 2018-05-24
Posts: 8

Re: [SOLVED] Dead keys not working in terminal emulators only

seth wrote:

vconsole.conf isn't relevante for alacritty or xterm

Given they are terminal emulators, I though that they would read keymaps from the vconsole.conf file. But good to know that.

seth wrote:

Afaiu "~" is a dead key for you (to generate "ñ", I assume)?
If so what happens if you enter ~+n in a terminal? Do you get a ñ?
So is the "problem" that you can't write "cd ~" because "~" acts as dead key?

Exactly, I need to generate such latin characters. More important, I need to use quotes at the terminal all the time.

Still, my issue isn't exactly that such keys are acting like dead keys, but that they are producing no characters at all in terminal emulators. Hence, for instance, in Alacritty I press the ~ key and nothing happens. I type it a second time and nothing happens, again. Yet, I can produce such characters using AltGr composition (AltGr + e = é). This issue doesn't happen in GUI apps, where dead keys normally works (" + space = " or ' + a = á).

I like the approach of cycling through layout setups, but I'm curious why this is issue is happening. Here are the asked information:

➜  ~ setxkbmap -print -query
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us(intl)+inet(evdev)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
rules:      evdev
model:      pc105
layout:     us
variant:    intl
options:    Compose

Thanks for the help.

Last edited by rodopoulos (2021-03-06 14:57:45)

Offline

#4 2021-03-06 15:16:52

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,097

Re: [SOLVED] Dead keys not working in terminal emulators only

Not reproducible w/ that config.
Is it maybe rather the shell than the terminal?
=> Does it happen w/ "xterm -e vim" (which will run vim as terminal command instead of bash/zsh/etc)?

Offline

#5 2021-03-06 15:43:45

rodopoulos
Member
Registered: 2018-05-24
Posts: 8

Re: [SOLVED] Dead keys not working in terminal emulators only

I don't believe it's a shell issue. This happens both with bash and fish shell.

Confirming that it happens with "xterm -e vim".

Offline

#6 2021-03-06 16:19:36

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,097

Re: [SOLVED] Dead keys not working in terminal emulators only

Meh.
Can you try openbox to see whether i3 already tries to be extra-smart and manipulates the keymap when a terminal is focused?

Offline

#7 2021-03-06 17:37:59

rodopoulos
Member
Registered: 2018-05-24
Posts: 8

Re: [SOLVED] Dead keys not working in terminal emulators only

Installed openbox and tried to type stuff in xterm and still no luck sad

I'm trying to guess if anything shady is out of order. For instance, this is the file generated by systemd on my X11 conf.d dir. Don't know if it will help:

➜  ~ cat /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"
        Option "XkbModel" "pc105"
        Option "XkbVariant" "intl"
        Option "XkbOptions" "Compose"
EndSection

Offline

#8 2021-03-06 20:47:09

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,097

Re: [SOLVED] Dead keys not working in terminal emulators only

The config is ok (and things also work as expected on other windows)
But this is weird, yes.
grummelbrummelgrummelbrummelgrummelbrummelgrummelbrummelgrummelbrummel…

Do you use an extended input method like fcitx, scim etcetc.?
https://wiki.archlinux.org/index.php/Fcitx

Please open a terminal window where stuff fails, run "xwininfo -int" and click the terminal window. Look for the Window id (on the top, idk. whether it's localized)
Then run "xev -event keyboard -id <window id here>" in that terminal and try to enter a deadkey sequence like '+a for á.
Finish w/ ctrl+c and post the output.

Offline

#9 2021-03-06 21:40:57

rodopoulos
Member
Registered: 2018-05-24
Posts: 8

Re: [SOLVED] Dead keys not working in terminal emulators only

No, I don't use any extended input method at all. I looked for something in that sense, but there was none.

First:

➜  ~ xwininfo -int

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 56623106 "xwininfo /home/rodopoulos"

  Absolute upper-left X:  961
  Absolute upper-left Y:  36
  Relative upper-left X:  1
  Relative upper-left Y:  1
  Width: 958
  Height: 1043
  Depth: 32
  Visual: 0x8f
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x3600001 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +961+36  -1+36  -1-1  +961-1
  -geometry 958x1043-0-0

Finally, the xev output. I pressed, in that order: Enter, ', a and Ctrl+C

~ xev -event keyboard -id 56623106

KeyRelease event, serial 18, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1481048, (337,925), root:(1298,961),
    state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
"   XLookupString gives 1 bytes: (0d) "
    XFilterEvent returns: False

KeyRelease event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1483789, (337,925), root:(1298,961),
    state 0x0, keycode 48 (keysym 0xfe51, dead_acute), same_screen YES,
    XLookupString gives 2 bytes: (c2 b4) "´"
    XFilterEvent returns: False

KeyPress event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1483789, (337,925), root:(1298,961),
    state 0x0, keycode 48 (keysym 0xfe51, dead_acute), same_screen YES,
    XLookupString gives 2 bytes: (c2 b4) "´"
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: True

KeyRelease event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1483859, (337,925), root:(1298,961),
    state 0x0, keycode 48 (keysym 0xfe51, dead_acute), same_screen YES,
    XLookupString gives 2 bytes: (c2 b4) "´"
    XFilterEvent returns: False

KeyRelease event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1484945, (337,925), root:(1298,961),
    state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False

KeyPress event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1484945, (337,925), root:(1298,961),
    state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XmbLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: True

KeyRelease event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1485039, (337,925), root:(1298,961),
    state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False

KeyRelease event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1488692, (337,925), root:(1298,961),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1488692, (337,925), root:(1298,961),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 21, synthetic NO, window 0x3600002,
    root 0x1a2, subw 0x0, time 1488764, (337,925), root:(1298,961),
    state 0x4, keycode 54 (keysym 0x63, c), same_screen YES,
^C⏎

Last edited by rodopoulos (2021-03-06 21:42:27)

Offline

#10 2021-03-06 22:02:01

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,097

Re: [SOLVED] Dead keys not working in terminal emulators only

So the events show up, they're just handled weirdly (resp. not at all)

strace xterm 2>&1 | grep -i compose

Edit, also

pacman -Qikk libx11

Last edited by seth (2021-03-06 22:03:06)

Offline

#11 2021-03-07 00:28:46

rodopoulos
Member
Registered: 2018-05-24
Posts: 8

Re: [SOLVED] Dead keys not working in terminal emulators only

Whoa, that's some nice debug. So let's go:

➜  ~ strace xterm 2>&1 | grep -i compose
openat(AT_FDCWD, "/home/rodopoulos/.XCompose", O_RDONLY) = 5
stat("/home/rodopoulos/.XCompose", {st_mode=S_IFREG|0644, st_size=140, ...}) = 0
stat("/var/cache/libx11/compose/", 0x7ffce728a320) = -1 ENOENT (No such file or directory)
stat("/home/rodopoulos/.XCompose", {st_mode=S_IFREG|0644, st_size=140, ...}) = 0
stat("/home/rodopoulos/.compose-cache/", 0x7ffce728a320) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/rodopoulos/.XCompose", O_RDONLY) = 5

My .Xcompose file contents is pretty simple:

➜  ~ cat .XCompose
<dead_acute> <C> : "Ç" Ccedilla # LATIN CAPITAL LETTER C WITH CEDILLA
<dead_acute> <c> : "ç" ccedilla # LATIN SMALL LETTER C WITH CEDILL

And finally, pacman output:

➜  ~ pacman -Qikk libx11
Name            : libx11
Version         : 1.7.0-3
Description     : X11 client-side library
Architecture    : x86_64
URL             : https://xorg.freedesktop.org/
Licenses        : custom
Groups          : None
Provides        : None
Depends On      : libxcb  xorgproto
Optional Deps   : None
Required By     : aalib  albert-minimal  at-spi2-atk  cairo  dmenu  ffmpeg
                  gst-plugins-bad-libs  libva  libwmf  libxext  libxfixes  libxkbfile
                  libxrender  libxt  lightdm  maim  sdl2  slop  startup-notification
                  webkit2gtk  xorg-xev  xorg-xinit  xorg-xinput  xorg-xmodmap  xorg-xprop
                  xorg-xrandr  xorg-xrdb  zoom  zvbi
Optional For    : hwloc
Conflicts With  : None
Replaces        : None
Installed Size  : 10.15 MiB
Packager        : Andreas Radke <andyrtr@archlinux.org>
Build Date      : Sat 09 Jan 2021 09:06:48 AM -03
Install Date    : Mon 08 Feb 2021 10:57:18 PM -03
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

libx11: 1264 total files, 0 altered files

Offline

#12 2021-03-07 07:28:49

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,097

Re: [SOLVED] Dead keys not working in terminal emulators only

"Tada"…

My .Xcompose file contents is pretty simple:

Prepend a line that says

include "/usr/share/X11/locale/en_US.UTF-8/Compose"

Offline

#13 2021-03-07 14:45:18

rodopoulos
Member
Registered: 2018-05-24
Posts: 8

Re: [SOLVED] Dead keys not working in terminal emulators only

Aha! It worked! So there was this missing piece in the XCompose file. Marking the thread as solved.

Thanks a lot, seth!

Offline

Board footer

Powered by FluxBB