Skip to content

Instantly share code, notes, and snippets.

@LiamPerson
Created December 11, 2024 04:53
Show Gist options
  • Save LiamPerson/2ac59f2cf24c4f7a358af2c6989c5f22 to your computer and use it in GitHub Desktop.
Save LiamPerson/2ac59f2cf24c4f7a358af2c6989c5f22 to your computer and use it in GitHub Desktop.
How to stop X Window System (xorg / x11) from pasting on middle mouse click / button press

How to stop X Window System (xorg / x11) from pasting on middle mouse click / button press

This was made to work with Arch

Steps:

  1. Install xmousepasteblock from the Arch User Repository: https://aur.archlinux.org/packages/xmousepasteblock

(Recommended to just use yay:

# Install yay package manager
sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si

# Install xmousepasteblock through yay
yay -S xmousepasteblock

On KDE Set 'NoEmptyClipboard' to false in ~/.config/klipperrc

[General]
IgnoreImages=false
Version=6.2.3
NoEmptyClipboard=false # <-- This. Add it if you don't have it.
  1. Add a Systemd service for xmousepasteblock by creating the file /etc/systemd/system/xmousepasteblock.service
  2. Add the following contents to said file:
[Unit]
Description=XMousePasteBlock Service
After=display-manager.service

[Service]
ExecStart=/usr/bin/xmousepasteblock
Restart=always
Environment=DISPLAY=:0

[Install]
WantedBy=default.target
  1. Enable the new service: sudo systemctl enable xmousepasteblock.service
  2. Start the new service: sudo systemctl start xmousepasteblock.service
  3. Restart sudo reboot

That's it. It should now be installed and working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment