You are not logged in.
I want to change to dark or to light theme from a running Xorg session (via console or GUI), i.e. without re-log in (rebooting).
I read these:
- https://wiki.archlinux.org/title/Dark_m … g#top-page
- https://wiki.archlinux.org/title/GTK#Themes
I tried setting GTK_THEME in .xinitrc (export GTK_THEME) and it works only if I re-login. I tried to edit $HOME/.config/gtk-3.0/settings.ini . But I could only change to dark mode when I relogin and my environment variable for all applications I start is changed. I start applications via hotkeys set inside i3 config (.config/i3/config) or via launcher.
I tried darkman and yin-yang but they didn't work for me.
❯ uname -a
Linux ARCHPC 6.3.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 21 Jun 2023 20:46:20 +0000 x86_64 GNU/Linux
❯ cat .xinitrc
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec /usr/bin/i3
❯ cat $HOME/.config/gtk-3.0/settings.ini
[Settings]
gtk-theme-name=Adwaita
gtk-icon-theme-name=Adwaita
gtk-font-name=Cantarell 11
gtk-cursor-theme-name=Bibata-Original-Classic
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
❯ sudo pacman -Q | grep 'xfce\|gtk'
gtk-update-icon-cache 1:4.10.4-1
gtk2 2.24.33-3
gtk3 1:3.24.38-1
gtkmm3 3.24.7-1
gtksourceview3 1:3.24.11+r28+g73e57b57-1
gtksourceview4 4.8.4-1
libappindicator-gtk2 12.10.0.r298-2
libappindicator-gtk3 12.10.0.r298-2
libdbusmenu-gtk2 16.04.0.r498-1
libdbusmenu-gtk3 16.04.0.r498-1
libindicator-gtk2 12.10.1-10
libindicator-gtk3 12.10.1-10
libxfce4ui 4.18.4-1
libxfce4util 4.18.1-1
webkit2gtk 2.40.2-1
webkit2gtk-4.1 2.40.2-1
wxwidgets-gtk3 3.2.2.1-1
xfce4-appfinder 4.18.0-1
xfce4-artwork 0.1.1a_git20110420-6
xfce4-battery-plugin 1.1.5-1
xfce4-clipman-plugin 1.6.3-1
xfce4-cpufreq-plugin 1.2.8-1
xfce4-cpugraph-plugin 1.2.7-1
xfce4-datetime-plugin 0.8.3-1
xfce4-dict 0.8.5-1
xfce4-diskperf-plugin 2.7.0-1
xfce4-eyes-plugin 4.6.0-1
xfce4-fsguard-plugin 1.1.3-1
xfce4-genmon-plugin 4.2.0-1
xfce4-mailwatch-plugin 1.3.1-1
xfce4-mount-plugin 1.1.6-1
xfce4-mpc-plugin 0.5.3-1
xfce4-netload-plugin 1.4.1-1
xfce4-notes-plugin 1.10.0-1
xfce4-notifyd 0.8.2-1
xfce4-panel 4.18.4-1
xfce4-power-manager 4.18.2-1
xfce4-pulseaudio-plugin 0.4.7-1
xfce4-screensaver 4.18.2-1
xfce4-screenshooter 1.10.4-1
xfce4-sensors-plugin 1.4.4-1
xfce4-session 4.18.3-1
xfce4-settings 4.18.2-1
xfce4-smartbookmark-plugin 0.5.2-1
xfce4-systemload-plugin 1.3.2-1
xfce4-taskmanager 1.5.5-1
xfce4-terminal 1.0.4-1
xfce4-time-out-plugin 1.1.3-1
xfce4-timer-plugin 1.7.2-1
xfce4-verve-plugin 2.0.1-1
xfce4-wavelan-plugin 0.6.3-1
xfce4-weather-plugin 0.11.1-1
xfce4-whiskermenu-plugin 2.7.3-1
xfce4-xkb-plugin 0.8.3-1Last edited by art (2023-07-01 11:56:31)
Offline
You'll need to restart applications at the minimum and then potentially wrap all your hotkeys in a wrapper script so they export GTK_THEME appropriately when starting an application.
Offline
You'll need to restart applications at the minimum and then potentially wrap all your hotkeys in a wrapper script so they export GTK_THEME appropriately when starting an application.
So GTK doesn't read its settings from that .ini file, then. Strange, that the only way is via `export GTK_THEME=...` . OK, I will figure something out to set it for my hotkeys. Thanks for the answer
Offline
https://wiki.archlinux.org/title/GTK#Themes
https://wiki.archlinux.org/title/GTK#Configuration
I start applications via hotkeys set inside i3 config (.config/i3/config) or via launcher.
What most likely happens is that you've exported *some* $GTK_THEME (eg. through your xinitrc) to i3wm, the environment then gets inherited by all spwaned processes (your shell and stuff you launch w/ a hotkey) and the environment takes precedence over the settings.ini
tr '\0' '\n' < /proc/$(pidof i3)/environ | grep GTKYou need to either alter the environment variable in the parenting process (idk i3 allows for that) or make sure there's no such environment variable set to pick up the theme from the setting.
Offline
https://wiki.archlinux.org/title/GTK#Themes
https://wiki.archlinux.org/title/GTK#ConfigurationI start applications via hotkeys set inside i3 config (.config/i3/config) or via launcher.
What most likely happens is that you've exported *some* $GTK_THEME (eg. through your xinitrc) to i3wm, the environment then gets inherited by all spwaned processes (your shell and stuff you launch w/ a hotkey) and the environment takes precedence over the settings.ini
tr '\0' '\n' < /proc/$(pidof i3)/environ | grep GTKYou need to either alter the environment variable in the parenting process (idk i3 allows for that) or make sure there's no such environment variable set to pick up the theme from the setting.
Yes, it worked, thank you! I removed GTK_THEME variable from ".xinit" file. Then modified theme in "settings.ini" file. And gtk apps seems to follow the setting from settings.ini.
Offline