Command launched with startup program not working

Hi,

I'm using a mac keyboard with french mapping but 2 keys are inverted. I found a command that reverses them to find the correct keyboard configuration.
xmodmap -e 'keycode 94=at numbersign periodcentered Ydiaeresis' -e 'keycode 49=less greater VoidSymbol VoidSymbol'

I try to execute this command at startup. So I follow this topic:
https://forum.zorin.com/t/startup-command-not-working/22477
and even wrap it with a sh -c` command.

Capture d’écran du 2024-08-11 10-28-50

But this doesn't work. The command seems to be not executes as the 2 keys remains in the wrong configuration. If I execute the command from the terminal after startup everything's back to normal.

Can anyone please help me to execute this command at OS startup?

Instead of using a script, why not just add it to your ~.profile (Tap ctl+h to reveal system files "hidden" in Home Directory) so it runs as soon as you login?
echo "xmodmap -e 'keycode 94=at numbersign periodcentered Ydiaeresis' -e 'keycode 49=less greater VoidSymbol VoidSymbol'

1 Like

kinda hijacking now , but saw this thread and reminded me of a problem i had while back with keyboard backlight ( still not solved cause wasn't bothered ) , then tried what Aravisian said in this topic ,and add command in ~.profile rather than .bashrc like i tried before and didn't work ...
now it's working perfectly !
as soon as i log in , i can toggle the keyboard light on/off with Shift+Scroll Lock like it's supose to work

PS : wanted to go back to old topic to post the solution for me , but topic closed ...

Hi,
Thanks a lot but I doesn't work for me.
I added the command to the ~.profil but it seems not running because the 2 keyboard keys remains at the wrong place.

stupid question: did you save it after you added it ?

so if you run the command in terminal , the keys are working correctly then?
but on reboot or log out/in it's back to being wrong ?

Yes, I saved the .profileafter change

You're right @14nd, when I run the command in terminal the keys are working correctly then but on reboot it's back to being wrong. If I log out/in it's still right.

could you post a screenshot of the command in ~.profile ?

like this example

not sure i'm clear on this lol , when you reboot keys are wrong but when you log in the keys are right?

A little correction here: it's ~/.profile.

No idea how did the op use the ~.profile as per my best knowledge it's incorrect.
To get into the correct file, in terminal type:

gedit ~/.profile

It will open the correct file in your text editor then add the changes at the end.

as far as i can see if you go to .profile folder under home profile you get the same file as if you would run gedit ~/.profile.
if you run gedit ~.profile , (that's incorrect yes) then you get to some other folder with nothing in ( on my PC )

so yea ,thanks for expanding on that :smiley:

sure, here it is:

I made a mistake
I added the command to the ~/.profile file, you're right

Using the Startup Applications Preferences from ZorinOS, I added a startup program to test. Here is the command:
gnome-terminal -- sh -c '/bin/date >> /home/famille/.test.txt'

I works. Each time the system boot, the date & time are added to the test.txt file. The startup config is good.

I tried something similar for my keyboard settings:
/usr/bin/gnome-terminal -- sh -c 'xmodmap -e 'keycode 94=at numbersign periodcentered Ydiaeresis' -e 'keycode 49=less greater VoidSymbol VoidSymbol''

But this doesn't work. Keyboard settings are not as I expect.

Hi,

I try something similar but simpler:

  1. I created a setxmodmap.sh file with:
xmodmap /<my-personal-path>/.Xmodmap

with this .Xmodmap` file:

keycode  49 = less greater VoidSymbol VoidSymbol
keycode  94 = at numbersign periodcentered Ydiaeresis
  1. I made the script executable

  2. I run the script manually to test. It was OK.

  3. I added the script to the ZorinOS startup program

It works some of the time but not always.

Sometimes, if the keys were correctly set, it change back to the inverted keys after a long period of inactivity and OS standby.

Just a thought: I've customized some of the keyboard settings from the Zorin setup. This should probably generate a call to xmodmap with a configuration file. Can this configuration sometimes be launched after mine, which would explain why my script sometimes seems to be ignored in the end? I do know, however, that it is executed every time the OS starts up, thanks to a trace in a log file.

How are the keyboard settings defined in the ZorinOS settings menu applied?
If xmodmap is used, do you know where the configuration file is stored?