You are not logged in.

#1 2017-04-26 02:41:13

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

[Solved] GTK3 apps ignoring theme in wayland/sway

On X11/i3, my gtk3 apps use the Arc them fine, but on wayland/sway, they all use the default theme for some reason.

The only thing relevant I can think of it my settings file:

$ cat .config/gtk-3.0/settings.ini 
[Settings]
gtk-theme-name = Arc-Darker
gtk-icon-theme-name = Arc
gtk-fallback-icon-theme = gnome
gtk-font-name = Ubuntu 10
gtk-menu-images = true

# "disables" recent files entries
gtk-recent-files-max-age=0
gtk-recent-files-limit=0

gtk-dialogs-use-header = false
gtk-windows-use-header = false

Any ideas? Any hints? Any idea where I might follow up on this?

Last edited by hobarrera (2020-02-25 13:57:50)

Offline

#2 2019-08-28 15:22:54

C-Ren
Member
Registered: 2019-03-21
Posts: 19

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

It looks like you're experiencing this issue which is due to an incompatibility between sway and GTK+3. The page I linked has some workarounds.

Offline

#3 2020-02-20 10:30:24

Jrballesteros05
Member
From: Valledupar - Colombia
Registered: 2009-07-15
Posts: 16
Website

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

I don't know if I have to open a new thread but I am also experimenting this issue. I tried the workarounds from https://github.com/swaywm/sway/wiki/GTK … n-Wayland/ but it did not work.

When I open dconf-editor or any GTK3 app in Weston it opens properly but it does not on Sway and Plasma-Wayland.

Best regards.


Archlinux Colombia!!! smile

Offline

#4 2020-02-20 20:36:16

themax
Member
Registered: 2013-05-14
Posts: 32

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

Have you tried setting the environment variable GTK_THEME=Arc-Darker ?
I personally use GTK_THEME=Adwaita:dark

Offline

#5 2020-02-21 07:20:59

Jrballesteros05
Member
From: Valledupar - Colombia
Registered: 2009-07-15
Posts: 16
Website

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

themax wrote:

Have you tried setting the environment variable GTK_THEME=Arc-Darker ?
I personally use GTK_THEME=Adwaita:dark

Hello,

Firstable thanks for your help.

Yes, I tried in the past and the environment works but the big problem are the fonts, it looks so ugly. I open any app in Weston and it looks fine but when I open in Plasma or Sway it doesn't and I cannot figure out what is going on sad sad

I also tried changing themes temporally with "dconf-editor" but It does not work sad


Archlinux Colombia!!! smile

Offline

#6 2020-02-21 13:27:43

Jrballesteros05
Member
From: Valledupar - Colombia
Registered: 2009-07-15
Posts: 16
Website

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

I actually have this problem:

https://github.com/flatpak/flatpak/issues/2861

But in my case it happens with any GTK3 app sad


Archlinux Colombia!!! smile

Offline

#7 2020-02-23 10:02:21

Jrballesteros05
Member
From: Valledupar - Colombia
Registered: 2009-07-15
Posts: 16
Website

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

Hello again, I could finally solved the problem. I accept that I made a mistake but I will post the solution anyway in order to anybody else don't make the same mistake as I did.

As @C-Ren said the solution is here but I tried again and again on the same solution without reading anything else. I edited the sway configuration file with this:

set $gnome-schema org.gnome.desktop.interface

exec_always {
    gsettings set $gnome-schema gtk-theme 'Your theme'
    gsettings set $gnome-schema icon-theme 'Your icon theme'
    gsettings set $gnome-schema cursor-theme 'Your cursor Theme'
}

There is a BUG with that solution, posted here and here and that's why Sway could not apply the changes.

So I finally decided to apply the other solution which consist in creating a script called "import-gsettings" with this content:

#!/bin/sh

# usage: import-gsettings <gsettings key>:<settings.ini key> <gsettings key>:<settings.ini key> ...

expression=""
for pair in "$@"; do
    IFS=:; set -- $pair
    expressions="$expressions -e 's:^$2=(.*)$:gsettings set org.gnome.desktop.interface $1 \1:e'"
done
IFS=
eval exec sed -E $expressions "${XDG_CONFIG_HOME:-$HOME/.config}"/gtk-3.0/settings.ini >/dev/null

And edit the Sway config file with this:

exec_always import-gsettings \
    gtk-theme:gtk-theme-name \
    icon-theme:gtk-icon-theme-name \
    cursor-theme:gtk-cursor-theme-name

That's worked for me. I hope this help anybody else.

Best regards.


Archlinux Colombia!!! smile

Offline

#8 2020-02-25 13:58:04

hobarrera
Member
From: The Netherlands
Registered: 2011-04-12
Posts: 355
Website

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

Feedback here was spot on. It works perfect now, thanks!

Offline

#9 2020-12-30 10:54:17

teXnican
Member
Registered: 2018-09-21
Posts: 28

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

I copied your code, but the settings are still ignored for me (tried with Thunar):

$ cat /home/xenon/.config/sway/scripts/import-gsettings.sh
#!/bin/sh

# usage: import-gsettings.sh <gsettings key>:<settings.ini key> <gsettings key>:<settings.ini key> ...

expression=""
for pair in "$@"; do
    IFS=:; set -- $pair
    expressions="$expressions -e 's:^$2=(.*)$:gsettings set org.gnome.desktop.interface $1 \1:e'"
done
IFS=
eval exec sed -E $expressions "${XDG_CONFIG_HOME:-$HOME/.config}"/gtk-3.0/settings.ini >/dev/null
$ cat .config/sway/config
...
# Load GTK options from settings.ini
exec_always ~/.config/sway/scripts/import-gsettings.sh \
    gtk-theme:gtk-theme-name \
    icon-theme:gtk-icon-theme-name \
    cursor-theme:gtk-cursor-theme-name
...
$ cat /home/xenon/.config/gtk-3.0/settings.ini
[Settings]
gtk-theme-name = Adwaita-dark
gtk-icon-theme-name = Adwaita
gtk-font-name = Monospace 11

Any idea why?

Offline

#10 2020-12-30 11:56:17

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

teXnican wrote:

I copied your code, but the settings are still ignored for me (tried with Thunar):

Maybe Thunar uses GTK2? Afaik you could also set gtk options in .bashrc (inside home folder).

Last edited by equalizer876 (2020-12-30 11:59:42)

Offline

#11 2020-12-30 12:29:50

teXnican
Member
Registered: 2018-09-21
Posts: 28

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

No, not anymore, it's been ported to GTK3 a while ago.

As per the Wiki entry the very presence of the settings.ini should suffice to have the settings applied, but it's not the case.

Offline

#12 2020-12-30 13:39:11

teXnican
Member
Registered: 2018-09-21
Posts: 28

Re: [Solved] GTK3 apps ignoring theme in wayland/sway

Actually, the setup as described in the GTK Wiki entry is working as expected for *all* my GTK applications *except* Thunar, which accepts the color scheme, but ignores the font. This could be fixed by defining a gtk.css in ~/.config/gtk-3.0 as described here.

Last edited by teXnican (2020-12-30 13:42:27)

Offline

Board footer

Powered by FluxBB