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

Adding css reloader #2852

Merged
merged 6 commits into from
Jan 29, 2024
Merged

Adding css reloader #2852

merged 6 commits into from
Jan 29, 2024

Conversation

dpayne
Copy link
Contributor

@dpayne dpayne commented Jan 22, 2024

This adds a css file watcher that reloads the style if the css files change.

A common use case is changing the colors of waybar using pywal. I wanted to make the change seamless, a full reset causes hyprland to briefly change window sizes since the gtk window is destroyed and recreated. Reloading only the style avoids that issue.

@alebastr
Copy link
Contributor

The code changes the global GTK app state from a thread, which is not safe.
It also creates an inotify instance; that is a limited resource, and Waybar already creates way too many :(

Have you considered using Gio::FileMonitor or the underlying g_file_monitor instead? That would address both points.

Also, please consider adding a flag to disable the file watcher or even make it opt-in.

@dpayne
Copy link
Contributor Author

dpayne commented Jan 22, 2024

Updated with the changes suggested above.

@Alexays
Copy link
Owner

Alexays commented Jan 25, 2024

LGTM, thx to both of you!
Can you add this new option to the man and github wiki? 🙏

@dpayne
Copy link
Contributor Author

dpayne commented Jan 28, 2024

I added the man page entry and edited the wiki.

@Alexays
Copy link
Owner

Alexays commented Jan 28, 2024

Can you check the CI, freebsd seems to fail @dpayne

* Fixing missing includes
* Fixing formatting
@dpayne
Copy link
Contributor Author

dpayne commented Jan 29, 2024

I believe I fixed the compilation error in freebsd, it was an issue with a missing import that only errors out on clang. I do not know why it hung after. It did seem to compile, this is from the workflow logs

[338/339] Compiling C++ object test/waybar_test.p/.._src_util_css_reload_helper.cpp.o
[339/339] Linking target test/waybar_test
1/1 waybar / waybar OK              0.12s

Ok:                 1   
Expected Fail:      0   
Fail:               0   
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0   ```

@Alexays
Copy link
Owner

Alexays commented Jan 29, 2024

LGTM, thx!
CI will rerun on master and timeout should be good

@Alexays Alexays merged commit 1dce607 into Alexays:master Jan 29, 2024
6 of 9 checks passed
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.

None yet

3 participants