Giter VIP home page Giter VIP logo

Comments (8)

phillipberndt avatar phillipberndt commented on May 23, 2024

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.

CDanU avatar CDanU commented on May 23, 2024

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.

phillipberndt avatar phillipberndt commented on May 23, 2024

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.

CDanU avatar CDanU commented on May 23, 2024

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.

phillipberndt avatar phillipberndt commented on May 23, 2024

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.

CDanU avatar CDanU commented on May 23, 2024

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.

phillipberndt avatar phillipberndt commented on May 23, 2024

autorandr now passes the environment variable $AUTORANDR_CURRENT_PROFILE to the block script.

from autorandr.

CDanU avatar CDanU commented on May 23, 2024

Thx, everything works as expected.

from autorandr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.