Comments (7)
And yet, somehow it is triggered on display changes. I have looked and looked and have not been able to figure out how that happens
Came here with the same question. On debian system (installed from apt), I can see two systemd units being active:
/etc/systemd/system/sleep.target.wants/autorandr.service
/etc/systemd/system/multi-user.target.wants/autorandr-lid-listener.service
first for triggering when resuming from suspension, and second triggering when laptop lid is opened. Nothing under udev. How are actual display changes picked up?
Edit: found it, the udev rule is installed into /lib/udev/rules.d/40-monitor-hotplug.rules
from autorandr.
What complicates answering this question is that autorandr supports many, many different ways of being used, and the package itself installs a random collection of automation tools. I treat the repository as containing a script that people can setup manually however they'd like (the tool is clearly aimed at powerusers that heavily customize their system these days, not at the average user - let's face it, WMs got quite good at managing screens on their own 😉). Different package maintainers then enable different kinds of automation in their packages, according to their taste.
A few options are:
- Use a systemd unit + udev - this is the default. An udev rule fires whenever something changes and activates the systemd unit, which runs autorandr in a batch mode where it runs itself for every user that has an open X11 session.
- An autostart desktop unit to run autorandr exactly once at startup
- pmutils integration to run autorandr whenever the system wakes up from sleep
- A daemon that runs in your X11 session and runs autorandr whenever there's a screen change event - that's the launcher from the contrib repo.
listen_lid
- from the contrib directory, is a script to listen for lid events on laptops, and then runs autorandr
I think what I'd currently prefer is an option we don't currently have: Use ctypes from autorandr itself to reimplement autorandr_launcher
, and then just give it a --daemon
option that utilizes it and put autorandr in daemon mode into people's autostart. The reason I'd prefer this nowadays is that it doesn't have extra dependencies, works for everyone no matter which distribution, and is dead simple to understand - as you wrote, it's natural to expect a daemon :)
from autorandr.
Adding to this (hopefully in a constructive fashion :), it would be really nice to understand how autorandr gets run on a display connection/disconnection. I originally assumed that autorandr was a daemon process running in the background. Lots of folks are autostarting it in the window-manager startup files, etc. But lo! there is no autorandr process running on my system. And yet, somehow it is triggered on display changes. I have looked and looked and have not been able to figure out how that happens. Understanding this has implications for how and when autorandr should be run (from a startup file or wherever), and it would be nice if the documentation explained this magic. Is it registering a "callback" from some system service?
from autorandr.
Hey, nice catch! Thanks for tracking that down.
Next question, I suppose, is whether we should be running autorandr anywhere in .xinitrc or autostart scripts (thinking specifically of "startx" setups like mine, without a display manager). If it is already called on every display change, maybe there is no reason to run it manually, ever.
from autorandr.
I never run it manually under normal circumstances.
from autorandr.
Thanks for the detailed explanation! I personally like the fact that it's not another daemon on my system---so many of those already. The udev (eudev sans systemd on my Void Linux laptop) method seems pretty straightforward.
from autorandr.
Agreed, don't see anything wrong with utilizing the hooks provided by the OS itself -- why have yet another service running in the background when it's not really needed?
from autorandr.
Related Issues (20)
- Question: should autorandr systemd service change profile when external monitor is unplugged? HOT 2
- Use of --skip-options breaks --current HOT 1
- Parsing XRandR output failed HOT 1
- Detected Wayland session 'wayland-0'. Exiting.
- Failed to apply profile because xrandr cannot find mode
- postscript loses authentication for systemctl commands after suspending HOT 1
- Unhandled exception (local variable 'output' referenced before assignment) HOT 1
- Broken regexes due to missing `r` string literal HOT 6
- Unable to save lid state when using NVIDIA GPU (no eDP / LVDS output)
- Total system crash + soundloop could be caused by autorandr
- Total system crash + soundloop could be caused by autorandr
- No XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE events HOT 2
- Prevent profile change with screen lock HOT 1
- autorandr.service "Failed to load profile: 'xxx' : Profile not found" althoug profile exists HOT 1
- Failed to apply profile due to `--crtc` option HOT 3
- Incorrect profile settings HOT 1
- autorandr /usr/bin/autorandr:210: SyntaxWarning: invalid escape sequence '\s' XRANDR_OUTPUT_REGEXP = """(?x) /usr/bin/autorandr:236: SyntaxWarning: invalid escape sequence '\s' """ + XRANDR_PROPERTIES_REGEXP + """ | # Properties to include in the profile /usr/bin/autorandr:248: SyntaxWarning: invalid escape sequence '\S' XRANDR_OUTPUT_MODES_REGEXP = """(?x) /usr/bin/autorandr:592: SyntaxWarning: invalid escape sequence '\s' version = re.search("xrandr program version\s+([0-9\.]+)", version_string).group(1) /usr/bin/autorandr:888: SyntaxWarning: invalid escape sequence '\+' match = re.match("(?P<w>[0-9]+)x(?P<h>[0-9]+)(?:\+(?P<x>[0-9]+))?(?:\+(?P<y>[0-9]+))?.*", output.options["panning"]) HOT 7
- please support appimage , or binary file HOT 1
- Enabling udev rule / systemd service on a per-user basis? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autorandr.