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

feat: allow gtk css priority to be overridden #116

Merged
merged 15 commits into from
Jan 24, 2025

Conversation

Anomalocaridid
Copy link
Contributor

My GTK theme heavily relies on ~/.config/gtk-4.0/gtk.css and as a result, it takes precedence over whatever styling I set for Ignis. I cannot find a way around this.

This PR adds a read-write property called gtk_priorityto IgnisApp so that Ignis's GTK styling priority could be overridden to, say, Gtk.STYLE_PROVIDER_PRIORITY_USER. Currently, it defaults to the original value, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION.

Also, I made the style attribute in BaseWidget rely on IgnisApp.gtk_priority for consistency.

ignis/app.py Outdated Show resolved Hide resolved
ignis/app.py Outdated Show resolved Hide resolved
ignis/base_widget.py Outdated Show resolved Hide resolved
@Anomalocaridid Anomalocaridid force-pushed the override-gtk-priority branch 7 times, most recently from 5ad5c53 to 7101da2 Compare January 17, 2025 23:13
ignis/app.py Outdated Show resolved Hide resolved
@linkfrg
Copy link
Owner

linkfrg commented Jan 21, 2025

I was thinking, what is the point of IgnisApp.style_priority?
BaseWidget now implements the style_priority property on its own side, a custom style priority can be passed directly to IgnisApp.apply_css().
So, it would be better to remove IgnisApp.style_priority and set the default value of the argument style_priority in apply_css() to "application".

@Anomalocaridid
Copy link
Contributor Author

Removed IgnisApp.style_priority

I think the only thing would be that it would allow setting the priority for both the global style and the widgets at once, but now that you mention it, I doubt that would be better than explicitly setting it where it is needed.

@linkfrg
Copy link
Owner

linkfrg commented Jan 21, 2025

Removed IgnisApp.style_priority

I think the only thing would be that it would allow setting the priority for both the global style and the widgets at once, but now that you mention it, I doubt that would be better than explicitly setting it where it is needed.

Hmm, wait. I didn't think about the global style priority for all widgets, sorry.
E.g., If you use "user" priority in IgnisApp.apply_css(), then this priority will be applied only for the style from style.scss.
Widgets will still use "applications" style priority and you will have to change each widget style priority to "user".
So, let's keep IgnisApp.style_priority, but just rename it to IgnisApp.widgets_style_priority for clarity.
IgnisApp.global_style_priority shouldn't affect apply_css(), leave this function as is.

@Anomalocaridid
Copy link
Contributor Author

Reverted. Thank goodness for git's reflog.

Hmm, wait. I didn't think about the global style priority for all widgets, sorry.

It's alright. If anything, I share at least partial blame for jumping the gun a bit.

@Anomalocaridid
Copy link
Contributor Author

Sorry I just realized I entirely missed the part were you were asking for changes past reverting removing IgnisApp.style_priority

So, let's keep IgnisApp.style_priority, but just rename it to IgnisApp.widgets_style_priority for clarity.
IgnisApp.global_style_priority shouldn't affect apply_css(), leave this function as is.

Just to be clear, if I understand correctly, I should rename IgnisApp.style_priority to IgnisApp.widgets_style_priority and add another property named IgnisApp.global_style_priority that does not affect apply_css()? Is that the only difference between the two?

@linkfrg
Copy link
Owner

linkfrg commented Jan 23, 2025

Okay, I will do rest of stuff by myself

Copy link
Owner

@linkfrg linkfrg left a comment

Choose a reason for hiding this comment

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

thanks!

@linkfrg linkfrg merged commit d3a63c0 into linkfrg:main Jan 24, 2025
3 checks passed
@Anomalocaridid
Copy link
Contributor Author

Thank you!

@Anomalocaridid Anomalocaridid deleted the override-gtk-priority branch January 24, 2025 17:44
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