Xmodmap autostart

Hi,

Trying to use this systemd replacement from sysvinit.

I am trying to re-initialize the xmodmap AFTER the x server is logged in as you typically would do with the xinitrc file in the home directory.

I have written a simple module for the system in /etc/systemd/system.

I have started the module but it does not invoke the simple command in the script.

here is the module

[Unit]
Description=Example systemd service.

[Service]
Type=simple
User=gregor
ExecStart=/bin/bash /home/gregor/.scripts/startUp.sh

[Install]
WantedBy=multi-user.target

/etc/systemd/system/startUp.service

ls -l on the file;

-rwxr–r–. 1 gregor root 170 Nov 4 00:29 /etc/systemd/system/startUp.service

script;

#!/bin/bash
xmodmap -e “keycode 64 = Super_L”&

How can i get this systemd to execute this script after login is complete like a typical ~/.xinitrc would.

1 Like
sudo tee /etc/profile.d/custom.sh << "EOF" > /dev/null
if [ -n "${DISPLAY}" ]
then xmodmap -e "keycode 64 = Super_L"
fi
EOF

Hi,
Thanks for the suggestion.
This still hasn’t solved my issue. The script does not run and my keys are not adjusted.

Weird, it works for me on Fedora 33 + GNOME.

Check the output:

echo ${SHELL} ${BASH_VERSION}
xmodmap -pke | grep -e "^keycode\s*64\s*="

[gregor@localhost profile.d]$ xmodmap -pke | grep -e “^keycode\s64\s=”
keycode 64 = Alt_L Meta_L Alt_L Meta_L

doesnt work.

But if i run anything even change script to executable it suddenly works.

[gregor@localhost ~]$ sudo chmod u+x /etc/profile.d/custom.sh
[sudo] password for gregor:
[gregor@localhost ~]$ echo ${SHELL} ${BASH_VERSION}
/bin/bash 5.0.17(1)-release
[gregor@localhost ~]$ xmodmap -pke | grep -e “^keycode\s64\s=”
keycode 64 = Super_L NoSymbol Super_L
[gregor@localhost ~]$

very odd

I just need to open the terminal.
I do not even type a character and it will start working.
If i do not open the terminal, it does not apply the command.

very strange.

Is there a way to instantiate the terminal from the command? maybe that will work.

1 Like

Try this way:

mkdir -p ~/.config/autostart
tee ~/.config/autostart/xmodmap.desktop << "EOF" > /dev/null
[Desktop Entry]
Name=xmodmap
Exec=xmodmap -e "keycode 64 = Super_L"
Type=Application
EOF
2 Likes

this worked.
Thanks!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.