Where to disable mouse-wheel paste?

Putting this into .zprofile doesn’t work:

xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9"

Putting it into .zshrc works, but problems:

  • it runs every time you open a terminal.
  • it’s visible in the new terminal window.

Where is correct place to put it, so it only runs on system boot?

I’m using xfce desktop.


For simple terminal commands you can place them in ~/.xprofile which is run on login.

Another option in xfce is to create a .desktop file in ~/.config/autostart/ but this won’t work in all WM/DE

Eg. no-primary.desktop

[Desktop Entry]
Comment=Disable primary selection
Exec=xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9"

Your [Desktop Entry] works in ~/.config/autostart/.desktop

but fails in ~/.xprofile

Any idea how to make it work in ~/.xprofile?


~/.xprofile is essentially a shell script so you would just add the command same as you’d run it in a terminal

xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9"

The .desktop above is just a file extension not the full file name.

It’s worth noting that our init setups also source ~/.Xmodmap, where you can add user specific keymap changes. eg.

pointer = 1 25 3 4 5 6 7 8 9

See https://wiki.archlinux.org/index.php/Xmodmap#Reverse_scrolling
and https://wiki.archlinux.org/index.php/Xmodmap#Activating_the_custom_table


for the user-specific options above, how can they be done so they apply to all current and future users?


Since it won’t conflict with any packages you could create /etc/skel/.Xmodmap

/etc/skel is copied into new users /home when using useradd

For current users just copy it there I don’t know a better solution.

for i in $(ls /home); do cp ~/.Xmodmap /home/$i/.Xmodmap; done