530 lines
16 KiB
Bash
Executable File
530 lines
16 KiB
Bash
Executable File
#!/bin/sh
|
|
# ANODE multi-toolkit theme & fractional-DPI synchronizer (strict POSIX sh)
|
|
# Syncs GTK2, GTK3, GTK4/libadwaita, xsettingsd, Qt5 (qt5ct), Qt6 (qt6ct), and Kvantum.
|
|
set -eu
|
|
|
|
: "${XDG_CONFIG_HOME:=$HOME/.config}"
|
|
: "${XDG_DATA_HOME:=$HOME/.local/share}"
|
|
XRES="${1:-$HOME/.Xresources}"
|
|
|
|
if [ ! -r "$XRES" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
xres_get() {
|
|
_k="$1"
|
|
_def="$2"
|
|
_val="$(awk -v key="$_k" '
|
|
{
|
|
s = $0
|
|
gsub(/^[ \t\r]+|[ \t\r]+$/, "", s)
|
|
if (s == "" || substr(s, 1, 1) == "!" || substr(s, 1, 1) == "#") next
|
|
p = index(s, ":")
|
|
if (p > 0) {
|
|
k = substr(s, 1, p - 1)
|
|
gsub(/^[ \t]+|[ \t]+$/, "", k)
|
|
if (k == key) {
|
|
v = substr(s, p + 1)
|
|
gsub(/^[ \t]+|[ \t]+$/, "", v)
|
|
print v
|
|
exit
|
|
}
|
|
}
|
|
}
|
|
' "$XRES" 2>/dev/null || true)"
|
|
if [ -n "$_val" ]; then
|
|
printf '%s\n' "$_val"
|
|
else
|
|
printf '%s\n' "$_def"
|
|
fi
|
|
}
|
|
|
|
TNAME="$(xres_get theme.name "AnodeDefault")"
|
|
DARK="$(xres_get theme.isDark "")"
|
|
FONT_FACE="$(xres_get theme.fontFace "Fira Code")"
|
|
BASE_SZ="$(xres_get theme.baseFontSize "15")"
|
|
SCALE="$(xres_get theme.scale "1.00")"
|
|
CUR_SZ="$(xres_get Xcursor.size "24")"
|
|
ICON_THEME="$(xres_get theme.iconTheme "Adwaita")"
|
|
|
|
BG_MAIN="$(xres_get theme.bgMain "#0b0e14")"
|
|
BG_BAR="$(xres_get theme.bgBar "#11161f")"
|
|
BG_HEADER="$(xres_get theme.bgHeader "#141a24")"
|
|
BG_FOOTER="$(xres_get theme.bgFooter "#0f141d")"
|
|
BG_OVERLAY="$(xres_get theme.bgOverlay "#192231")"
|
|
BG_ALT_EVEN="$(xres_get theme.bgAltEven "#131923")"
|
|
BG_ALT_ODD="$(xres_get theme.bgAltOdd "#171f2b")"
|
|
BG_INPUT="$(xres_get theme.bgInput "#1a2330")"
|
|
BG_INPUT_FOC="$(xres_get theme.bgInputFocus "#202c3d")"
|
|
BG_BUTTON="$(xres_get theme.bgButton "#1e2838")"
|
|
BG_SEARCH="$(xres_get theme.bgSearch "#1b2433")"
|
|
FG_MAIN="$(xres_get theme.fgMain "#e6e1cf")"
|
|
FG_BRIGHT="$(xres_get theme.fgBright "#ffffff")"
|
|
FG_MUTED="$(xres_get theme.fgMuted "#8693a6")"
|
|
SEL_BG="$(xres_get theme.selBg "#2b5278")"
|
|
SEL_FG="$(xres_get theme.selFg "#ffffff")"
|
|
ACCENT="$(xres_get theme.accent "#59c2ff")"
|
|
ACCENT_ALT="$(xres_get theme.accentAlt "#73d0ff")"
|
|
HIGHLIGHT="$(xres_get theme.highlight "#ffd173")"
|
|
BORDER="$(xres_get theme.border "#283444")"
|
|
DIVIDER="$(xres_get theme.divider "#1e2736")"
|
|
SUCCESS="$(xres_get theme.success "#7fd962")"
|
|
WARNING="$(xres_get theme.warning "#ffb454")"
|
|
DANGER="$(xres_get theme.danger "#f07178")"
|
|
|
|
THEME_ID="ANODE-$TNAME"
|
|
|
|
CALC="$(awk -v s="$SCALE" -v bsz="$BASE_SZ" -v dark="$DARK" -v bg="$BG_MAIN" -v cur="$CUR_SZ" '
|
|
function hex_byte(h, hi, lo) {
|
|
hi = index("0123456789abcdef", substr(h, 1, 1)) - 1
|
|
lo = index("0123456789abcdef", substr(h, 2, 1)) - 1
|
|
if (hi < 0 || lo < 0) return -1
|
|
return hi * 16 + lo
|
|
}
|
|
function bg_is_dark(bghex, hs, r, g, b, lum) {
|
|
hs = tolower(bghex)
|
|
gsub(/^#/, "", hs)
|
|
if (length(hs) == 6) {
|
|
r = hex_byte(substr(hs, 1, 2))
|
|
g = hex_byte(substr(hs, 3, 2))
|
|
b = hex_byte(substr(hs, 5, 2))
|
|
if (r >= 0 && g >= 0 && b >= 0) {
|
|
lum = 0.299 * r + 0.587 * g + 0.114 * b
|
|
return (lum < 128.0) ? 1 : 0
|
|
}
|
|
}
|
|
return 1
|
|
}
|
|
BEGIN {
|
|
sc = s + 0.0
|
|
if (sc < 0.50) sc = 0.50
|
|
if (sc > 4.00) sc = 4.00
|
|
gdk_sc = (sc < 1.75) ? 1 : int(sc + 0.5)
|
|
logical_px = (bsz + 0.0) / sc
|
|
pt = int((logical_px * 0.65) + 0.5)
|
|
if (pt < 7) pt = 7
|
|
if (pt > 22) pt = 22
|
|
btn_pv = 3
|
|
btn_ph = 8
|
|
rad = 4
|
|
row_h = 24
|
|
sb_w = 8
|
|
if (dark == "1" || tolower(dark) == "true") is_d = 1
|
|
else if (dark == "0" || tolower(dark) == "false") is_d = 0
|
|
else is_d = bg_is_dark(bg)
|
|
gtk_cur = int(((cur + 0.0) / gdk_sc) + 0.5); if (gtk_cur < 16) gtk_cur = 16
|
|
printf "%d %d %d %d %d %d %d %d %d\n", gdk_sc, pt, btn_pv, btn_ph, rad, row_h, sb_w, is_d, gtk_cur
|
|
}')"
|
|
set -- $CALC
|
|
GDK_SCALE_VAL="$1"
|
|
GTK_PT="$2"
|
|
PAD_V="$3"
|
|
PAD_H="$4"
|
|
RAD_PX="$5"
|
|
ROW_H="$6"
|
|
SB_W="$7"
|
|
IS_DARK="$8"
|
|
GTK_CUR_SZ="$9"
|
|
|
|
GTK_FONT="$FONT_FACE $GTK_PT"
|
|
|
|
# 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"
|
|
bg[SELECTED] = "$SEL_BG"
|
|
bg[INSENSITIVE] = "$BG_ALT_EVEN"
|
|
fg[NORMAL] = "$FG_MAIN"
|
|
fg[PRELIGHT] = "$FG_BRIGHT"
|
|
fg[ACTIVE] = "$FG_BRIGHT"
|
|
fg[SELECTED] = "$SEL_FG"
|
|
fg[INSENSITIVE] = "$FG_MUTED"
|
|
base[NORMAL] = "$BG_INPUT"
|
|
base[PRELIGHT] = "$BG_INPUT_FOC"
|
|
base[ACTIVE] = "$SEL_BG"
|
|
base[SELECTED] = "$SEL_BG"
|
|
base[INSENSITIVE] = "$BG_ALT_EVEN"
|
|
text[NORMAL] = "$FG_BRIGHT"
|
|
text[PRELIGHT] = "$FG_BRIGHT"
|
|
text[ACTIVE] = "$SEL_FG"
|
|
text[SELECTED] = "$SEL_FG"
|
|
text[INSENSITIVE] = "$FG_MUTED"
|
|
}
|
|
style "anode-menu" = "anode-default" {
|
|
xthickness = 4
|
|
ythickness = 4
|
|
GtkMenu::horizontal-padding = 2
|
|
GtkMenu::vertical-padding = 4
|
|
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"
|
|
|
|
cat > "$HOME/.gtkrc-2.0.tmp.$$" <<EOF
|
|
# Managed by anode-sync-gtk-theme
|
|
gtk-theme-name="$THEME_ID"
|
|
gtk-icon-theme-name="$ICON_THEME"
|
|
gtk-font-name="$GTK_FONT"
|
|
gtk-cursor-theme-size=$CUR_SZ
|
|
include "$GTK2_DIR/gtkrc"
|
|
EOF
|
|
mv -f "$HOME/.gtkrc-2.0.tmp.$$" "$HOME/.gtkrc-2.0"
|
|
|
|
# 2. GTK-3 / GTK-4 / libadwaita CSS
|
|
GTK3_THEME_DIR="$HOME/.themes/$THEME_ID/gtk-3.0"
|
|
GTK4_THEME_DIR="$HOME/.themes/$THEME_ID/gtk-4.0"
|
|
GTK3_CONF_DIR="$XDG_CONFIG_HOME/gtk-3.0"
|
|
GTK4_CONF_DIR="$XDG_CONFIG_HOME/gtk-4.0"
|
|
mkdir -p "$GTK3_THEME_DIR" "$GTK4_THEME_DIR" "$GTK3_CONF_DIR" "$GTK4_CONF_DIR"
|
|
|
|
write_gtk_css() {
|
|
_dest="$1"
|
|
_is4="$2"
|
|
_user_override="$3"
|
|
_force_dark="$4"
|
|
_tmp="${_dest}.tmp.$$"
|
|
_use_dark="$IS_DARK"
|
|
if [ "$_force_dark" = "1" ]; then
|
|
_use_dark="1"
|
|
fi
|
|
: > "$_tmp"
|
|
if [ "$_user_override" = "0" ]; then
|
|
if [ "$_is4" = "1" ]; then
|
|
if [ "$_use_dark" = "1" ]; then
|
|
printf '@import url("resource:///org/gtk/libgtk/theme/Default/Default-dark.css");\n' > "$_tmp"
|
|
else
|
|
printf '@import url("resource:///org/gtk/libgtk/theme/Default/Default-light.css");\n' > "$_tmp"
|
|
fi
|
|
else
|
|
if [ "$_use_dark" = "1" ]; then
|
|
printf '@import url("resource:///org/gtk/libgtk/theme/Adwaita/gtk-contained-dark.css");\n' > "$_tmp"
|
|
else
|
|
printf '@import url("resource:///org/gtk/libgtk/theme/Adwaita/gtk-contained.css");\n' > "$_tmp"
|
|
fi
|
|
fi
|
|
fi
|
|
cat >> "$_tmp" <<EOF
|
|
/* ANODE GTK theme ($THEME_ID, scale=$SCALE) */
|
|
@define-color theme_bg_color $BG_MAIN;
|
|
@define-color theme_fg_color $FG_MAIN;
|
|
@define-color theme_base_color $BG_INPUT;
|
|
@define-color theme_text_color $FG_BRIGHT;
|
|
@define-color theme_selected_bg_color $SEL_BG;
|
|
@define-color theme_selected_fg_color $SEL_FG;
|
|
@define-color theme_unfocused_bg_color $BG_MAIN;
|
|
@define-color theme_unfocused_fg_color $FG_MUTED;
|
|
@define-color theme_unfocused_base_color $BG_ALT_EVEN;
|
|
@define-color theme_unfocused_text_color $FG_MAIN;
|
|
@define-color insensitive_bg_color $BG_ALT_EVEN;
|
|
@define-color insensitive_fg_color $FG_MUTED;
|
|
@define-color insensitive_base_color $BG_ALT_EVEN;
|
|
@define-color borders $BORDER;
|
|
@define-color unfocused_borders $DIVIDER;
|
|
@define-color accent_bg_color $SEL_BG;
|
|
@define-color accent_fg_color $SEL_FG;
|
|
@define-color accent_color $ACCENT;
|
|
@define-color window_bg_color $BG_MAIN;
|
|
@define-color window_fg_color $FG_MAIN;
|
|
@define-color view_bg_color $BG_ALT_EVEN;
|
|
@define-color view_fg_color $FG_MAIN;
|
|
@define-color headerbar_bg_color $BG_HEADER;
|
|
@define-color headerbar_fg_color $FG_BRIGHT;
|
|
@define-color card_bg_color $BG_OVERLAY;
|
|
@define-color card_fg_color $FG_MAIN;
|
|
@define-color dialog_bg_color $BG_OVERLAY;
|
|
@define-color dialog_fg_color $FG_MAIN;
|
|
@define-color popover_bg_color $BG_OVERLAY;
|
|
@define-color popover_fg_color $FG_MAIN;
|
|
@define-color content_view_bg $BG_ALT_EVEN;
|
|
@define-color text_view_bg $BG_INPUT;
|
|
@define-color success_color $SUCCESS;
|
|
@define-color warning_color $WARNING;
|
|
@define-color error_color $DANGER;
|
|
EOF
|
|
if [ "$_user_override" = "0" ]; then
|
|
cat >> "$_tmp" <<EOF
|
|
|
|
window, .background, messagedialog, dialog {
|
|
background-color: $BG_MAIN;
|
|
color: $FG_MAIN;
|
|
}
|
|
|
|
headerbar, .titlebar, menubar, toolbar {
|
|
background-color: $BG_HEADER;
|
|
color: $FG_BRIGHT;
|
|
border-color: $DIVIDER;
|
|
}
|
|
|
|
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, 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;
|
|
background-image: none;
|
|
color: $FG_BRIGHT;
|
|
border-color: $BORDER;
|
|
}
|
|
button:not(.flat):hover {
|
|
background-color: $BG_OVERLAY;
|
|
border-color: $ACCENT;
|
|
}
|
|
button:not(.flat):checked, button:not(.flat):active, button.suggested-action {
|
|
background-color: $SEL_BG;
|
|
background-image: none;
|
|
color: $SEL_FG;
|
|
border-color: $ACCENT;
|
|
}
|
|
button.flat:not(:hover):not(:checked):not(:active) {
|
|
background-color: transparent;
|
|
background-image: none;
|
|
color: $FG_MAIN;
|
|
border-color: transparent;
|
|
}
|
|
|
|
entry, textview, textview text, .view, treeview.view, list, listbox {
|
|
background-color: $BG_INPUT;
|
|
color: $FG_BRIGHT;
|
|
border-color: $BORDER;
|
|
}
|
|
entry:focus {
|
|
background-color: $BG_INPUT_FOC;
|
|
border-color: $ACCENT;
|
|
}
|
|
|
|
row:selected, .view:selected, treeview.view:selected, *:selected, selection {
|
|
background-color: $SEL_BG;
|
|
color: $SEL_FG;
|
|
}
|
|
|
|
notebook header, notebook tab {
|
|
background-color: $BG_HEADER;
|
|
color: $FG_MAIN;
|
|
border-color: $DIVIDER;
|
|
}
|
|
notebook tab:checked {
|
|
background-color: $BG_MAIN;
|
|
color: $FG_BRIGHT;
|
|
border-color: $ACCENT;
|
|
}
|
|
|
|
frame > border, scrolledwindow.frame, separator {
|
|
border-color: $DIVIDER;
|
|
}
|
|
|
|
scrollbar slider {
|
|
background-color: $BORDER;
|
|
}
|
|
scrollbar slider:hover {
|
|
background-color: $ACCENT_ALT;
|
|
}
|
|
|
|
tooltip, .tooltip {
|
|
background-color: $BG_OVERLAY;
|
|
color: $FG_BRIGHT;
|
|
border-color: $ACCENT;
|
|
}
|
|
EOF
|
|
fi
|
|
if [ "$_is4" = "1" ]; then
|
|
cat >> "$_tmp" <<EOF
|
|
|
|
@define-color shade_color rgba(0, 0, 0, 0.28);
|
|
@define-color scrollbar_outline_color $BORDER;
|
|
EOF
|
|
fi
|
|
mv -f "$_tmp" "$_dest"
|
|
}
|
|
|
|
write_gtk_css "$GTK3_THEME_DIR/gtk.css" 0 0 0
|
|
write_gtk_css "$GTK3_THEME_DIR/gtk-dark.css" 0 0 1
|
|
write_gtk_css "$GTK3_CONF_DIR/gtk.css" 0 1 0
|
|
write_gtk_css "$GTK4_THEME_DIR/gtk.css" 1 0 0
|
|
write_gtk_css "$GTK4_THEME_DIR/gtk-dark.css" 1 0 1
|
|
write_gtk_css "$GTK4_CONF_DIR/gtk.css" 1 1 0
|
|
|
|
cat > "$GTK3_CONF_DIR/settings.ini.tmp.$$" <<EOF
|
|
[Settings]
|
|
gtk-theme-name=$THEME_ID
|
|
gtk-icon-theme-name=$ICON_THEME
|
|
gtk-font-name=$GTK_FONT
|
|
gtk-application-prefer-dark-theme=$IS_DARK
|
|
gtk-cursor-theme-size=$GTK_CUR_SZ
|
|
gtk-decoration-layout=menu:minimize,maximize,close
|
|
EOF
|
|
mv -f "$GTK3_CONF_DIR/settings.ini.tmp.$$" "$GTK3_CONF_DIR/settings.ini"
|
|
|
|
cat > "$GTK4_CONF_DIR/settings.ini.tmp.$$" <<EOF
|
|
[Settings]
|
|
gtk-theme-name=$THEME_ID
|
|
gtk-icon-theme-name=$ICON_THEME
|
|
gtk-font-name=$GTK_FONT
|
|
gtk-application-prefer-dark-theme=$IS_DARK
|
|
gtk-cursor-theme-size=$GTK_CUR_SZ
|
|
EOF
|
|
mv -f "$GTK4_CONF_DIR/settings.ini.tmp.$$" "$GTK4_CONF_DIR/settings.ini"
|
|
|
|
# 3. xsettingsd (NOTE: Do NOT emit Xft/DPI here so Xft.dpi + GDK_SCALE never double-scale!)
|
|
XSET_DIR="$XDG_CONFIG_HOME/xsettingsd"
|
|
mkdir -p "$XSET_DIR"
|
|
cat > "$XSET_DIR/xsettingsd.conf.tmp.$$" <<EOF
|
|
# Managed by anode-sync-gtk-theme
|
|
Net/ThemeName "$THEME_ID"
|
|
Net/IconThemeName "$ICON_THEME"
|
|
Gtk/FontName "$GTK_FONT"
|
|
Gtk/CursorThemeSize $GTK_CUR_SZ
|
|
Gdk/WindowScalingFactor $GDK_SCALE_VAL
|
|
EOF
|
|
mv -f "$XSET_DIR/xsettingsd.conf.tmp.$$" "$XSET_DIR/xsettingsd.conf"
|
|
|
|
# 4. Qt5 (qt5ct) & Qt6 (qt6ct) palettes + configs
|
|
write_qt_conf() {
|
|
_ver="$1"
|
|
_qdir="$XDG_CONFIG_HOME/qt${_ver}ct"
|
|
_cdir="$_qdir/colors"
|
|
mkdir -p "$_cdir"
|
|
_pal="$_cdir/$THEME_ID.conf"
|
|
|
|
# 21 Qt QPalette roles in order:
|
|
# WindowText, Button, Light, Midlight, Dark, Mid, Text, BrightText,
|
|
# ButtonText, Base, Window, Shadow, Highlight, HighlightedText,
|
|
# Link, LinkVisited, AlternateBase, NoRole, ToolTipBase, ToolTipText, PlaceholderText
|
|
_act="$FG_MAIN, $BG_BUTTON, $ACCENT_ALT, $BG_OVERLAY, $BORDER, $DIVIDER, $FG_BRIGHT, $FG_BRIGHT, $FG_BRIGHT, $BG_INPUT, $BG_MAIN, $BG_FOOTER, $SEL_BG, $SEL_FG, $ACCENT, $HIGHLIGHT, $BG_ALT_EVEN, $BG_MAIN, $BG_OVERLAY, $FG_BRIGHT, $FG_MUTED"
|
|
_dis="$FG_MUTED, $BG_ALT_EVEN, $BG_OVERLAY, $BG_ALT_ODD, $BORDER, $DIVIDER, $FG_MUTED, $FG_MUTED, $FG_MUTED, $BG_ALT_EVEN, $BG_MAIN, $BG_FOOTER, $BORDER, $FG_MUTED, $FG_MUTED, $FG_MUTED, $BG_ALT_ODD, $BG_MAIN, $BG_OVERLAY, $FG_MUTED, $FG_MUTED"
|
|
_inact="$_act"
|
|
|
|
cat > "${_pal}.tmp.$$" <<EOF
|
|
[ColorScheme]
|
|
active_colors=$_act
|
|
disabled_colors=$_dis
|
|
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]
|
|
color_scheme_path=$_pal
|
|
custom_palette=true
|
|
icon_theme=$ICON_THEME
|
|
standard_dialogs=gtk3
|
|
style=$_qt_style
|
|
|
|
[Fonts]
|
|
fixed="$FONT_FACE,$GTK_PT,-1,5,50,0,0,0,0,0"
|
|
general="$FONT_FACE,$GTK_PT,-1,5,50,0,0,0,0,0"
|
|
EOF
|
|
mv -f "${_qconf}.tmp.$$" "$_qconf"
|
|
}
|
|
|
|
write_qt_conf 5
|
|
write_qt_conf 6
|
|
|
|
# 5. Kvantum theme
|
|
KV_DIR="$XDG_CONFIG_HOME/Kvantum"
|
|
KV_TDIR="$KV_DIR/$THEME_ID"
|
|
mkdir -p "$KV_TDIR"
|
|
cat > "$KV_DIR/kvantum.kvconfig.tmp.$$" <<EOF
|
|
[General]
|
|
theme=$THEME_ID
|
|
EOF
|
|
mv -f "$KV_DIR/kvantum.kvconfig.tmp.$$" "$KV_DIR/kvantum.kvconfig"
|
|
|
|
cat > "$KV_TDIR/$THEME_ID.kvconfig.tmp.$$" <<EOF
|
|
[%General]
|
|
author=ANODE
|
|
comment=Synced from $TNAME
|
|
x11drag=menubar_and_primary_toolbar
|
|
alt_mnemonic=true
|
|
scrollable_menu=true
|
|
|
|
[GeneralColors]
|
|
window.color=$BG_MAIN
|
|
base.color=$BG_INPUT
|
|
alt.base.color=$BG_ALT_EVEN
|
|
button.color=$BG_BUTTON
|
|
light.color=$ACCENT_ALT
|
|
mid.light.color=$BG_OVERLAY
|
|
dark.color=$BORDER
|
|
mid.color=$DIVIDER
|
|
highlight.color=$SEL_BG
|
|
inactive.highlight.color=$BORDER
|
|
text.color=$FG_BRIGHT
|
|
window.text.color=$FG_MAIN
|
|
button.text.color=$FG_BRIGHT
|
|
disabled.text.color=$FG_MUTED
|
|
tooltip.text.color=$FG_BRIGHT
|
|
highlight.text.color=$SEL_FG
|
|
link.color=$ACCENT
|
|
link.visited.color=$HIGHLIGHT
|
|
progress.indicator.text.color=$SEL_FG
|
|
EOF
|
|
mv -f "$KV_TDIR/$THEME_ID.kvconfig.tmp.$$" "$KV_TDIR/$THEME_ID.kvconfig"
|
|
|
|
if [ -n "${DISPLAY:-}" ] && [ "${ANODE_NO_SIGNAL:-0}" != "1" ]; then
|
|
_xpids="$( (ps -eo pid=,comm= 2>/dev/null || ps -ax -o pid=,comm= 2>/dev/null || true) | awk '
|
|
{ cmd=$2; sub(/^.*\//, "", cmd); if (cmd == "xsettingsd") print $1 }
|
|
' )"
|
|
if [ -n "${_xpids:-}" ]; then
|
|
for _p in $_xpids; do
|
|
kill -HUP "$_p" 2>/dev/null || true
|
|
done
|
|
fi
|
|
fi
|