From e09b145f3a261d14b8471425da1daeb921faa72c Mon Sep 17 00:00:00 2001 From: Felitendo Date: Tue, 8 Sep 2026 13:38:39 +0200 Subject: [PATCH] fix: install the user units where systemd will find them A build with a prefix of its own put them in $(PREFIX)/lib/systemd/user, which is right for /usr/local and wrong for the one prefix an install without root can use: systemd searches $XDG_DATA_HOME/systemd/user and never ~/.local/lib/systemd/user. An install into ~/.local came out with a working program whose watcher could not be enabled at all. They go under share now, which both a system prefix and a home one are searched for. Nothing changes for the packages - the deb and the rpm pass USERUNITDIR in themselves. That prefix is what an atomic distribution leaves a user, so the readme says how to install on Bazzite: layer the rpm and reboot, or put the whole thing in $HOME, which is where everything it writes ends up anyway. --- Makefile | 12 ++++++++---- README.md | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4f43e8e..b53e887 100644 --- a/Makefile +++ b/Makefile @@ -23,13 +23,17 @@ MANDIR ?= $(DATADIR)/man # distribution that still keeps /lib separate from /usr/lib says so here - and # only guessed at when there is no systemd installed to ask. # -# A build with a prefix of its own keeps the units under that prefix instead. -# systemd searches $(PREFIX)/lib/systemd/user as well, and a file outside the -# prefix it was asked for is not this build's to place. +# A build with a prefix of its own keeps the units under that prefix instead, +# and under share rather than lib. systemd searches both for a system prefix, +# but only share for a home one: $XDG_DATA_HOME/systemd/user is a search path +# and ~/.local/lib/systemd/user is not, so an install into ~/.local that put +# the units in lib would leave the watcher impossible to enable. That prefix is +# the one an atomic distribution leaves a user - there is no writing to /usr on +# Bazzite or Silverblue without layering a package and rebooting. ifeq ($(PREFIX),/usr) USERUNITDIR ?= $(shell pkg-config --variable=systemduserunitdir systemd 2>/dev/null || echo /usr/lib/systemd/user) else -USERUNITDIR ?= $(PREFIX)/lib/systemd/user +USERUNITDIR ?= $(DATADIR)/systemd/user endif LINGUAS := de diff --git a/README.md b/README.md index 2bfccf1..502adf2 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,24 @@ sudo curl -fsSL -o /etc/yum.repos.d/middleclick-autoscroll.repo \ sudo dnf install middleclick-autoscroll ``` +**Bazzite and friends (for the ones who reboot to install things)** + +```bash +sudo curl -fsSL -o /etc/yum.repos.d/middleclick-autoscroll.repo \ + https://felitendo.github.io/middleclick-autoscroll/middleclick-autoscroll.repo +sudo rpm-ostree install middleclick-autoscroll +systemctl reboot +``` + +Don't want to layer a shell script into your image? Everything this thing does +happens in `$HOME` anyway, so it can just live there too - no root, no reboot +(needs `make`, otherwise grab it in a distrobox): + +```bash +git clone https://github.com/Felitendo/middleclick-autoscroll +cd middleclick-autoscroll && make install PREFIX=~/.local +``` + **Debian (for the elderly)** ```bash