InioX / matugen

A material you color generation tool
GNU General Public License v2.0
328 stars 16 forks source link

Question - Reloading GTK #128

Open RedJ1ve opened 4 days ago

RedJ1ve commented 4 days ago

Hi, this is more of a question, but since the option to reload GTK is gone, i assume you need to use hooks to do this instead, but how is this done on Wayland?

paridhi089 commented 4 days ago

I generated the colors.CSS for GTK themes. Do you have to reload it or something? because it is not applying for me.

NotMephisto commented 4 days ago

I generated the colors.CSS for GTK themes. Do you have to reload it or something?

I think RedJ1ve means that applications using GTK library change interface colors in real time, but it is impossible, because gtk draws the interface before launching the application, storing it something like a cache, and draws it taking information from the cache.

paridhi089 commented 4 days ago

I generated the colors.CSS for GTK themes. Do you have to reload it or something?

I think RedJ1ve means that applications using GTK library change interface colors in real time, but it is impossible, because gtk draws the interface before launching the application, storing it something like a cache, and draws it taking information from the cache.

Mine doesn't work either way. My colors.CSS is generated successfully and even after restarted the apps, the GTK theme is not set.

NotMephisto commented 4 days ago

because it is not applying for me.

How did you try to apply colors from matugen to gtk?

Have you looked here for information about this and have you installed the adwaita theme? https://github.com/InioX/matugen-themes

paridhi089 commented 4 days ago

because it is not applying for me.

How did you try to apply colors from matugen to gtk?

Have you looked here for information about this and have you installed the adwaita theme? https://github.com/InioX/matugen-themes

Theme is set as machiato. It guess that's the issue. It will try and check it out.

paridhi089 commented 4 days ago

because it is not applying for me.

How did you try to apply colors from matugen to gtk?

Have you looked here for information about this and have you installed the adwaita theme? https://github.com/InioX/matugen-themes

Can't seem to find Adwaita theme for arch.

NotMephisto commented 4 days ago

Try to search adw-gtk-theme in arch repo

paridhi089 commented 4 days ago

Try to search adw-gtk-theme in arch repo

I found in gnome-theme-extra. But it's still not setting the color

NotMephisto commented 4 days ago

Use this package for installing Adwaita theme:

https://archlinux.org/packages/extra/any/adw-gtk-theme/

After installing package run this command:

gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita'

paridhi089 commented 4 days ago

Did some more testing. Nautilus is taking the colours. But memory and thunar are not.

RedJ1ve commented 3 days ago

I generated the colors.CSS for GTK themes. Do you have to reload it or something?

I think RedJ1ve means that applications using GTK library change interface colors in real time, but it is impossible, because gtk draws the interface before launching the application, storing it something like a cache, and draws it taking information from the cache.

I might be misunderstanding, but I'm pretty sure you can sort of live reload GTK by automatically reload the apps, so the new theme is set. Matugen used to do this automatically in version 2.2.0 I think, but the functionality was removed and replaced with hooks.

NotMephisto commented 3 days ago

I might be misunderstanding, but I'm pretty sure you can sort of live reload GTK by automatically reload the apps, so the new theme is set. Matugen used to do this automatically in version 2.2.0 I think, but the functionality was removed and replaced with hooks.

In that case you could reload GTK by closing apps, but it's not the same as dynamic changes theme in GNOME like changing theme from light to dark and ect. (You just reopen app and re-rend gtk interface for app)

ys5g commented 3 days ago

(replying to OP) You can add this to [templates.gtk3] or [templates.gtk4] (whichever one comes last)

post_hook = "gsettings set org.gnome.desktop.interface gtk-theme ''; gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3-{{mode}}"

This does exactly what reload_apps.gtk(or whatever that was lol) did, so the results should be identical.

NotMephisto commented 3 days ago

(replying to OP) You can add this to [templates.gtk3] or [templates.gtk4] (whichever one comes last)

post_hook = "gsettings set org.gnome.desktop.interface gtk-theme ''; gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3-{{mode}}"

This does exactly what reload_apps.gtk(or whatever that was lol) did, so the results should be identical.

Unfortunately that doesn't work either, tried that option, no luck :c

paridhi089 commented 2 days ago

Not working for me either. I think we are missing something with GTK. I reopened the apps and did the gsettings thing, switch to Adwaita. It only ended up theming Nautilus but not thunar or nemo

NotMephisto commented 2 days ago

Not working for me either. I think we are missing something with GTK. I reopened the apps and did the gsettings thing, switch to Adwaita. It only ended up theming Nautilus but not thunar or nemo

Sorry for my mistake

Instead of Adwaita, you should have put adw-gtk3

gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'

paridhi089 commented 1 day ago

Still not working

paridhi089 commented 1 day ago

in gtk.css i set

*{
  background: @window_bg_color;
} 

this seems to have set the background color. I will have to find other properties and set other colors as well.

NotMephisto commented 1 day ago

in gtk.css i set

*{
  background: @window_bg_color;
} 

this seems to have set the background color. I will have to find other properties and set other colors as well.

Is it all you have in gtk.css? If you want to organize dynamic variables with @variable you should import file where @variable exists

For example:

matugen-colors.css:

*{
   @define-color window_bg_color {{ color.background.dark.hex}} ; 
}

gtk.css:

@import '/home/user/matugen-colors.css'

*{
  background: @window_bg_color;
} 

If you want to organize it through matugen just add template.gtk in config.toml and see how to do it right on wiki

ys5g commented 1 day ago

Unfortunately that doesn't work either, tried that option, no luck :c

I tested it and live-reloading also didn't work for me. But it also looks like matugen 2.3.0 didn't live reload either? Just for the record, changing the theme with gsettings works, as does changing org.gnome.desktop.interface.color-scheme

Did matugen 2.3.0 properly reload gtk apps for you guys?

NotMephisto commented 1 day ago

But it also looks like matugen 2.3.0 didn't live reload either?

You mean live-reloading gtk interface? If that's what you mean, yes

Just for the record, changing the theme with gsettings works, as does changing org.gnome.desktop.interface.color-scheme

I had checked it multiply time and theme isn't "retaking" new colors from css file in my tests. Could you please explain more details about it?

ys5g commented 1 day ago

You mean live-reloading gtk interface?

Yes

I had checked it multiple times and theme isn't "retaking" new colors from css file in my tests. Could you please explain more details about it?

We're on the same page. gsettings(at least on Hyprland with both the hyprland and gtk xdg portals) can be used to change the actual theme, but not for making gtk apps apply changes in $XDG_CONFIG_HOME/gtk-{version}/colors.css

(original post)

[...]but since the option to reload GTK is gone, i assume you need to use hooks to do this instead, but how is this done on Wayland?

If the problem also existed in matugen 2.3.0, then this issue doesn't really have anything to do with config.reload_apps being removed.