Comments (8)
autorandr sorts the profiles by modification date and uses the first one that matches, and updates a profile's mtime when it loads it. So the behaviour is intentionally (see #16) exactly the inverse of your use case. The rationale for this is that if autorandr is set up to automatically run (e.g. after boot, after waking from s3) it will then likely load the profile that the user wants.
To work around this in your case, you could add a block
script to both profiles (Just put an executable file into the profiles' directories) that blocks the profile (by returning with a zero exit code) if it is already loaded. Manual loading will still be possible, but automated detection will skip the profile.
from autorandr.
Thanks for the reply. I will use the described workaround, so this request can be closed.
E: I tried your suggestion and found a little problem. How does one get the information which profile is currently used? I tried to grep the output from 'autorandr --dry-run' but the problem is that it is also executing the block script and therefore causes a infinite loop.
I guess I have to put some logic into a postscript unless you have another tip for me.
from autorandr.
I thought that this might be a problem. How about passing some parameters to the block
script? For your use case, the name of the old profile (if applicable) would suffice. I am not sure yet if any further passed information would be useful..
from autorandr.
Well for my use case I would need the current profile name and from that need to be able to predict the next profile name. While 'autorandr --dry-run' did not work it gave me a list from which I could select the name of the profile which came after the current profile.
p1 (detected) (current)
p2 (detected)
p3 (detected)
Still there would be the problem if one does use more than two profiles in this example the profile names would change positions when loaded.
I guess the most simplistic implementation for this would be to add a new --toggle switch which gets a list of non blocked matching profiles, sorts them alphabetically by name and activates the profile that comes after the current active profile.
from autorandr.
You should be able work around that as well, by blocking a profile based on whether you'd want autorandr to switch to it or not. e.g. if you want the order p1 -> p2 -> p3, you could give p2 a block script that blocks the profile unless p1 is loaded, one to p3 that blocks unless p2 is loaded, and one to p1 that blocks if either p1 or p2 are loaded. (This way, p1 will be loaded if p3 or none of the profiles was active.)
This would still require a patch to autorandr to pass the name of the old profile to the block script.
Do I miss anything here or would this work?
from autorandr.
Indeed this is a good solution, while I don't really need any specific profile order it is still nice to have the possibility to set up one.
I don't see any further problems.
from autorandr.
autorandr now passes the environment variable $AUTORANDR_CURRENT_PROFILE
to the block script.
from autorandr.
Thx, everything works as expected.
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
- Additional Documentation HOT 7
- autorandr.service "Failed to load profile: 'xxx' : Profile not found" althoug profile exists HOT 1
- Failed to apply profile due to `--crtc` option HOT 2
- 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 4
- 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.