I've removed the bundled systemd unit. If you need it, I recommend installing the one distributed here: https://github.com/milaq/XMousePasteBlock/blob/master/xmousepasteblock.service
Search Criteria
Package Details: xmousepasteblock 1.4-2
Package Actions
Git Clone URL: | https://aur.archlinux.org/xmousepasteblock.git (read-only, click to copy) |
---|---|
Package Base: | xmousepasteblock |
Description: | Userspace tool to disable middle mouse button paste in Xorg |
Upstream URL: | https://github.com/milaq/XMousePasteBlock |
Keywords: | block clipboard disable middleclick mouse paste primary selection x11 xorg |
Licenses: | GPL |
Conflicts: | xmousepasteblock-git |
Submitter: | peelz |
Maintainer: | peelz |
Last Packager: | peelz |
Votes: | 3 |
Popularity: | 0.041546 |
First Submitted: | 2023-03-08 21:26 (UTC) |
Last Updated: | 2024-02-15 17:15 (UTC) |
Latest Comments
peelz commented on 2024-02-15 17:16 (UTC)
peelz commented on 2023-05-06 22:30 (UTC)
Yeah, that error shows up when the service is started before the X server is available. Though, I'm not sure how you got the service to run in the first place, since it depends on graphical-session.target
(which isn't used unless something BindsTo=
it).
I tested it in a VM (bspwm + lightdm) and xmousepasteblock.service
wouldn't start on session init (no errors either).
If sddm is somehow starting graphical-session.target
despite not having a concrete session target, then I would consider that a bug. You can find documentation about this special target in the systemd.special(7)
manual.
For instance, this is what it looks like on GNOME:
graphical-session.target
● ├─*omitted for brevity*
● ├─xmousepasteblock.service
● ├─basic.target
● │ ├─*omitted for brevity*
● ├─gnome-session-wayland.target
● └─gnome-session-wayland@gnome.target
● ├─gnome-session-wayland.target
● ├─gnome-session.target
● │ ├─gnome-session-monitor.service
○ │ ├─gnome-session-signal-init.service
● │ ├─gnome-session-initialized.target
○ │ │ ├─gnome-session-signal-init.service
● │ │ ├─org.gnome.Shell@wayland.service
○ │ │ ├─org.gnome.Shell@x11.service
● │ │ ├─gnome-session-manager.target
● │ │ │ ├─gnome-session-manager@gnome.service
● │ │ │ ├─gnome-session-pre.target
● │ │ │ ├─gnome-session-monitor.service
● │ │ │ ├─graphical-session-pre.target
● │ │ │ └─basic.target
● │ │ │ ├─...
You might want to report this to the bspwm dev, but it might just be easier to add xmousepasteblock &
to your rc file as you mentioned.
dough.mean commented on 2023-05-06 19:19 (UTC) (edited on 2023-05-06 19:24 (UTC) by dough.mean)
Also, how do you start your X session?
I'm currently using sddm. I think this also was a problem in lightdm.
output of
systemctl --user list-dependencies graphical-session.target
graphical-session.target
● ├─at-spi-dbus-bus.service
● ├─dunst.service
● ├─xdg-desktop-portal.service
● ├─xdg-document-portal.service
● ├─xdg-permission-store.service
× ├─xmousepasteblock.service
● └─basic.target
● ├─paths.target
● ├─sockets.target
● │ ├─dbus.socket
● │ ├─dirmngr.socket
● │ ├─gpg-agent-browser.socket
● │ ├─gpg-agent-extra.socket
● │ ├─gpg-agent-ssh.socket
● │ ├─gpg-agent.socket
● │ ├─p11-kit-server.socket
● │ ├─pipewire.socket
● │ └─pulseaudio.socket
● └─timers.target
Then put this in your bspwmrc:
Thanks, I'll be testing this later! Though I'm also considering just putting xmousepasteblock &
to my bspwmrc
or .xprofile
instead for simplicity.
Also, the previous error message I posted was clumsily copied and was missing some lines:
Apr 29 02:40:11 username systemd[453]: Started X daemon that listens for middle mouse click events and clears the primary X selection.
Apr 29 02:40:11 username xmousepasteblock[2251593]: Error: Failed to connect to the X server
Apr 29 02:40:11 username systemd[453]: xmousepasteblock.service: Main process exited, code=exited, status=1/FAILURE
Apr 29 02:40:11 username systemd[453]: xmousepasteblock.service: Failed with result 'exit-code'.
Apr 29 02:40:11 username systemd[453]: xmousepasteblock.service: Scheduled restart job, restart counter is at 6.
Apr 29 02:40:11 username systemd[453]: Stopped X daemon that listens for middle mouse click events and clears the primary X selection.
I glanced at the code and it seems that Error: Failed to connect to the X server
happens when the display server is not available at the time it was run. So I guess the service started too early?
peelz commented on 2023-05-05 20:01 (UTC) (edited on 2023-05-05 20:10 (UTC) by peelz)
Okay so I think I figured out what's going on. Tiling WMs don't typically bind to graphical-session.target
like the big DEs do.
You can achieve the same result by creating your own target and service units.
~/.config/systemd/user/bspwm-session.service
:
[Unit]
Description=bspwm session
PartOf=bspwm-session.target
Wants=bspwm-session.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
Restart=on-failure
~/.config/systemd/user/bspwm-session.target
:
[Unit]
Description=bspwm Session
Requires=basic.target
BindsTo=graphical-session.target
Before=graphical-session.target
DefaultDependencies=no
RefuseManualStart=yes
RefuseManualStop=yes
Requires=basic.target
StopWhenUnneeded=yes
Then put this in your bspwmrc
:
#!/bin/bash
sxhkd &
systemctl start --user bspwm-session.service
Note that this won't stop bspwm-session.service
when bspwm shuts down. Maybe there's a way to fix that, but I'll let you figure out that one :)
References:
peelz commented on 2023-05-05 18:29 (UTC) (edited on 2023-05-05 20:12 (UTC) by peelz)
What does the output of systemctl --user list-dependencies graphical-session.target
look like? Also, how do you start your X session?
If possible, could you message me on the Libera IRC (same nickname)? It would make it much easier to troubleshoot this. Thanks
dough.mean commented on 2023-05-05 18:15 (UTC)
The service isn't working for me on startup:
May 05 18:05:59 username systemd[455]: Started X daemon that listens for middle mouse click events and clears the primary X selection.
May 05 18:05:59 username systemd[455]: xmousepasteblock.service: Main process exited, code=exited, status=1/FAILURE
May 05 18:05:59 username systemd[455]: xmousepasteblock.service: Failed with result 'exit-code'.
May 05 18:05:59 username systemd[455]: xmousepasteblock.service: Scheduled restart job, restart counter is at 6.
May 05 18:05:59 username systemd[455]: Stopped X daemon that listens for middle mouse click events and clears the primary X selection.
May 05 18:05:59 username systemd[455]: xmousepasteblock.service: Start request repeated too quickly.
May 05 18:05:59 username systemd[455]: xmousepasteblock.service: Failed with result 'exit-code'.
Manually running systemctl --user enable --now xmousepasteblock.service
works once I've logged in. I'm using bspwm.
peelz commented on 2023-03-08 21:41 (UTC) (edited on 2023-11-08 16:42 (UTC) by peelz)
Please don't flag as out-of-date!
The latest upstream version (1.3) doesn't work for many users, which is why this package is currently pinned to the last known working release (1.2).
It also includes a systemd user service so it can be initialized without having to modify session init scripts manually.
I tested the systemd service on both GNOME (43.3) and KDE Plasma (5.27.2), both appear to work fine.
Pinned Comments
peelz commented on 2024-02-15 17:16 (UTC)
I've removed the bundled systemd unit. If you need it, I recommend installing the one distributed here: https://github.com/milaq/XMousePasteBlock/blob/master/xmousepasteblock.service