I’ve added setxkbmap us -variant intl
to ~/.profile
and ~/.bash_profile
, but each time I suspend the session, I need to reset manually. What should I do?
Please have a look at:
https://wiki.archlinux.org/title/Setxkbmap#Setting_keyboard_layout
and see if it could solve the issue you’re having.
While the immediately above is good information (specifically the xorg.conf.d route): if you are using a desktop environment such as Xfce, KDE, GNOME, …, then you’d normally just set things through its keyboard configuration. I.e., only do this “manually” if you are not…
@rene is absolutely right. You can set this with the GUI of your desktop environment.
However, assuming that the GUI doesn’t work for some reason, here is a way to execute a script before/after waking up from sleep: by adding a systemd
pre/post-sleep hook.
This article has more information on how to do this: https://wiki.archlinux.org/title/Power_management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep
Edit: If you are too lazy to read the article, here is basically how you do it.
- First,
cd
into/usr/lib/systemd/system-sleep/
, which is the directory to place your script file so thatsystemd
can find and execute them. - Create a script inside the directory
sudo touch setkeyboardmap
- Copy and paste this code into the
/usr/lib/systemd/system-sleep/setkeyboardmap
file you just created.
#!/bin/sh
case $1/$2 in
pre/*)
echo "Going to $2..."
#do nothing before going to sleep
exit 0
;;
post/*)
echo "Waking up from $2..."
# Run setkbxmap command after waking from sleep.
setxkbmap us -variant intl
;;
esac
- Make the script executable with
chmod
" just set things through its keyboard configuration. " What file for XFCE?
Not a “file” as such but simply <menu> → Keyboard | Layouts:
IIRC you have to on XFCE in fact log out and back in after changing things…
The highlighted one is the intl
variant which you are setting. You supposedly may want exactly that for symmetry with Windows but if you, as I, do not in fact want dead keys I highly suggest using altgr-intl
instead, i.e., the one listed second in my screenshot. That has only e.g. AltGr+‘ be a dead key rather than ’ itself (if your board hasn’t a key physically labelled AltGr it’s just the right Alt key).
I’ve been plugging altgr-intl
as the best software-layout for anyone using a physical US-English layout keyboard for years. It’s a superset of plain US English which is to say nothing stops working, and it provides access also to many common accents and symbols such as é
directly from AltGr+e as well as through composing it with use of the dead key.
A picture of the layout is provided directly by e.g. the GNOME, MATE, Cinnamon and probably KDE GUI keyboard settings but XFCE unhelpfully doesn’t: please see below. The right-hand side symbols are the AltGr and AltGr+Shift symbols respectively.