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.
This commit is contained in:
Felitendo committed 2026-09-08 13:38:39 +02:00
1 parent 004094ef78
commit e09b145f3a
2 files changed
+26 -4

No files matched your search

+8 -4
View File
@@ -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
+18
View File
@@ -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