-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Adding a option to list matched profiles #8
Conversation
Thanks for a great feature. I'll review this PR later today or tomorrow. |
@@ -167,6 +167,15 @@ def find_best(self, available_profiles: list, xrandr_outputs: list): | |||
score = self._calculate_profile_score(p, xrandr_outputs) | |||
if score >= 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about changing this to > 0
?
Honestly, I do not remember, why it is >= 0
and I haven't touched code for quite a while, so you might know better now.
But at least in the context of the feature you implemented listing profiles with score 0 doesn't seem to have any sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm right, a profile scored 0 means its doesn't have any match rules and it will always match. I'm not sure about what is the scenario people use a profile without any match rules. So s > 0
sounds more sense than s >= 0
in this case. I will change it to s > 0
later.
@op8867555 We want to match profiles that just declare the list of expected outputs
Behavior is: apply profile, if LVDS1 and HDMI1 are connected; and it doesn't matter, what is connected. Previously there was a bug in the code, where profiles without I fixed the bug and updated tests (so, hopefully, it is now clear from tests, what the behavior should be). Please, revert your last commit. P.S. sorry for taking so long to reply and thanks again for contribution. |
`match` now always return a sorted list, so it's no need to sort it again in `find_best`.
Thanks for making it clear! I reverted the commit and removed some unnecessary parts. |
This PR adds a option
randrctl list -s
to list matched profiles.I'm using this for several months with rofi and found it is quite convenient. I have binded XF86Display to
randrctl auto
and Shift+XF86Display to:A quick screenshot to describe that:
There are some design choices can be discussed(for example, using space or tab as separator). Please take a look and feel free to review it.