# Unable to permanently set \`setxkbmap\`

**URL:** <https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612>\
**Category:** Kernel, boot, graphics & hardware\
**Created:** [December 7, 2022, 5:02am UTC](https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612 "2022-12-07T05:02:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![erw1](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/e/97f17d/32.png) [@erw1](https://forum.endeavouros.com/u/erw1)\
**Post date:** [December 7, 2022, 5:02am UTC](https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612/1 "2022-12-07T05:02:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pebcak](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/pebcak/32/100472_2.png) [@pebcak](https://forum.endeavouros.com/u/pebcak)\
**Post date:** [December 7, 2022, 5:17am UTC](https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612/2 "2022-12-07T05:17:03Z")

</div>

Please have a look at:

[https://wiki.archlinux.org/title/Setxkbmap#Setting\_keyboard\_layout](https://wiki.archlinux.org/title/Setxkbmap#Setting_keyboard_layout)

and see if it could solve the issue you’re having.

---

<div class="post-metadata">

**Author:** ![rene](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/rene/32/69271_2.png) [@rene](https://forum.endeavouros.com/u/rene)\
**Post date:** [December 7, 2022, 5:54am UTC](https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612/3 "2022-12-07T05:54:05Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![anthony93](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/anthony93/32/92169_2.png) [@anthony93](https://forum.endeavouros.com/u/anthony93)\
**Post date:** [December 7, 2022, 7:24am UTC](https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612/4 "2022-12-07T07:24:16Z")

</div>

@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](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.

1. First, `cd` into `/usr/lib/systemd/system-sleep/`, which is the directory to place your script file so that `systemd` can find and execute them.
2. Create a script inside the directory `sudo touch setkeyboardmap`
3. Copy and paste this code into the `/usr/lib/systemd/system-sleep/setkeyboardmap` file you just created.

```auto
#!/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

```

1. Make the script executable with `chmod`

---

<div class="post-metadata">

**Author:** ![erw1](https://forum.endeavouros.com/letter_avatar_proxy/v4/letter/e/97f17d/32.png) [@erw1](https://forum.endeavouros.com/u/erw1)\
**Post date:** [December 7, 2022, 10:43am UTC](https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612/5 "2022-12-07T10:43:25Z")

</div>

" just set things through its keyboard configuration. " What file for XFCE?

---

<div class="post-metadata">

**Author:** ![rene](https://forum.endeavouros.com/user_avatar/forum.endeavouros.com/rene/32/69271_2.png) [@rene](https://forum.endeavouros.com/u/rene)\
**Post date:** [December 7, 2022, 12:00pm UTC](https://forum.endeavouros.com/t/unable-to-permanently-set-setxkbmap/34612/6 "2022-12-07T12:00:58Z")

</div>

Not a “file” as such but simply \<menu\> → Keyboard | Layouts:

 ![xfce-keyboard](https://forum.endeavouros.com/uploads/default/original/3X/f/c/fccef85d3e2d0b0a0dbb2a490f2eeb031bfd40a6.png)

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.

[![](https://altgr-weur.eu/images/English_US_international_altgr_dead_keys.gif) ](https://altgr-weur.eu/images/English_US_international_altgr_dead_keys.gif)
