This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues/pull-requests.
1
0
Fork 0
宇天 28db16e977 backup 2020-01-15 20:24:05 +08:00
.gitignore backup 2020-01-15 20:24:05 +08:00
Makefile backup 2020-01-15 20:24:05 +08:00
README.md backup 2020-01-15 20:24:05 +08:00
xmousepasteblock.c backup 2020-01-15 20:24:05 +08:00

README.md

XMousePasteBlock

Listens for middle mouse click events and clears the primary X selection/clipboard on detection to avoid accidentially pasting stuff all over the place.

About

No need to disable your precious middle mouse button bindings, no clearing of visual selections nor performance losses because of emptying the primary X clipboard periodically. With the utilization of XInput and Xlibs this has no measurable impact on performance whatsoever. No elevated privileges required. Just run within your regular users' X session.

Building

make
sudo make install

Running

Just add xmousepasteblock to your startup script/config.

Known issues

In case of devices which are configured with middle mouse button hold-to-scroll (e.g. Trackpoints), it may happen that the primary selection clear action gets fired too late on older and slower machines. You can observe the behavior by building with the DEBUG flag set (make debug), running xmousepasteblock in a shell and watching the debug output as you long press and hold the mouse buttons.

This is due to the fact that the XI_RawButtonPress event only gets fired after releasing the middle mouse button (in case the user wanted to execute a scroll action). The only option to work around this is to disable the middle mouse button hold-to-scroll functionality on Trackpoint devices (which is often not desirable). To do so (using libinput): xinput set-prop <device id> 'libinput Button Scrolling Button' 0

禁止鼠标中键粘贴。 不是我写的, 只是怕以后不知道去哪找, 所以上传这里备份一下。
C 82.8%
Makefile 17.2%