Prefer X11 launcher (like srandr) over udev/systemd setup

See #162. The X11 launcher, that waits for randr events in X11 and runs
autorandr manually, proved to be more reliable than the setup using udev
and systemd. Make it the default.
This commit is contained in:
Phillip Berndt 2019-12-31 11:41:27 +01:00
parent de9d7c6b0b
commit e1c85639c3
3 changed files with 26 additions and 7 deletions

View File

@ -1,6 +1,7 @@
DESTDIR=/
PREFIX=/usr/
RPM_SPEC=contrib/packaging/rpm/autorandr.spec
CFLAGS=-O2
.PHONY: all install uninstall autorandr bash_completion autostart_config pmutils systemd udev
@ -23,10 +24,9 @@ all:
@echo
@echo 'E.g. "make install TARGETS='autorandr pmutils' PM_UTILS_DIR=/etc/pm/sleep.d".'
@echo
@echo "An additional TARGETS variable \"launcher\" is available. This"
@echo "installs a launcher called \"autorandr_launcher\". The launcher"
@echo "is able to be run by the user and calls autorandr automatically"
@echo "without using udev rules."
@echo "By default, if xcb libraries are available, autorandr prefers to"
@echo "install a launcher that listens for X11 randr events and runs"
@echo "autorandr whenever something changes, over udev/systemd rules."
@echo
@echo "The following additional targets are available:"
@echo
@ -139,12 +139,24 @@ uninstall_manpage:
rm -f ${DESTDIR}/${MANDIR}/autorandr.1
# Rules for launcher
LAUNCHER_FLAGS=$(shell pkg-config --libs --cflags pkg-config xcb xcb-randr 2>/dev/null)
ifneq (,$(LAUNCHER_FLAGS))
DEFAULT_TARGETS+=launcher
DEFAULT_TARGETS:=$(filter-out systemd udev,$(DEFAULT_TARGETS))
endif
install_launcher:
gcc -Wall contrib/autorandr_launcher/autorandr_launcher.c -o contrib/autorandr_launcher/autorandr_launcher -lxcb -lxcb-randr
install -D -m 755 contrib/autorandr_launcher/autorandr_launcher ${DESTDIR}${PREFIX}/bin/autorandr_launcher
gcc -Wall $(CFLAGS) contrib/autorandr_launcher/autorandr_launcher.c -o contrib/autorandr_launcher/autorandr-launcher $(LAUNCHER_FLAGS)
install -D -m 755 contrib/autorandr_launcher/autorandr_launcher ${DESTDIR}${PREFIX}/bin/autorandr-launcher
install -D -m 644 contrib/etc/xdg/autostart/autorandr-launcher.desktop ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-launcher.desktop
ifneq ($(PREFIX),/usr/)
sed -i -re 's#/usr/bin/autorandr-launcher#$(subst #,\#,${PREFIX})/bin/autorandr-launcher#g' ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-launcher.desktop
endif
uninstall_launcher:
rm -f ${DESTDIR}${PREFIX}/bin/autorandr_launcher
rm -f ${DESTDIR}${PREFIX}/bin/autorandr-launcher
rm -f ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-launcher.desktop
TARGETS=$(DEFAULT_TARGETS)
install: $(patsubst %,install_%,$(TARGETS))

View File

@ -217,6 +217,7 @@ profiles matching multiple (or any) monitors.
**autorandr 1.10 (dev)**
* *2019-12-31* Fix output positioning if the top-left output is not the first
* *2019-12-31* Accept negative gamma values (and interpret them as 0)
* *2019-12-31* Prefer the X11 launcher over systemd/udev configuration
**autorandr 1.9**

View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Autorandr Launcher
Comment=Automatically run autorandr whenever the configuration changes
Type=Application
Exec=/usr/bin/autorandr-launcher
X-GNOME-Autostart-Phase=Initialization