Package Details: xmousepasteblock 1.4-3

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: 4
Popularity: 0.44
First Submitted: 2023-03-08 21:26 (UTC)
Last Updated: 2024-11-08 23:41 (UTC)

Dependencies (5)

Required by (0)

Sources (1)

Latest Comments

1 2 Next › Last »

Powersource commented on 2024-11-08 23:36 (UTC) (edited on 2024-11-09 13:44 (UTC) by Powersource)

Thank you 💚💚💚

Edit: For anyone else who didn't know this, you need to give systemctl --user since it's a service for the local user. So the full command to start the service is

systemctl --user enable --now xmousepasteblock

peelz commented on 2024-11-08 23:33 (UTC)

@Powersource sure. It wasn't included previously because it had issues (race condition?) on certain DEs (mainly GNOME iirc?) where it would fail to run because the X server wasn't initialized in time. I just tested on a Fedora VM running the latest version of GNOME and it appears to work, so I'll include it in the package.

Powersource commented on 2024-11-08 15:18 (UTC)

Could this package include the .service file from the git repo as well? Having to manually install it from the git repo kind of ruins the point for me of installing an AUR package.

peelz commented on 2024-10-15 21:13 (UTC)

@matthewq337: Please don't flag as out of date for something like this. xmousepasteblock-git should have provides=(xmousepasteblock) and conflicts=(xmousepasteblock), unfortunately I don't manage the devel package, so I can't fix it myself.

Ask the xmousepasteblock-git package maintainer to fix it and I'll remove conflicts=(xmousepasteblock-git) from this package.

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

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