fix: sync GTK/Qt themes on session start, follow GTK-3 in Qt, and keep anode-lock above systray

This commit is contained in:
Luxferre committed 2026-11-26 16:21:03 +02:00
1 parent 0d8b7994bc
commit c4bee91e6b
11 files changed
+352 -25

No files matched your search

+47 -7
View File
@@ -4,6 +4,7 @@
set -eu
: "${XDG_CONFIG_HOME:=$HOME/.config}"
: "${XDG_DATA_HOME:=$HOME/.local/share}"
XRES="${1:-$HOME/.Xresources}"
if [ ! -r "$XRES" ]; then
@@ -127,15 +128,40 @@ GTK_CUR_SZ="$9"
GTK_FONT="$FONT_FACE $GTK_PT"
# 1. GTK-2 theme & ~/.gtkrc-2.0
GTK2_DIR="$HOME/.themes/$THEME_ID/gtk-2.0"
# 1. GTK-2 theme, metadata, XDG theme symlink & ~/.gtkrc-2.0
THEME_ROOT="$HOME/.themes/$THEME_ID"
GTK2_DIR="$THEME_ROOT/gtk-2.0"
mkdir -p "$GTK2_DIR"
cat > "$THEME_ROOT/index.theme.tmp.$$" <<EOF
[Desktop Entry]
Type=X-GNOME-Metatheme
Name=$THEME_ID
Comment=ANODE generated GTK theme ($TNAME)
Encoding=UTF-8
[X-GNOME-Metatheme]
GtkTheme=$THEME_ID
IconTheme=$ICON_THEME
EOF
mv -f "$THEME_ROOT/index.theme.tmp.$$" "$THEME_ROOT/index.theme"
mkdir -p "$XDG_DATA_HOME/themes"
if [ -L "$XDG_DATA_HOME/themes/$THEME_ID" ] || [ ! -e "$XDG_DATA_HOME/themes/$THEME_ID" ]; then
rm -f "$XDG_DATA_HOME/themes/$THEME_ID"
ln -s "$THEME_ROOT" "$XDG_DATA_HOME/themes/$THEME_ID"
fi
cat > "$GTK2_DIR/gtkrc.tmp.$$" <<EOF
# ANODE GTK-2 theme ($THEME_ID)
gtk-color-scheme = "bg_color:$BG_MAIN\nfg_color:$FG_MAIN\nbase_color:$BG_INPUT\ntext_color:$FG_BRIGHT\nselected_bg_color:$SEL_BG\nselected_fg_color:$SEL_FG\ntooltip_bg_color:$BG_OVERLAY\ntooltip_fg_color:$FG_BRIGHT"
style "anode-default" {
xthickness = 2
ythickness = 2
GtkButton::inner-border = { 4, 4, 2, 2 }
GtkEntry::inner-border = { 4, 4, 3, 3 }
GtkCheckButton::indicator-size = 14
GtkMenuItem::toggle-spacing = 6
GtkMenuItem::arrow-scaling = 0.5
bg[NORMAL] = "$BG_MAIN"
bg[PRELIGHT] = "$BG_BUTTON"
bg[ACTIVE] = "$BG_HEADER"
@@ -157,16 +183,17 @@ style "anode-default" {
text[SELECTED] = "$SEL_FG"
text[INSENSITIVE] = "$FG_MUTED"
}
style "anode-menu" {
style "anode-menu" = "anode-default" {
xthickness = 4
ythickness = 4
GtkMenu::horizontal-padding = 2
GtkMenu::vertical-padding = 4
GtkMenuItem::horizontal-padding = 6
GtkMenuItem::horizontal-padding = 8
GtkMenuBar::internal-padding = 2
}
class "GtkWidget" style "anode-default"
class "GtkMenu" style "anode-menu"
widget_class "*<GtkMenu>*" style "anode-menu"
widget_class "*<GtkMenuItem>*" style "anode-menu"
EOF
mv -f "$GTK2_DIR/gtkrc.tmp.$$" "$GTK2_DIR/gtkrc"
@@ -266,15 +293,20 @@ headerbar, .titlebar, menubar, toolbar {
border-color: $DIVIDER;
}
menu, .menu, .context-menu, popover, popover.background {
menu, .menu, .context-menu, popover, popover.background,
popover.background > contents, popover.menu > arrow, popover.menu.background > contents {
background-color: $BG_OVERLAY;
color: $FG_MAIN;
border-color: $BORDER;
}
menu menuitem:hover, .menu menuitem:hover, menubar > menuitem:hover, popover modelbutton:hover {
menu menuitem:hover, .menu menuitem:hover, menubar > menuitem:hover,
popover modelbutton:hover, popover.menu modelbutton:hover, modelbutton.flat:hover {
background-color: $SEL_BG;
color: $SEL_FG;
}
menu separator, .menu separator, .context-menu separator {
background-color: $DIVIDER;
}
button:not(.flat) {
background-color: $BG_BUTTON;
@@ -295,6 +327,7 @@ button:not(.flat):checked, button:not(.flat):active, button.suggested-action {
button.flat:not(:hover):not(:checked):not(:active) {
background-color: transparent;
background-image: none;
color: $FG_MAIN;
border-color: transparent;
}
@@ -417,6 +450,13 @@ inactive_colors=$_inact
EOF
mv -f "${_pal}.tmp.$$" "$_pal"
_qt_style="Fusion"
if [ "$_ver" = "5" ]; then
if [ -r /usr/lib/qt5/plugins/styles/libqgtk2style.so ] || [ -r /usr/lib64/qt5/plugins/styles/libqgtk2style.so ]; then
_qt_style="gtk2"
fi
fi
_qconf="$_qdir/qt${_ver}ct.conf"
cat > "${_qconf}.tmp.$$" <<EOF
[Appearance]
@@ -424,7 +464,7 @@ color_scheme_path=$_pal
custom_palette=true
icon_theme=$ICON_THEME
standard_dialogs=gtk3
style=Fusion
style=$_qt_style
[Fonts]
fixed="$FONT_FACE,$GTK_PT,-1,5,50,0,0,0,0,0"