Page 1 of 1
how to execute a command at the startup
Posted: Sat May 11, 2024 11:59 am
by wax
i try to use /usr/bin/xmodmap $HOME/.Xmodmap command at the startup
i use xfce
it's a way to make f8 and f9 capable to increase and lower the speakers
Re: how to execute a command at the startup
Posted: Sat May 11, 2024 12:13 pm
by wax
i tried just to add the command at /etc/rc.local, above the exit 0 line
but the file don;t seem to be executed
Re: how to execute a command at the startup
Posted: Sat May 11, 2024 12:37 pm
by Charlie Brown
The .Xmodmap will already take effect, do you have the required lines in it correctly? Like
Or.. what's the command exactly? (Assuming it works from a terminal).
Re: how to execute a command at the startup
Posted: Sat May 11, 2024 1:04 pm
by wax
$ cat .Xmodmap
keycode 74 = XF86AudioLowerVolume
keycode 75 = XF86AudioRaiseVolume
/usr/bin/xmodmap $HOME/.Xmodmap works fine from a terminal
Re: how to execute a command at the startup
Posted: Sat May 11, 2024 1:25 pm
by Charlie Brown
"Session and Startup" - "App Autostart" tab, add new, any name, any description, command:
Code: Select all
sh -c "/usr/bin/xmodmap -e 'keycode 74=XF86AudioLowerVolume'"
Code: Select all
sh -c "/usr/bin/xmodmap -e 'keycode 75=XF86AudioRaiseVolume'"
(Add 2 new items)
If still not working we'll add some delay.
Or just:
/usr/bin/xmodmap /home/
yourusername/.Xmodmap
as the command (particularly "the full path" as above , not $HOME or ~/... )
Re: how to execute a command at the startup
Posted: Sat May 11, 2024 1:51 pm
by wax
it is not working. let's add some delay. how?
Re: how to execute a command at the startup [Solved]
Posted: Sat May 11, 2024 2:32 pm
by Charlie Brown
Code: Select all
sh -c 'sleep 5 ; /usr/bin/xmodmap /home/yourusername/.Xmodmap'
or:
Code: Select all
sh -c "sleep 5 ; /usr/bin/xmodmap -e 'keycode 74=XF86AudioLowerVolume'"
Code: Select all
sh -c "sleep 5 ; /usr/bin/xmodmap -e 'keycode 75=XF86AudioRaiseVolume'"
Re: how to execute a command at the startup
Posted: Sat May 11, 2024 2:43 pm
by wax
it is working. (i had to restart the system also.)
Ty so much

Re: how to execute a command at the startup
Posted: Sat May 11, 2024 3:26 pm
by Charlie Brown
You're welcome :)
Which one did you use? The path or the commands?
Btw. maybe you mark the thread solved :)
Re: how to execute a command at the startup
Posted: Sat May 11, 2024 5:36 pm
by fehlix
wax wrote: Sat May 11, 2024 1:04 pm
$ cat .Xmodmap
keycode 74 = XF86AudioLowerVolume
keycode 75 = XF86AudioRaiseVolume
/usr/bin/xmodmap $HOME/.Xmodmap works fine from a terminal
xmodmap will be reset when setxkbmap is running.
So you may need to delay b/c in session/autostart and somewhere in X-startup a setxkbmap is triggered.
Alternatively rename the autostart entry to something like
zz_xmodmap
which genrates a desktop file within:
$HOME/.config/zz_xmodmap.desktop
So it will run last within the list of entries, which are executed in order.
Re: how to execute a command at the startup
Posted: Sun May 12, 2024 11:10 am
by wax
Charlie Brown wrote: Sat May 11, 2024 3:26 pm
You're welcome :)
Which one did you use? The path or the commands?
Btw. maybe you mark the thread solved :)
i used the commands you offered