Disabling middle-click paste in swaywm archlinux
- User
Disabling middle-click paste in swaywm archlinux
- Assistant
Disabling middle-click paste in swaywm archlinux
In Sway (a Wayland compositor) on Arch Linux, the "middle-click paste" behavior is generally managed by the clipboard handling behavior of the applications and Wayland protocols. Unlike X11 where "middle click paste" is a default managed by the X server, Wayland (and thus Sway) doesn't have a direct equivalent built-in to do this automatically.
However, many terminals and applications still implement middle-click paste internally (and Wayland "primary selection" clipboard support exists), so middle-click paste happens if an application supports it.
If you want to disable middle-click paste in Sway, here are possible approaches:
Many terminals (Alacritty, Kitty, Terminator, Gnome Terminal, etc.) handle middle-click paste internally.
Examples:
Alacritty: Middle click paste can be disabled by setting:
mouse:
paste:
middle_click: false
Kitty: In the config file ~/.config/kitty/kitty.conf:
disable_mouse_paste_in_middle_click yes
(If such an option exists; consult Kitty docs)
URxvt / rxvt: Might have URxvt*secondaryPaste: false in .Xresources (X11 only).
You might be able to disable the middle mouse button in Sway's config:
Open your sway config file, typically ~/.config/sway/config, and add a rule to disable the middle button.
Example:
input "YOUR_MOUSE_IDENTIFIER" {
events = disabled
}
But this disables all events for the device (probably too much).
Alternatively, you can't directly "disable" the middle mouse button click via sway config, but you can possibly remap it using the input configuration with xinput or libinput quirks.
Check the device name by:
swaymsg -t get_inputs
Then you can try to remap the button or ignore middle-button events globally via libinput quirks or by intercepting with tools like imwheel (for X only) or Wayland alternatives.
Unfortunately, libinput under Wayland does not support button remapping to disable specific buttons at this time.
Some clipboard managers might interfere with primary selection paste.
Try disabling them or configuring them not to handle primary selection.
wlr-mouse or wlroots utilities (experimental)There are tools linked with the wlroots stack which might intercept mouse events, but this is advanced and not stable.
In ~/.config/alacritty/alacritty.yml:
mouse:
paste:
middle_click: false
If you can share which apps you want to disable middle-click paste in (terminals, browsers, etc.), I may be able to give more specific instructions.
Not yet included in a published release.