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
+169
@@ -0,0 +1,169 @@
|
||||
#!/bin/sh
|
||||
# ANODE fractional DPI scale & touch-mode manager (strict POSIX sh)
|
||||
set -eu
|
||||
|
||||
: "${XDG_CONFIG_HOME:=$HOME/.config}"
|
||||
CONF_DIR="$XDG_CONFIG_HOME/anode"
|
||||
CONF_FILE="$CONF_DIR/scale.conf"
|
||||
ENV_FILE="$CONF_DIR/scale.env"
|
||||
|
||||
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: anode-apply-scale [SCALE|auto] [--touch=0|1] [--no-apply]
|
||||
|
||||
Options:
|
||||
SCALE Fractional UI scale factor between 0.50 and 4.00 (e.g. 0.75, 1.00, 1.25, 1.50, 2.00)
|
||||
auto Detect scale automatically from primary X11 output EDID dimensions (fallback 1.00)
|
||||
--touch=0|1 Enable (1) or disable (0) touch-mode sizing & virtual keyboard defaults
|
||||
--no-apply Only write scale.conf/scale.env without re-applying the active theme
|
||||
EOF
|
||||
}
|
||||
|
||||
SCALE=""
|
||||
TOUCH=""
|
||||
DO_APPLY=1
|
||||
|
||||
if [ -f "$CONF_FILE" ]; then
|
||||
. "$CONF_FILE"
|
||||
fi
|
||||
: "${SCALE:=1.00}"
|
||||
: "${TOUCH:=0}"
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--touch=0|--touch=false|--touch=off)
|
||||
TOUCH=0
|
||||
;;
|
||||
--touch=1|--touch=true|--touch=on)
|
||||
TOUCH=1
|
||||
;;
|
||||
--no-apply)
|
||||
DO_APPLY=0
|
||||
;;
|
||||
auto)
|
||||
SCALE="auto"
|
||||
;;
|
||||
*)
|
||||
SCALE="$arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
detect_edid_scale() {
|
||||
_dpi="96"
|
||||
if [ -n "${DISPLAY:-}" ] && command -v xrandr >/dev/null 2>&1; then
|
||||
_xrandr_dpi="$(xrandr --query 2>/dev/null | awk '
|
||||
/ connected/ {
|
||||
if (match($0, /[0-9]+x[0-9]+/) && match($0, /[0-9]+mm x [0-9]+mm/)) {
|
||||
res = substr($0, RSTART)
|
||||
}
|
||||
px = 0; wmm = 0
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($i ~ /^[0-9]+x[0-9]+(\+[0-9]+\+[0-9]+)?$/ && px == 0) {
|
||||
split($i, a, "x"); px = a[1] + 0
|
||||
}
|
||||
if ($i ~ /^[0-9]+mm$/ && $(i+1) == "x" && $(i+2) ~ /^[0-9]+mm$/) {
|
||||
wmm = $i; gsub(/mm/, "", wmm); wmm += 0
|
||||
}
|
||||
}
|
||||
if (px > 0 && wmm > 0) {
|
||||
printf "%.2f\n", (px * 25.4) / wmm
|
||||
exit
|
||||
}
|
||||
}
|
||||
' || true)"
|
||||
if [ -n "${_xrandr_dpi:-}" ]; then
|
||||
_dpi="$_xrandr_dpi"
|
||||
fi
|
||||
fi
|
||||
if [ "$_dpi" = "96" ] && [ -n "${DISPLAY:-}" ] && command -v xdpyinfo >/dev/null 2>&1; then
|
||||
_xdpy_dpi="$(xdpyinfo 2>/dev/null | awk '/resolution:/ { split($2, a, "x"); if (a[1] > 0) { print a[1]; exit } }' || true)"
|
||||
if [ -n "${_xdpy_dpi:-}" ]; then
|
||||
_dpi="$_xdpy_dpi"
|
||||
fi
|
||||
fi
|
||||
awk -v d="$_dpi" 'BEGIN {
|
||||
s = (d + 0) / 96.0
|
||||
s = int(s * 20.0 + 0.5) / 20.0
|
||||
if (s < 0.50) s = 0.50
|
||||
if (s > 4.00) s = 4.00
|
||||
printf "%.2f\n", s
|
||||
}'
|
||||
}
|
||||
|
||||
if [ "$SCALE" = "auto" ]; then
|
||||
SCALE="$(detect_edid_scale)"
|
||||
fi
|
||||
|
||||
if ! printf '%s\n' "$SCALE" | awk '/^[0-9]+(\.[0-9]+)?$/ { exit 0 } { exit 1 }'; then
|
||||
printf 'anode-apply-scale: invalid scale value: %s\n' "$SCALE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CALC="$(awk -v raw="$SCALE" -v touch="$TOUCH" 'BEGIN {
|
||||
s = raw + 0.0
|
||||
if (s < 0.50) s = 0.50
|
||||
if (s > 4.00) s = 4.00
|
||||
s = int(s * 100.0 + 0.5) / 100.0
|
||||
xft_dpi = int(96.0 * s + 0.5)
|
||||
gdk_scale = (s < 1.75) ? 1 : int(s + 0.5)
|
||||
cur_sz = int(24.0 * s + 0.5)
|
||||
if (cur_sz < 16) cur_sz = 16
|
||||
if (cur_sz > 96) cur_sz = 96
|
||||
t = (touch == "1" || touch == 1) ? 1 : 0
|
||||
printf "%.2f %d %d %d %d\n", s, xft_dpi, gdk_scale, cur_sz, t
|
||||
}')"
|
||||
|
||||
set -- $CALC
|
||||
SCALE="$1"
|
||||
XFT_DPI="$2"
|
||||
GDK_SCALE="$3"
|
||||
XCURSOR_SIZE="$4"
|
||||
TOUCH="$5"
|
||||
|
||||
mkdir -p "$CONF_DIR"
|
||||
|
||||
TMP_CONF="$CONF_FILE.tmp.$$"
|
||||
cat > "$TMP_CONF" <<EOF
|
||||
# Managed by anode-apply-scale
|
||||
SCALE=$SCALE
|
||||
TOUCH=$TOUCH
|
||||
XFT_DPI=$XFT_DPI
|
||||
GDK_SCALE=$GDK_SCALE
|
||||
XCURSOR_SIZE=$XCURSOR_SIZE
|
||||
EOF
|
||||
mv -f "$TMP_CONF" "$CONF_FILE"
|
||||
|
||||
TMP_ENV="$ENV_FILE.tmp.$$"
|
||||
cat > "$TMP_ENV" <<EOF
|
||||
# Managed by anode-apply-scale
|
||||
export ANODE_SCALE="$SCALE"
|
||||
export ANODE_TOUCH="$TOUCH"
|
||||
export GDK_SCALE="$GDK_SCALE"
|
||||
export GDK_DPI_SCALE="1.0"
|
||||
export ADW_DISABLE_PORTAL="1"
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR="0"
|
||||
export QT_ENABLE_HIGHDPI_SCALING="1"
|
||||
export QT_SCALE_FACTOR_ROUNDING_POLICY="PassThrough"
|
||||
export QT_SCALE_FACTOR="$SCALE"
|
||||
export QT_FONT_DPI="96"
|
||||
export XCURSOR_SIZE="$XCURSOR_SIZE"
|
||||
EOF
|
||||
mv -f "$TMP_ENV" "$ENV_FILE"
|
||||
|
||||
if [ "$DO_APPLY" = "1" ]; then
|
||||
if [ -x "$SCRIPT_DIR/anode-apply-theme" ]; then
|
||||
"$SCRIPT_DIR/anode-apply-theme"
|
||||
elif command -v anode-apply-theme >/dev/null 2>&1; then
|
||||
anode-apply-theme
|
||||
fi
|
||||
fi
|
||||
|
||||
printf 'ANODE scale: %s (Xft.dpi=%s, GDK_SCALE=%s, QT_SCALE_FACTOR=%s, Xcursor=%s, touch=%s)\n' \
|
||||
"$SCALE" "$XFT_DPI" "$GDK_SCALE" "$SCALE" "$XCURSOR_SIZE" "$TOUCH"
|
||||
Executable
+231
@@ -0,0 +1,231 @@
|
||||
#!/bin/sh
|
||||
# ANODE unified .xth theme applier (strict POSIX sh, fractional DPI aware)
|
||||
set -eu
|
||||
|
||||
: "${XDG_CONFIG_HOME:=$HOME/.config}"
|
||||
: "${ANODE_PREFIX:=/usr/local}"
|
||||
CONF_DIR="$XDG_CONFIG_HOME/anode"
|
||||
THEME_CONF="$CONF_DIR/theme.conf"
|
||||
SCALE_CONF="$CONF_DIR/scale.conf"
|
||||
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
|
||||
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
|
||||
cat <<'EOF'
|
||||
Usage: anode-apply-theme [THEME_NAME | /path/to/Theme.xth]
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
REQ_THEME="${1:-}"
|
||||
if [ -z "$REQ_THEME" ] && [ -f "$THEME_CONF" ]; then
|
||||
REQ_THEME="$(awk -F= '/^THEME=/{ print $2; exit }' "$THEME_CONF" 2>/dev/null || true)"
|
||||
fi
|
||||
: "${REQ_THEME:=AnodeDefault}"
|
||||
|
||||
find_xth() {
|
||||
_q="$1"
|
||||
if [ -f "$_q" ]; then
|
||||
printf '%s\n' "$_q"
|
||||
return 0
|
||||
fi
|
||||
if [ -f "$_q.xth" ]; then
|
||||
printf '%s\n' "$_q.xth"
|
||||
return 0
|
||||
fi
|
||||
_base="$(basename "$_q" .xth)"
|
||||
for _dir in \
|
||||
"$CONF_DIR/themes" \
|
||||
"$HOME/.xthemes" \
|
||||
"$ANODE_PREFIX/share/anode/themes" \
|
||||
"$SCRIPT_DIR/../share/anode/themes" \
|
||||
"$SCRIPT_DIR/../data/themes"
|
||||
do
|
||||
if [ -f "$_dir/$_base.xth" ]; then
|
||||
printf '%s\n' "$_dir/$_base.xth"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
XTH_FILE="$(find_xth "$REQ_THEME" || true)"
|
||||
if [ -z "$XTH_FILE" ] || [ ! -r "$XTH_FILE" ]; then
|
||||
printf 'anode-apply-theme: theme not found: %s\n' "$REQ_THEME" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCALE="1.00"
|
||||
TOUCH="0"
|
||||
if [ -f "$SCALE_CONF" ]; then
|
||||
. "$SCALE_CONF"
|
||||
fi
|
||||
if [ -n "${ANODE_SCALE:-}" ]; then SCALE="$ANODE_SCALE"; fi
|
||||
if [ -n "${ANODE_TOUCH:-}" ]; then TOUCH="$ANODE_TOUCH"; fi
|
||||
|
||||
THEME_NAME="$(awk -F: '/^theme\.name[[:space:]]*:/ { sub(/^[[:space:]]+/, "", $2); print $2; exit }' "$XTH_FILE" || true)"
|
||||
if [ -z "$THEME_NAME" ]; then
|
||||
THEME_NAME="$(basename "$XTH_FILE" .xth)"
|
||||
fi
|
||||
|
||||
mkdir -p "$CONF_DIR"
|
||||
TMP_XRES="$HOME/.Xresources.tmp.$$"
|
||||
|
||||
awk -v scale_str="$SCALE" -v touch_str="$TOUCH" -v tname="$THEME_NAME" '
|
||||
function trim(s) {
|
||||
gsub(/^[ \t\r\n]+|[ \t\r\n]+$/, "", s)
|
||||
return s
|
||||
}
|
||||
function rint(x) {
|
||||
return int(x + 0.5)
|
||||
}
|
||||
{
|
||||
raw[NR] = $0
|
||||
s = trim($0)
|
||||
if (s == "" || substr(s, 1, 1) == "!" || substr(s, 1, 1) == "#") next
|
||||
pos = index(s, ":")
|
||||
if (pos > 0) {
|
||||
k = trim(substr(s, 1, pos - 1))
|
||||
v = trim(substr(s, pos + 1))
|
||||
vals[k] = v
|
||||
}
|
||||
}
|
||||
END {
|
||||
s = scale_str + 0.0
|
||||
if (s < 0.50) s = 0.50
|
||||
if (s > 4.00) s = 4.00
|
||||
t = (touch_str == "1" || touch_str == 1) ? 1 : 0
|
||||
|
||||
orig_dpi = ("Xft.dpi" in vals) ? (vals["Xft.dpi"] + 0.0) : 96.0
|
||||
base_sz = ("theme.baseFontSize" in vals) ? (vals["theme.baseFontSize"] + 0.0) : 15.0
|
||||
cur_sz = ("Xcursor.size" in vals) ? (vals["Xcursor.size"] + 0.0) : 24.0
|
||||
bw = ("dwm.borderpx" in vals) ? (vals["dwm.borderpx"] + 0.0) : 2.0
|
||||
|
||||
# Normalize imported 192-DPI themes down to 96-DPI logical bases before scaling
|
||||
if (orig_dpi >= 160.0 && base_sz >= 24.0) {
|
||||
base_sz = base_sz / 2.0
|
||||
if (cur_sz >= 40.0) cur_sz = cur_sz / 2.0
|
||||
if (bw >= 4.0) bw = bw / 2.0
|
||||
}
|
||||
if (base_sz < 8.0 || base_sz > 28.0) base_sz = 15.0
|
||||
if (cur_sz < 12.0 || cur_sz > 48.0) cur_sz = 24.0
|
||||
if (bw < 1.0 || bw > 6.0) bw = 2.0
|
||||
|
||||
xft_dpi = rint(96.0 * s)
|
||||
if (xft_dpi < 48) xft_dpi = 48
|
||||
if (xft_dpi > 384) xft_dpi = 384
|
||||
|
||||
scaled_font_px = rint(base_sz * s)
|
||||
if (scaled_font_px < 8) scaled_font_px = 8
|
||||
if (scaled_font_px > 96) scaled_font_px = 96
|
||||
|
||||
scaled_cur = rint(cur_sz * s)
|
||||
if (scaled_cur < 16) scaled_cur = 16
|
||||
if (scaled_cur > 96) scaled_cur = 96
|
||||
|
||||
scaled_bw = rint(bw * s)
|
||||
if (scaled_bw < 1) scaled_bw = 1
|
||||
if (scaled_bw > 10) scaled_bw = 10
|
||||
|
||||
scaled_dm_lh = rint(36.0 * s)
|
||||
if (scaled_dm_lh < 22) scaled_dm_lh = 22
|
||||
if (t == 1 && scaled_dm_lh < rint(44.0 * s)) scaled_dm_lh = rint(44.0 * s)
|
||||
|
||||
font_face = ("theme.fontFace" in vals && vals["theme.fontFace"] != "") ? vals["theme.fontFace"] : "Fira Code"
|
||||
icon_face = ("theme.iconFontFace" in vals && vals["theme.iconFontFace"] != "") ? vals["theme.iconFontFace"] : "DejaVuSansM Nerd Font"
|
||||
|
||||
over["theme.name"] = tname
|
||||
over["theme.fontFace"] = font_face
|
||||
over["theme.iconFontFace"] = icon_face
|
||||
over["theme.baseFontSize"] = sprintf("%d", scaled_font_px)
|
||||
over["theme.scale"] = sprintf("%.2f", s)
|
||||
over["theme.touchMode"] = sprintf("%d", t)
|
||||
over["theme.gtkTheme"] = "ANODE-" tname
|
||||
over["*TkTheme"] = "gtkTtk"
|
||||
over["Xft.dpi"] = sprintf("%d", xft_dpi)
|
||||
over["Xcursor.size"] = sprintf("%d", scaled_cur)
|
||||
over["dwm.borderpx"] = sprintf("%d", scaled_bw)
|
||||
over["dwm.font"] = sprintf("%s, %s %dpx", font_face, icon_face, scaled_font_px)
|
||||
over["dmenu.font"] = sprintf("%s, %s %dpx", font_face, icon_face, scaled_font_px)
|
||||
over["dmenu.lineheight"] = sprintf("%d", scaled_dm_lh)
|
||||
over["st.font"] = sprintf("%s:pixelsize=%d:style=Regular:antialias=true:autohint=true", font_face, scaled_font_px)
|
||||
|
||||
for (i = 1; i <= NR; i++) {
|
||||
sline = trim(raw[i])
|
||||
if (sline == "" || substr(sline, 1, 1) == "!" || substr(sline, 1, 1) == "#") {
|
||||
print raw[i]
|
||||
continue
|
||||
}
|
||||
p = index(sline, ":")
|
||||
if (p > 0) {
|
||||
key = trim(substr(sline, 1, p - 1))
|
||||
if (key in over) {
|
||||
if (!(key in emitted)) {
|
||||
printf "%s: %s\n", key, over[key]
|
||||
emitted[key] = 1
|
||||
}
|
||||
} else {
|
||||
print raw[i]
|
||||
}
|
||||
} else {
|
||||
print raw[i]
|
||||
}
|
||||
}
|
||||
order[1] = "theme.scale"; order[2] = "theme.touchMode"; order[3] = "theme.gtkTheme"
|
||||
order[4] = "*TkTheme"; order[5] = "Xft.dpi"; order[6] = "Xcursor.size"
|
||||
order[7] = "theme.fontFace"; order[8] = "theme.iconFontFace"; order[9] = "theme.baseFontSize"
|
||||
order[10] = "dwm.borderpx"; order[11] = "dwm.font"; order[12] = "dmenu.font"
|
||||
order[13] = "dmenu.lineheight"; order[14] = "st.font"
|
||||
for (j = 1; j <= 14; j++) {
|
||||
ok = order[j]
|
||||
if (!(ok in emitted)) {
|
||||
printf "%s: %s\n", ok, over[ok]
|
||||
emitted[ok] = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
' "$XTH_FILE" > "$TMP_XRES"
|
||||
|
||||
mv -f "$TMP_XRES" "$HOME/.Xresources"
|
||||
|
||||
TMP_TC="$THEME_CONF.tmp.$$"
|
||||
printf 'THEME=%s\nXTH_FILE=%s\n' "$THEME_NAME" "$XTH_FILE" > "$TMP_TC"
|
||||
mv -f "$TMP_TC" "$THEME_CONF"
|
||||
|
||||
if [ -n "${DISPLAY:-}" ] && command -v xrdb >/dev/null 2>&1; then
|
||||
xrdb -merge "$HOME/.Xresources" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
if [ -x "$SCRIPT_DIR/anode-sync-gtk-theme" ]; then
|
||||
"$SCRIPT_DIR/anode-sync-gtk-theme"
|
||||
elif command -v anode-sync-gtk-theme >/dev/null 2>&1; then
|
||||
anode-sync-gtk-theme
|
||||
fi
|
||||
|
||||
if [ -x "$SCRIPT_DIR/anode-sync-dunst-theme" ]; then
|
||||
"$SCRIPT_DIR/anode-sync-dunst-theme"
|
||||
elif command -v anode-sync-dunst-theme >/dev/null 2>&1; then
|
||||
anode-sync-dunst-theme
|
||||
fi
|
||||
|
||||
if [ -n "${DISPLAY:-}" ] && [ "${ANODE_NO_SIGNAL:-0}" != "1" ]; then
|
||||
_pids="$( (ps -eo pid=,comm= 2>/dev/null || ps -ax -o pid=,comm= 2>/dev/null || true) | awk '
|
||||
{
|
||||
pid = $1; cmd = $2
|
||||
sub(/^.*\//, "", cmd)
|
||||
if (cmd == "dwm" || cmd == "st" || cmd == "anode-statusd" ||
|
||||
cmd == "anode-net" || cmd == "anode-audio" || cmd == "anode-display" ||
|
||||
cmd == "anode-datetime" || cmd == "anode-power" || cmd == "anode-themes") {
|
||||
print "USR1 " pid
|
||||
} else if (cmd == "anode-vkbd") {
|
||||
print "HUP " pid
|
||||
}
|
||||
}
|
||||
' )"
|
||||
if [ -n "${_pids:-}" ]; then
|
||||
printf '%s\n' "$_pids" | while read -r _sig _p; do
|
||||
[ -n "${_p:-}" ] && kill -"$_sig" "$_p" 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
printf 'ANODE applied theme: %s (scale=%s)\n' "$THEME_NAME" "$SCALE"
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
# ANODE dynamic launcher using patched dmenu (strict POSIX sh)
|
||||
set -u
|
||||
|
||||
: "${XDG_DATA_HOME:=$HOME/.local/share}"
|
||||
: "${ANODE_PREFIX:=/usr/local}"
|
||||
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/anode"
|
||||
mkdir -p "$CACHE_DIR"
|
||||
|
||||
APPS_TMP="$CACHE_DIR/launcher-apps.$$"
|
||||
cleanup() { rm -f "$APPS_TMP"; }
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
{
|
||||
printf 'Terminal\tst\n'
|
||||
printf 'Control Center & Power\tanode-power\n'
|
||||
printf 'Network & Wi-Fi\tanode-net\n'
|
||||
printf 'Audio & Volume\tanode-audio\n'
|
||||
printf 'Display & Scaling\tanode-display\n'
|
||||
printf 'Date & Timezone\tanode-datetime\n'
|
||||
printf 'Themes & Fonts\tanode-themes\n'
|
||||
printf 'Virtual Keyboard Toggle\tanode-media-key vkbd-toggle\n'
|
||||
printf 'Lock Screen\tanode-lock\n'
|
||||
|
||||
IFS=:
|
||||
for _base in "$XDG_DATA_HOME" "${XDG_DATA_DIRS:-$ANODE_PREFIX/share:/usr/local/share:/usr/share}"; do
|
||||
_dir="$_base/applications"
|
||||
[ -d "$_dir" ] || continue
|
||||
for _f in "$_dir"/*.desktop; do
|
||||
[ -f "$_f" ] || continue
|
||||
awk '
|
||||
/^\[Desktop Entry\]/ { in_entry=1; next }
|
||||
/^\[/ { in_entry=0 }
|
||||
in_entry && /^Name=/ && !name { sub(/^Name=/, ""); name=$0 }
|
||||
in_entry && /^Exec=/ && !exec_cmd { sub(/^Exec=/, ""); exec_cmd=$0 }
|
||||
in_entry && /^NoDisplay=true/ { hidden=1 }
|
||||
in_entry && /^Terminal=true/ { isterm=1 }
|
||||
END {
|
||||
if (!hidden && name != "" && exec_cmd != "") {
|
||||
gsub(/%[fFuUdDnNickvm]/, "", exec_cmd)
|
||||
gsub(/^[ \t]+|[ \t]+$/, "", exec_cmd)
|
||||
if (isterm) printf "%s (term)\tst -e %s\n", name, exec_cmd
|
||||
else printf "%s\t%s\n", name, exec_cmd
|
||||
}
|
||||
}
|
||||
' "$_f"
|
||||
done
|
||||
done
|
||||
unset IFS
|
||||
|
||||
if command -v dmenu_path >/dev/null 2>&1; then
|
||||
dmenu_path | while IFS= read -r _bin; do
|
||||
[ -n "$_bin" ] && printf '%s\t%s\n' "$_bin" "$_bin"
|
||||
done
|
||||
fi
|
||||
} | awk -F'\t' '!seen[$1]++ { print $0 }' > "$APPS_TMP"
|
||||
|
||||
CHOICE="$(cut -f1 "$APPS_TMP" | dmenu -i -l 12 -p "Run:")" || exit 0
|
||||
[ -n "$CHOICE" ] || exit 0
|
||||
|
||||
CMD="$(awk -F'\t' -v ch="$CHOICE" '$1 == ch { print $2; exit }' "$APPS_TMP")"
|
||||
[ -n "$CMD" ] || CMD="$CHOICE"
|
||||
|
||||
exec /bin/sh -c "exec $CMD" >/dev/null 2>&1 &
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
# ANODE X11 desktop session entrypoint (strict POSIX sh)
|
||||
set -u
|
||||
|
||||
: "${XDG_CONFIG_HOME:=$HOME/.config}"
|
||||
: "${ANODE_PREFIX:=/usr/local}"
|
||||
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
|
||||
# Ensure ANODE prefix binaries are on PATH
|
||||
case ":$PATH:" in
|
||||
*":$SCRIPT_DIR:"*) ;;
|
||||
*) PATH="$SCRIPT_DIR:$PATH" ;;
|
||||
esac
|
||||
case ":$PATH:" in
|
||||
*":$ANODE_PREFIX/bin:"*) ;;
|
||||
*) PATH="$ANODE_PREFIX/bin:$PATH" ;;
|
||||
esac
|
||||
export PATH
|
||||
|
||||
for _envfile in "$ANODE_PREFIX/share/anode/env.sh" "$SCRIPT_DIR/../data/env.sh"; do
|
||||
if [ -r "$_envfile" ]; then
|
||||
. "$_envfile"
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset _envfile
|
||||
|
||||
if [ ! -f "$XDG_CONFIG_HOME/anode/scale.conf" ] && command -v anode-apply-scale >/dev/null 2>&1; then
|
||||
anode-apply-scale auto --no-apply >/dev/null 2>&1 || true
|
||||
fi
|
||||
if [ -f "$XDG_CONFIG_HOME/anode/scale.env" ]; then
|
||||
. "$XDG_CONFIG_HOME/anode/scale.env"
|
||||
fi
|
||||
|
||||
if [ ! -f "$HOME/.Xresources" ] && command -v anode-apply-theme >/dev/null 2>&1; then
|
||||
anode-apply-theme AnodeDefault >/dev/null 2>&1 || true
|
||||
elif [ -f "$HOME/.Xresources" ] && command -v xrdb >/dev/null 2>&1; then
|
||||
xrdb -merge "$HOME/.Xresources" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
if command -v xsetroot >/dev/null 2>&1; then
|
||||
xsetroot -cursor_name left_ptr >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
BG_PIDS=""
|
||||
spawn_bg() {
|
||||
if command -v "$1" >/dev/null 2>&1; then
|
||||
"$@" >/dev/null 2>&1 &
|
||||
BG_PIDS="$BG_PIDS $!"
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_bg() {
|
||||
for _pid in $BG_PIDS; do
|
||||
kill "$_pid" 2>/dev/null || true
|
||||
done
|
||||
}
|
||||
trap cleanup_bg EXIT INT TERM
|
||||
|
||||
spawn_bg xsettingsd
|
||||
spawn_bg dunst
|
||||
spawn_bg anode-statusd
|
||||
spawn_bg anode-powerd
|
||||
spawn_bg anode-touchd
|
||||
|
||||
if [ "${ANODE_TOUCH:-0}" = "1" ]; then
|
||||
spawn_bg anode-vkbd
|
||||
fi
|
||||
|
||||
if command -v dwm >/dev/null 2>&1; then
|
||||
dwm
|
||||
else
|
||||
printf 'anode-session: dwm executable not found\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
Executable
+156
@@ -0,0 +1,156 @@
|
||||
#!/bin/sh
|
||||
# ANODE Dunst notification theme & DPI scaler (strict POSIX sh)
|
||||
set -eu
|
||||
|
||||
: "${XDG_CONFIG_HOME:=$HOME/.config}"
|
||||
XRES="${1:-$HOME/.Xresources}"
|
||||
DUNST_DIR="$XDG_CONFIG_HOME/dunst"
|
||||
DUNST_RC="$DUNST_DIR/dunstrc"
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if [ ! -r "$XRES" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FONT_FACE="$(xres_get theme.fontFace "Fira Code")"
|
||||
SCALE="$(xres_get theme.scale "1.00")"
|
||||
BASE_SZ="$(xres_get theme.baseFontSize "15")"
|
||||
|
||||
BG_OVERLAY="$(xres_get theme.bgOverlay "#192231")"
|
||||
BG_URGENT="$(xres_get theme.dangerBg "#471d24")"
|
||||
FG_BRIGHT="$(xres_get theme.fgBright "#ffffff")"
|
||||
FG_MAIN="$(xres_get theme.fgMain "#e6e1cf")"
|
||||
BORDER="$(xres_get theme.border "#283444")"
|
||||
ACCENT="$(xres_get theme.accent "#59c2ff")"
|
||||
WARNING="$(xres_get theme.warning "#ffb454")"
|
||||
DANGER="$(xres_get theme.danger "#f07178")"
|
||||
|
||||
GEOM="$(awk -v s="$SCALE" -v bsz="$BASE_SZ" 'BEGIN {
|
||||
sc = s + 0.0
|
||||
if (sc < 0.50) sc = 0.50
|
||||
if (sc > 4.00) sc = 4.00
|
||||
w = int(340.0 * sc + 0.5); if (w < 220) w = 220
|
||||
hmax = int(180.0 * sc + 0.5); if (hmax < 80) hmax = 80
|
||||
ox = int(16.0 * sc + 0.5); if (ox < 8) ox = 8
|
||||
oy = int(42.0 * sc + 0.5); if (oy < 20) oy = 20
|
||||
pad = int(12.0 * sc + 0.5); if (pad < 6) pad = 6
|
||||
hpad = int(14.0 * sc + 0.5); if (hpad < 8) hpad = 8
|
||||
tpad = int(8.0 * sc + 0.5); if (tpad < 4) tpad = 4
|
||||
fw = int(2.0 * sc + 0.5); if (fw < 1) fw = 1
|
||||
rad = int(8.0 * sc + 0.5); if (rad < 4) rad = 4
|
||||
pbar_h = int(8.0 * sc + 0.5); if (pbar_h < 4) pbar_h = 4
|
||||
fpt = int(((bsz + 0.0) * 0.72) + 0.5); if (fpt < 8) fpt = 8
|
||||
printf "%d %d %d %d %d %d %d %d %d %d %d\n", w, hmax, ox, oy, pad, hpad, tpad, fw, rad, pbar_h, fpt
|
||||
}')"
|
||||
|
||||
set -- $GEOM
|
||||
D_W="$1" D_H="$2" D_OX="$3" D_OY="$4" D_PAD="$5" D_HPAD="$6" D_TPAD="$7" D_FW="$8" D_RAD="$9"
|
||||
shift 9
|
||||
D_PBAR="$1" D_FPT="$2"
|
||||
|
||||
mkdir -p "$DUNST_DIR"
|
||||
TMP_RC="$DUNST_RC.tmp.$$"
|
||||
|
||||
cat > "$TMP_RC" <<EOF
|
||||
# Managed by anode-sync-dunst-theme (scale=$SCALE)
|
||||
[global]
|
||||
monitor = 0
|
||||
follow = keyboard
|
||||
width = $D_W
|
||||
height = (10, $D_H)
|
||||
origin = top-right
|
||||
offset = ($D_OX, $D_OY)
|
||||
notification_limit = 4
|
||||
progress_bar = true
|
||||
progress_bar_height = $D_PBAR
|
||||
progress_bar_frame_width = 1
|
||||
progress_bar_corner_radius = 4
|
||||
highlight = "$ACCENT"
|
||||
indicate_hidden = yes
|
||||
separator_height = 2
|
||||
padding = $D_PAD
|
||||
horizontal_padding = $D_HPAD
|
||||
text_icon_padding = $D_TPAD
|
||||
frame_width = $D_FW
|
||||
frame_color = "$BORDER"
|
||||
separator_color = frame
|
||||
corner_radius = $D_RAD
|
||||
font = $FONT_FACE $D_FPT
|
||||
line_height = 2
|
||||
markup = full
|
||||
format = "<b>%s</b>\n%b"
|
||||
alignment = left
|
||||
vertical_alignment = center
|
||||
show_age_threshold = 60
|
||||
ellipsize = end
|
||||
word_wrap = yes
|
||||
stack_duplicates = true
|
||||
show_indicators = yes
|
||||
mouse_left_click = close_current
|
||||
mouse_middle_click = do_action, close_current
|
||||
mouse_right_click = close_all
|
||||
|
||||
[urgency_low]
|
||||
background = "$BG_OVERLAY"
|
||||
foreground = "$FG_MAIN"
|
||||
frame_color = "$BORDER"
|
||||
highlight = "$ACCENT"
|
||||
timeout = 4
|
||||
|
||||
[urgency_normal]
|
||||
background = "$BG_OVERLAY"
|
||||
foreground = "$FG_BRIGHT"
|
||||
frame_color = "$ACCENT"
|
||||
highlight = "$ACCENT"
|
||||
timeout = 6
|
||||
|
||||
[urgency_critical]
|
||||
background = "$BG_URGENT"
|
||||
foreground = "$FG_BRIGHT"
|
||||
frame_color = "$DANGER"
|
||||
highlight = "$WARNING"
|
||||
timeout = 0
|
||||
EOF
|
||||
|
||||
mv -f "$TMP_RC" "$DUNST_RC"
|
||||
|
||||
if [ -n "${DISPLAY:-}" ] && [ "${ANODE_NO_SIGNAL:-0}" != "1" ]; then
|
||||
if command -v dunstctl >/dev/null 2>&1; then
|
||||
dunstctl reload >/dev/null 2>&1 || true
|
||||
fi
|
||||
_dpids="$( (ps -eo pid=,comm= 2>/dev/null || ps -ax -o pid=,comm= 2>/dev/null || true) | awk '
|
||||
{ cmd=$2; sub(/^.*\//, "", cmd); if (cmd == "dunst") print $1 }
|
||||
' )"
|
||||
if [ -n "${_dpids:-}" ]; then
|
||||
for _p in $_dpids; do
|
||||
kill -HUP "$_p" 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
fi
|
||||
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
|
||||
Executable
+307
@@ -0,0 +1,307 @@
|
||||
#!/bin/sh
|
||||
# Detect OS, compiler capabilities, and X11/toolkit flags for ANODE.
|
||||
# Strictly POSIX sh; writes an atomic shell-sourceable build configuration.
|
||||
set -eu
|
||||
|
||||
OUT_FILE="${1:-build/flags.sh}"
|
||||
CC_BIN="${CC:-cc}"
|
||||
CXX_BIN="${CXX:-c++}"
|
||||
PKG_CFG="${PKG_CONFIG:-pkg-config}"
|
||||
WITH_GTKTTK="${WITH_GTKTTK:-auto}"
|
||||
|
||||
OS_NAME="$(uname -s 2>/dev/null || printf 'Unknown')"
|
||||
|
||||
# Ensure common BSD/Linux/pkgsrc pkg-config directories are searched.
|
||||
for pcdir in \
|
||||
/usr/local/lib/pkgconfig \
|
||||
/usr/local/libdata/pkgconfig \
|
||||
/usr/X11R6/lib/pkgconfig \
|
||||
/usr/X11R7/lib/pkgconfig \
|
||||
/usr/pkg/lib/pkgconfig \
|
||||
/usr/lib/pkgconfig \
|
||||
/usr/share/pkgconfig
|
||||
do
|
||||
if [ -d "$pcdir" ]; then
|
||||
case ":${PKG_CONFIG_PATH:-}:" in
|
||||
*":$pcdir:"*) ;;
|
||||
*) PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}$pcdir" ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
export PKG_CONFIG_PATH
|
||||
|
||||
if ! command -v "$PKG_CFG" >/dev/null 2>&1; then
|
||||
printf 'detect-env.sh: error: %s not found\n' "$PKG_CFG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p \
|
||||
build \
|
||||
build/common \
|
||||
build/dwm \
|
||||
build/dmenu \
|
||||
build/st \
|
||||
build/libgemui \
|
||||
build/apps \
|
||||
build/daemons \
|
||||
build/gtkTtk \
|
||||
build/tests
|
||||
|
||||
TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/anode-probe.XXXXXX")"
|
||||
cleanup() {
|
||||
rm -rf "$TMP_DIR"
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
require_pkgs() {
|
||||
for pkg in "$@"; do
|
||||
if ! "$PKG_CFG" --exists "$pkg" 2>/dev/null; then
|
||||
printf 'detect-env.sh: error: required pkg-config module "%s" not found\n' "$pkg" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
require_pkgs \
|
||||
x11 xext xft xinerama xrender xrandr xfixes xi xtst \
|
||||
fontconfig freetype2 pango pangoxft pangocairo cairo harfbuzz
|
||||
|
||||
# Probe openpty (libc vs -lutil)
|
||||
cat > "$TMP_DIR/pty.c" <<'EOF'
|
||||
#if defined(__linux__) || defined(__linux)
|
||||
#include <pty.h>
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#include <sys/types.h>
|
||||
#include <libutil.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <util.h>
|
||||
#endif
|
||||
int main(void) {
|
||||
int m = 0, s = 0;
|
||||
return openpty(&m, &s, 0, 0, 0);
|
||||
}
|
||||
EOF
|
||||
PTY_LIBS=""
|
||||
if "$CC_BIN" "$TMP_DIR/pty.c" -o "$TMP_DIR/pty.out" >/dev/null 2>&1; then
|
||||
PTY_LIBS=""
|
||||
elif "$CC_BIN" "$TMP_DIR/pty.c" -lutil -o "$TMP_DIR/pty.out" >/dev/null 2>&1; then
|
||||
PTY_LIBS="-lutil"
|
||||
fi
|
||||
|
||||
# Probe clock_gettime (libc vs -lrt)
|
||||
cat > "$TMP_DIR/rt.c" <<'EOF'
|
||||
#include <time.h>
|
||||
int main(void) {
|
||||
struct timespec ts;
|
||||
return clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
}
|
||||
EOF
|
||||
RT_LIBS=""
|
||||
if "$CC_BIN" "$TMP_DIR/rt.c" -o "$TMP_DIR/rt.out" >/dev/null 2>&1; then
|
||||
RT_LIBS=""
|
||||
elif "$CC_BIN" "$TMP_DIR/rt.c" -lrt -o "$TMP_DIR/rt.out" >/dev/null 2>&1; then
|
||||
RT_LIBS="-lrt"
|
||||
fi
|
||||
|
||||
# Probe crypt() and shadow.h vs BSD getpwnam(), with or without <crypt.h>
|
||||
HAVE_CRYPT_H=0
|
||||
cat > "$TMP_DIR/crypt_h.c" <<'EOF'
|
||||
#include <crypt.h>
|
||||
int main(void) { return 0; }
|
||||
EOF
|
||||
if "$CC_BIN" "$TMP_DIR/crypt_h.c" -o "$TMP_DIR/chk.out" >/dev/null 2>&1; then
|
||||
HAVE_CRYPT_H=1
|
||||
fi
|
||||
|
||||
cat > "$TMP_DIR/shadow.c" <<EOF
|
||||
#define _XOPEN_SOURCE 700
|
||||
#include <shadow.h>
|
||||
#include <unistd.h>
|
||||
$( [ "$HAVE_CRYPT_H" = "1" ] && printf '#include <crypt.h>\n' )
|
||||
int main(void) {
|
||||
struct spwd *sp = getspnam("root");
|
||||
(void)sp;
|
||||
return crypt("a", "aa") ? 0 : 1;
|
||||
}
|
||||
EOF
|
||||
cat > "$TMP_DIR/bsd_pw.c" <<EOF
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
$( [ "$HAVE_CRYPT_H" = "1" ] && printf '#include <crypt.h>\n' )
|
||||
int main(void) {
|
||||
struct passwd *pw = getpwnam("root");
|
||||
(void)pw;
|
||||
return crypt("a", "aa") ? 0 : 1;
|
||||
}
|
||||
EOF
|
||||
|
||||
CHECKPW_DEFS="-DHAVE_BSD_PASSWD=1"
|
||||
[ "$HAVE_CRYPT_H" = "1" ] && CHECKPW_DEFS="$CHECKPW_DEFS -DHAVE_CRYPT_H=1"
|
||||
CHECKPW_LIBS=""
|
||||
if "$CC_BIN" "$TMP_DIR/shadow.c" -o "$TMP_DIR/chk.out" >/dev/null 2>&1; then
|
||||
CHECKPW_DEFS="-DHAVE_SHADOW_H=1"
|
||||
[ "$HAVE_CRYPT_H" = "1" ] && CHECKPW_DEFS="$CHECKPW_DEFS -DHAVE_CRYPT_H=1"
|
||||
CHECKPW_LIBS=""
|
||||
elif "$CC_BIN" "$TMP_DIR/shadow.c" -lcrypt -o "$TMP_DIR/chk.out" >/dev/null 2>&1; then
|
||||
CHECKPW_DEFS="-DHAVE_SHADOW_H=1"
|
||||
[ "$HAVE_CRYPT_H" = "1" ] && CHECKPW_DEFS="$CHECKPW_DEFS -DHAVE_CRYPT_H=1"
|
||||
CHECKPW_LIBS="-lcrypt"
|
||||
elif "$CC_BIN" "$TMP_DIR/bsd_pw.c" -o "$TMP_DIR/chk.out" >/dev/null 2>&1; then
|
||||
CHECKPW_DEFS="-DHAVE_BSD_PASSWD=1"
|
||||
[ "$HAVE_CRYPT_H" = "1" ] && CHECKPW_DEFS="$CHECKPW_DEFS -DHAVE_CRYPT_H=1"
|
||||
CHECKPW_LIBS=""
|
||||
elif "$CC_BIN" "$TMP_DIR/bsd_pw.c" -lcrypt -o "$TMP_DIR/chk.out" >/dev/null 2>&1; then
|
||||
CHECKPW_DEFS="-DHAVE_BSD_PASSWD=1"
|
||||
[ "$HAVE_CRYPT_H" = "1" ] && CHECKPW_DEFS="$CHECKPW_DEFS -DHAVE_CRYPT_H=1"
|
||||
CHECKPW_LIBS="-lcrypt"
|
||||
fi
|
||||
|
||||
# Probe XScrnSaver for idle time tracking in anode-powerd
|
||||
POWERD_PKGS="x11 xext"
|
||||
POWERD_DEFS=""
|
||||
if "$PKG_CFG" --exists xscrnsaver 2>/dev/null; then
|
||||
POWERD_PKGS="x11 xext xscrnsaver"
|
||||
POWERD_DEFS="-DHAVE_XSCRNSAVER=1"
|
||||
fi
|
||||
|
||||
DWM_CFLAGS="$("$PKG_CFG" --cflags fontconfig freetype2 xft pango pangoxft harfbuzz x11 xinerama xrender)"
|
||||
DWM_LIBS="$("$PKG_CFG" --libs fontconfig freetype2 xft pango pangoxft harfbuzz x11 xinerama xrender)"
|
||||
|
||||
DMENU_CFLAGS="$("$PKG_CFG" --cflags fontconfig freetype2 xft pango pangoxft harfbuzz x11 xfixes xi xinerama)"
|
||||
DMENU_LIBS="$("$PKG_CFG" --libs fontconfig freetype2 xft pango pangoxft harfbuzz x11 xfixes xi xinerama) -lm"
|
||||
|
||||
ST_CFLAGS="$("$PKG_CFG" --cflags fontconfig freetype2 harfbuzz xft x11 xfixes xi)"
|
||||
ST_LIBS="$("$PKG_CFG" --libs fontconfig freetype2 harfbuzz xft x11 xfixes xi) -lm $RT_LIBS $PTY_LIBS"
|
||||
|
||||
GEMUI_CFLAGS="$("$PKG_CFG" --cflags x11 xext xft xinerama xrandr cairo pangocairo pango harfbuzz fontconfig freetype2)"
|
||||
GEMUI_LIBS="$("$PKG_CFG" --libs x11 xext xft xinerama xrandr cairo pangocairo pango harfbuzz fontconfig freetype2) -lm"
|
||||
|
||||
APP_CFLAGS="$("$PKG_CFG" --cflags x11 xext xft xinerama xrandr xtst cairo pangocairo pango harfbuzz fontconfig freetype2)"
|
||||
APP_LIBS="$("$PKG_CFG" --libs x11 xext xft xinerama xrandr xtst cairo pangocairo pango harfbuzz fontconfig freetype2) -lm"
|
||||
|
||||
TOUCHD_CFLAGS="$("$PKG_CFG" --cflags x11 xi xtst)"
|
||||
TOUCHD_LIBS="$("$PKG_CFG" --libs x11 xi xtst) -lm"
|
||||
|
||||
STATUSD_CFLAGS="$("$PKG_CFG" --cflags x11)"
|
||||
STATUSD_LIBS="$("$PKG_CFG" --libs x11)"
|
||||
|
||||
POWERD_CFLAGS="$POWERD_DEFS $("$PKG_CFG" --cflags $POWERD_PKGS)"
|
||||
POWERD_LIBS="$("$PKG_CFG" --libs $POWERD_PKGS)"
|
||||
|
||||
# Probe gtkTtk dependencies (gtk+-2.0, x11, tcl, tk, ttkTheme.h)
|
||||
GTKTTK_AVAILABLE="0"
|
||||
GTKTTK_REASON="disabled via WITH_GTKTTK=0"
|
||||
GTKTTK_CXXFLAGS=""
|
||||
GTKTTK_LDFLAGS=""
|
||||
|
||||
if [ "$WITH_GTKTTK" != "0" ]; then
|
||||
GTKTTK_REASON=""
|
||||
if ! "$PKG_CFG" --exists gtk+-2.0 x11 2>/dev/null; then
|
||||
GTKTTK_REASON="gtk+-2.0 development headers not found"
|
||||
else
|
||||
GTK2_C="$("$PKG_CFG" --cflags gtk+-2.0 x11)"
|
||||
GTK2_L="$("$PKG_CFG" --libs gtk+-2.0 x11)"
|
||||
TCL_C=""
|
||||
TCL_L=""
|
||||
|
||||
for tclmod in tcl tcl8.6 tcl86; do
|
||||
if "$PKG_CFG" --exists "$tclmod" 2>/dev/null; then
|
||||
TCL_C="$("$PKG_CFG" --cflags "$tclmod")"
|
||||
break
|
||||
fi
|
||||
done
|
||||
for tkmod in tk tk8.6 tk86; do
|
||||
if "$PKG_CFG" --exists "$tkmod" 2>/dev/null; then
|
||||
TCL_C="$TCL_C $("$PKG_CFG" --cflags "$tkmod")"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for incdir in \
|
||||
/usr/include \
|
||||
/usr/include/tcl8.6 \
|
||||
/usr/include/tk8.6 \
|
||||
/usr/include/tk8.6/tk-private/generic/ttk \
|
||||
/usr/include/tk/tk-private/generic/ttk \
|
||||
/usr/local/include \
|
||||
/usr/local/include/tcl8.6 \
|
||||
/usr/local/include/tk8.6 \
|
||||
/usr/local/include/tk8.6/generic/ttk \
|
||||
/usr/pkg/include \
|
||||
/usr/pkg/include/tcl \
|
||||
/usr/pkg/include/tk
|
||||
do
|
||||
if [ -d "$incdir" ]; then
|
||||
if [ -f "$incdir/tcl.h" ] || [ -f "$incdir/tk.h" ] || [ -f "$incdir/ttkTheme.h" ]; then
|
||||
TCL_C="$TCL_C -I$incdir"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for stubver in 8.6 86 8.7 ""; do
|
||||
for libdir in /usr/lib /usr/lib64 /usr/local/lib /usr/pkg/lib; do
|
||||
if [ -d "$libdir" ]; then
|
||||
:
|
||||
fi
|
||||
done
|
||||
if [ -n "$stubver" ]; then
|
||||
CAND_L="-ltclstub${stubver} -ltkstub${stubver}"
|
||||
else
|
||||
CAND_L="-ltclstub -ltkstub"
|
||||
fi
|
||||
cat > "$TMP_DIR/gtkttk_probe.cpp" <<'EOF'
|
||||
#include <tk.h>
|
||||
#include "ttkTheme.h"
|
||||
#include <gtk/gtk.h>
|
||||
int probe_fn(void) { return 0; }
|
||||
EOF
|
||||
if "$CXX_BIN" -shared -fPIC -DUSE_TCL_STUBS -DUSE_TK_STUBS -DUSE_TTK_STUBS \
|
||||
$GTK2_C $TCL_C "$TMP_DIR/gtkttk_probe.cpp" \
|
||||
$CAND_L $GTK2_L -o "$TMP_DIR/gtkttk_probe.so" >/dev/null 2>&1; then
|
||||
GTKTTK_AVAILABLE="1"
|
||||
GTKTTK_CXXFLAGS="$GTK2_C $TCL_C"
|
||||
GTKTTK_LDFLAGS="$CAND_L $GTK2_L"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$GTKTTK_AVAILABLE" != "1" ]; then
|
||||
GTKTTK_REASON="Tcl/Tk stub libraries or ttkTheme.h not found"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
escape_sh() {
|
||||
printf '%s' "$1" | sed "s/'/'\\\\''/g"
|
||||
}
|
||||
|
||||
TMP_OUT="${OUT_FILE}.tmp.$$"
|
||||
{
|
||||
printf '# Auto-generated by scripts/detect-env.sh (%s)\n' "$OS_NAME"
|
||||
printf "OS_NAME='%s'\n" "$(escape_sh "$OS_NAME")"
|
||||
printf "DWM_CFLAGS='%s'\n" "$(escape_sh "$DWM_CFLAGS")"
|
||||
printf "DWM_LIBS='%s'\n" "$(escape_sh "$DWM_LIBS")"
|
||||
printf "DMENU_CFLAGS='%s'\n" "$(escape_sh "$DMENU_CFLAGS")"
|
||||
printf "DMENU_LIBS='%s'\n" "$(escape_sh "$DMENU_LIBS")"
|
||||
printf "ST_CFLAGS='%s'\n" "$(escape_sh "$ST_CFLAGS")"
|
||||
printf "ST_LIBS='%s'\n" "$(escape_sh "$ST_LIBS")"
|
||||
printf "GEMUI_CFLAGS='%s'\n" "$(escape_sh "$GEMUI_CFLAGS")"
|
||||
printf "GEMUI_LIBS='%s'\n" "$(escape_sh "$GEMUI_LIBS")"
|
||||
printf "APP_CFLAGS='%s'\n" "$(escape_sh "$APP_CFLAGS")"
|
||||
printf "APP_LIBS='%s'\n" "$(escape_sh "$APP_LIBS")"
|
||||
printf "TOUCHD_CFLAGS='%s'\n" "$(escape_sh "$TOUCHD_CFLAGS")"
|
||||
printf "TOUCHD_LIBS='%s'\n" "$(escape_sh "$TOUCHD_LIBS")"
|
||||
printf "STATUSD_CFLAGS='%s'\n" "$(escape_sh "$STATUSD_CFLAGS")"
|
||||
printf "STATUSD_LIBS='%s'\n" "$(escape_sh "$STATUSD_LIBS")"
|
||||
printf "POWERD_CFLAGS='%s'\n" "$(escape_sh "$POWERD_CFLAGS")"
|
||||
printf "POWERD_LIBS='%s'\n" "$(escape_sh "$POWERD_LIBS")"
|
||||
printf "CHECKPW_DEFS='%s'\n" "$(escape_sh "$CHECKPW_DEFS")"
|
||||
printf "CHECKPW_LIBS='%s'\n" "$(escape_sh "$CHECKPW_LIBS")"
|
||||
printf "GTKTTK_AVAILABLE='%s'\n" "$(escape_sh "$GTKTTK_AVAILABLE")"
|
||||
printf "GTKTTK_REASON='%s'\n" "$(escape_sh "$GTKTTK_REASON")"
|
||||
printf "GTKTTK_CXXFLAGS='%s'\n" "$(escape_sh "$GTKTTK_CXXFLAGS")"
|
||||
printf "GTKTTK_LDFLAGS='%s'\n" "$(escape_sh "$GTKTTK_LDFLAGS")"
|
||||
} > "$TMP_OUT"
|
||||
mv -f "$TMP_OUT" "$OUT_FILE"
|
||||
Reference in new issue
Block a user