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

Made the live gtk reload more robust. #202

Merged
merged 3 commits into from
Jul 20, 2020

Conversation

rahatzamancse
Copy link
Contributor

As I said in #112 , the code now expects the user to use Flatcolor theme. And if reload GTK+ is enabled, it sets the theme to Flatcolor without even checking if the theme is installed or not. This makes the GTK live reloading kind of broken.

So I am proposing in this PR to do the following for live refreshing GTK apps.

  1. If using gnome-settings-daemon.
    • If it is running, then we dont need the optional dependency xsettingsd installed and still can update the theme with just refreshing the gsettings (with the users theme even if Flatcolor is not installed)
  2. If their is no settings daemon running:
    • This means GTK apps are not getting the themes info from dconf. They may get the theme from ~/.config/gtk-3.0/settings.ini as said in case of lxappearance or other GTK theme managers.
    • So we parse the theme from those files and refresh them with xsettingsd.
  3. If there is no GTK config file and no gtk-theme key in dconf, that means there is no themes set (Default Adwaita might be using) (I am not 100% sure if this case is possible, still won't hurt to leave an else clause :) )
    • In this case, we can change the theme to Flatcolor. In the commit, I did not handle if Flatcolor is not installed.
      • In this case, we can suggest the user to install Flatcolor theme from GUI etc.

A video demonstration here.

Don't know why this issue #174 is closed, but it should be fixed with this I guess.

Also this PR automates exactly what you said in this issue #143 :

If you haven't yet, you might find some help here #112, in this issue it is detailed how to do it with the gnome-settings-daemon directly, maybe that won't give you an issue, please re-open this issue if you still have an issue using wpgtk

N.B: I am new to GTK theming. So please review thoroughly.

@jasperro
Copy link
Contributor

It works for me very well, I don't use xsettingsd or gnome but swaywm. Everything reloads quicker and less hacky. This fixes the issues with the gtk3 reloading very well. Nicely done.

@rahatzamancse
Copy link
Contributor Author

Thanks a lot for this quick response. As I am going to make wpgtk my main dots driver, I am willing to contribute more (if I have time).
EDIT: I accidentally closed the PR. Sorry for that (reopened it)

Copy link
Owner

@deviantfero deviantfero left a comment

Choose a reason for hiding this comment

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

I've added a few comments, we can merge after these, I'll do some code cleanup and release a new minor version after this, I like these changes!

wpgtk/data/reload.py Outdated Show resolved Hide resolved
wpgtk/data/reload.py Outdated Show resolved Hide resolved
wpgtk/data/reload.py Outdated Show resolved Hide resolved
@rahatzamancse
Copy link
Contributor Author

Change requests done.

@rahatzamancse
Copy link
Contributor Author

I just added xfsettingsd support to this branch. It was very easy though. Please have a look.

@deviantfero
Copy link
Owner

LGTM, I'll probably clean up the code and release a new version soon

@deviantfero deviantfero merged commit b67e613 into deviantfero:master Jul 20, 2020
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