Skip to content
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

Add wlrlui -m to automatically match profiles #9

Merged
merged 4 commits into from
May 17, 2024

Conversation

levnikmyskin
Copy link
Contributor

Hi,
This PR adds an -m option to wlrlui to automatically match profiles.
Basically, it will iterate over all saved profiles (sorted alphabetically), and it will apply the first profile where all currently connected monitors uid match.

This can also be used together with any script that listens for monitor changes, in order to apply the correct profile every time a monitor is connected/disconnected.
For instance, using pyprland monitors, this should work, despite a little cumbersome:

[monitors.hotplug_commands]
# add all your monitors
"DELL P2417H CJFH277Q3HCB" = "wlrlui -m"
"Sony Something" = "wlrlui -m"

Copy link
Owner

@fdev31 fdev31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why it's not prof_uids == current_uids instead ...

@fdev31
Copy link
Owner

fdev31 commented May 17, 2024

I love the idea!

Copy link
Owner

@fdev31 fdev31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost ready for merge, most important clarification is about the "main" condition of the code

src/wlr_layout_ui/__init__.py Outdated Show resolved Hide resolved
src/wlr_layout_ui/__init__.py Outdated Show resolved Hide resolved
src/wlr_layout_ui/__init__.py Show resolved Hide resolved
src/wlr_layout_ui/__init__.py Outdated Show resolved Hide resolved
@fdev31
Copy link
Owner

fdev31 commented May 17, 2024

This can also be used together with any script that listens for monitor changes, in order to apply the correct profile every time a monitor is connected/disconnected. For instance, using pyprland monitors, this should work, despite a little cumbersome:

[monitors.hotplug_commands]
# add all your monitors
"DELL P2417H CJFH277Q3HCB" = "wlrlui -m"
"Sony Something" = "wlrlui -m"

Any suggestion here? something like what follows?

[monitors]
hotplug_command = "wlrlui -m" 

@levnikmyskin
Copy link
Contributor Author

Implemented the changes as requested.

Any suggestion here? something like what follows?

Yes that would work!

@levnikmyskin levnikmyskin requested a review from fdev31 May 17, 2024 17:32
@fdev31 fdev31 merged commit db4456c into fdev31:main May 17, 2024
@fdev31
Copy link
Owner

fdev31 commented May 17, 2024

Great! I'm ok to add this to pyprland, if I forget you can open a feature request (even one-liner linking here, it's just a reminder)

Thank you for the contribution!

@levnikmyskin
Copy link
Contributor Author

Great! I'm ok to add this to pyprland, if I forget you can open a feature request (even one-liner linking here, it's just a reminder)

Thank you for the contribution!

Theoretically that should work already (with unknown), if no monitors are configured in pyprland right?

@fdev31
Copy link
Owner

fdev31 commented May 18, 2024

I think I removed it at some point because it was not so straightforward in the end...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants