feat: improve session switching, fractional DPI/GTK theming, XDG launcher, CPU/RAM status, and power policy
This commit is contained in:
1 parent
72b05b650e
commit
07d9134d2d
28 files changed
+2670
-302
No files matched your search
+79
-10
@@ -54,13 +54,16 @@ if [ -z "$XTH_FILE" ] || [ ! -r "$XTH_FILE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCALE="1.00"
|
||||
TOUCH="0"
|
||||
SCALE=""
|
||||
TOUCH=""
|
||||
if [ -f "$SCALE_CONF" ]; then
|
||||
. "$SCALE_CONF"
|
||||
else
|
||||
if [ -n "${ANODE_SCALE:-}" ]; then SCALE="$ANODE_SCALE"; fi
|
||||
if [ -n "${ANODE_TOUCH:-}" ]; then TOUCH="$ANODE_TOUCH"; fi
|
||||
fi
|
||||
if [ -n "${ANODE_SCALE:-}" ]; then SCALE="$ANODE_SCALE"; fi
|
||||
if [ -n "${ANODE_TOUCH:-}" ]; then TOUCH="$ANODE_TOUCH"; fi
|
||||
: "${SCALE:=1.00}"
|
||||
: "${TOUCH:=0}"
|
||||
|
||||
THEME_NAME="$(awk -F: '/^theme\.name[[:space:]]*:/ { sub(/^[[:space:]]+/, "", $2); print $2; exit }' "$XTH_FILE" || true)"
|
||||
if [ -z "$THEME_NAME" ]; then
|
||||
@@ -68,6 +71,54 @@ if [ -z "$THEME_NAME" ]; then
|
||||
fi
|
||||
|
||||
mkdir -p "$CONF_DIR"
|
||||
LOCAL_XRES="$CONF_DIR/Xresources.local"
|
||||
PRESERVED_ST=""
|
||||
if [ -r "$HOME/.Xresources" ]; then
|
||||
_lfile_arg=""
|
||||
if [ -r "$LOCAL_XRES" ]; then
|
||||
_lfile_arg="$LOCAL_XRES"
|
||||
fi
|
||||
PRESERVED_ST="$(awk -v lfile="$_lfile_arg" '
|
||||
function trim(s) {
|
||||
gsub(/^[ \t\r\n]+|[ \t\r\n]+$/, "", s)
|
||||
return s
|
||||
}
|
||||
BEGIN {
|
||||
if (lfile != "") {
|
||||
while ((getline line < lfile) > 0) {
|
||||
sl = trim(line)
|
||||
if (sl == "" || substr(sl, 1, 1) == "!" || substr(sl, 1, 1) == "#") continue
|
||||
pl = index(sl, ":")
|
||||
if (pl > 0) {
|
||||
kl = trim(substr(sl, 1, pl - 1))
|
||||
local_keys[kl] = 1
|
||||
}
|
||||
}
|
||||
close(lfile)
|
||||
}
|
||||
}
|
||||
/^[ \t]*![ \t]*User overrides from Xresources\.local/ { exit }
|
||||
{
|
||||
s = trim($0)
|
||||
if (s == "" || substr(s, 1, 1) == "!" || substr(s, 1, 1) == "#") next
|
||||
p = index(s, ":")
|
||||
if (p > 0) {
|
||||
k = trim(substr(s, 1, p - 1))
|
||||
if (substr(k, 1, 3) == "St." && !(k in local_keys)) {
|
||||
if (!(k in seen)) {
|
||||
seen[k] = 1
|
||||
order[++n] = k
|
||||
}
|
||||
lines[k] = s
|
||||
}
|
||||
}
|
||||
}
|
||||
END {
|
||||
for (i = 1; i <= n; i++) print lines[order[i]]
|
||||
}
|
||||
' "$HOME/.Xresources" 2>/dev/null || true)"
|
||||
fi
|
||||
|
||||
TMP_XRES="$HOME/.Xresources.tmp.$$"
|
||||
|
||||
awk -v scale_str="$SCALE" -v touch_str="$TOUCH" -v tname="$THEME_NAME" '
|
||||
@@ -118,17 +169,20 @@ END {
|
||||
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
|
||||
raw_cur = cur_sz * s
|
||||
if (raw_cur < 20.0) scaled_cur = 16
|
||||
else if (raw_cur < 32.0) scaled_cur = 24
|
||||
else if (raw_cur < 44.0) scaled_cur = 32
|
||||
else if (raw_cur < 64.0) scaled_cur = 48
|
||||
else scaled_cur = 64
|
||||
|
||||
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)
|
||||
scaled_dm_lh = rint(26.0 * s)
|
||||
if (scaled_dm_lh < 20) scaled_dm_lh = 20
|
||||
if (t == 1 && scaled_dm_lh < rint(36.0 * s)) scaled_dm_lh = rint(36.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"
|
||||
@@ -185,6 +239,21 @@ END {
|
||||
}
|
||||
' "$XTH_FILE" > "$TMP_XRES"
|
||||
|
||||
if [ -n "${PRESERVED_ST:-}" ]; then
|
||||
{
|
||||
printf '\n! Preserved user St.* overrides\n'
|
||||
printf '%s\n' "$PRESERVED_ST"
|
||||
} >> "$TMP_XRES"
|
||||
fi
|
||||
|
||||
if [ -r "$LOCAL_XRES" ]; then
|
||||
{
|
||||
printf '\n! User overrides from Xresources.local\n'
|
||||
cat "$LOCAL_XRES"
|
||||
printf '\n'
|
||||
} >> "$TMP_XRES"
|
||||
fi
|
||||
|
||||
mv -f "$TMP_XRES" "$HOME/.Xresources"
|
||||
|
||||
TMP_TC="$THEME_CONF.tmp.$$"
|
||||
|
||||
Reference in new issue
Block a user