feat: initial ANODE desktop environment adapted from Geminux
This commit is contained in:
commit
65bfe3c65a
137 files changed
+33788
No files matched your search
Executable
+399
@@ -0,0 +1,399 @@
|
||||
#!/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}"
|
||||
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 "1")"
|
||||
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" '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)
|
||||
# Effective GTK logical scale multiplier when GDK_SCALE=1 vs 2
|
||||
eff = sc / gdk_sc
|
||||
if (eff < 0.5) eff = 0.5
|
||||
pt = int(((bsz + 0.0) * 0.72 / gdk_sc) + 0.5)
|
||||
if (pt < 7) pt = 7
|
||||
if (pt > 24) pt = 24
|
||||
btn_pv = int(6.0 * eff + 0.5); if (btn_pv < 3) btn_pv = 3
|
||||
btn_ph = int(12.0 * eff + 0.5); if (btn_ph < 6) btn_ph = 6
|
||||
rad = int(6.0 * eff + 0.5); if (rad < 3) rad = 3
|
||||
row_h = int(28.0 * eff + 0.5); if (row_h < 20) row_h = 20
|
||||
sb_w = int(12.0 * eff + 0.5); if (sb_w < 8) sb_w = 8
|
||||
is_d = (dark == "1" || dark == "true") ? 1 : 0
|
||||
printf "%d %d %d %d %d %d %d %d\n", gdk_sc, pt, btn_pv, btn_ph, rad, row_h, sb_w, is_d
|
||||
}')"
|
||||
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_FONT="$FONT_FACE $GTK_PT"
|
||||
|
||||
# 1. GTK-2 theme & ~/.gtkrc-2.0
|
||||
GTK2_DIR="$HOME/.themes/$THEME_ID/gtk-2.0"
|
||||
mkdir -p "$GTK2_DIR"
|
||||
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
|
||||
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"
|
||||
}
|
||||
class "GtkWidget" style "anode-default"
|
||||
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"
|
||||
_tmp="${_dest}.tmp.$$"
|
||||
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 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 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 success_color $SUCCESS;
|
||||
@define-color warning_color $WARNING;
|
||||
@define-color error_color $DANGER;
|
||||
|
||||
window, .background, messagedialog {
|
||||
background-color: $BG_MAIN;
|
||||
color: $FG_MAIN;
|
||||
font-family: "$FONT_FACE", sans-serif;
|
||||
}
|
||||
|
||||
headerbar, .titlebar {
|
||||
background-color: $BG_HEADER;
|
||||
color: $FG_BRIGHT;
|
||||
border-bottom: 1px solid $DIVIDER;
|
||||
min-height: ${ROW_H}px;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: $BG_BUTTON;
|
||||
color: $FG_BRIGHT;
|
||||
border: 1px solid $BORDER;
|
||||
border-radius: ${RAD_PX}px;
|
||||
padding: ${PAD_V}px ${PAD_H}px;
|
||||
}
|
||||
button:hover {
|
||||
background-color: $BG_OVERLAY;
|
||||
border-color: $ACCENT;
|
||||
}
|
||||
button:checked, button.suggested-action {
|
||||
background-color: $SEL_BG;
|
||||
color: $SEL_FG;
|
||||
border-color: $ACCENT;
|
||||
}
|
||||
|
||||
entry, spinbutton, combobox button {
|
||||
background-color: $BG_INPUT;
|
||||
color: $FG_BRIGHT;
|
||||
border: 1px solid $BORDER;
|
||||
border-radius: ${RAD_PX}px;
|
||||
padding: ${PAD_V}px;
|
||||
}
|
||||
entry:focus {
|
||||
background-color: $BG_INPUT_FOC;
|
||||
border-color: $ACCENT;
|
||||
}
|
||||
|
||||
row:selected, .view:selected, treeview.view:selected, *:selected {
|
||||
background-color: $SEL_BG;
|
||||
color: $SEL_FG;
|
||||
}
|
||||
|
||||
scrollbar slider {
|
||||
min-width: ${SB_W}px;
|
||||
min-height: ${SB_W}px;
|
||||
border-radius: ${RAD_PX}px;
|
||||
background-color: $BORDER;
|
||||
}
|
||||
scrollbar slider:hover {
|
||||
background-color: $ACCENT_ALT;
|
||||
}
|
||||
|
||||
tooltip, .tooltip {
|
||||
background-color: $BG_OVERLAY;
|
||||
color: $FG_BRIGHT;
|
||||
border: 1px solid $ACCENT;
|
||||
border-radius: ${RAD_PX}px;
|
||||
}
|
||||
EOF
|
||||
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
|
||||
write_gtk_css "$GTK3_CONF_DIR/gtk.css" 0
|
||||
write_gtk_css "$GTK4_THEME_DIR/gtk.css" 1
|
||||
write_gtk_css "$GTK4_CONF_DIR/gtk.css" 1
|
||||
|
||||
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=$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=$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 $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"
|
||||
|
||||
_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=Fusion
|
||||
|
||||
[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
|
||||
Reference in new issue
Block a user