Fix theme apply timeout and add full HiDPI scaling for gtkTtk and GTK2
This commit is contained in:
1 parent
983d529ec3
commit
3ea7d35aba
28 files changed
+919
-299
No files matched your search
@@ -8,41 +8,47 @@ if [ ! -r "$XRES_FILE" ] && [ -r /etc/skel/.Xresources ]; then
|
||||
XRES_FILE="/etc/skel/.Xresources"
|
||||
fi
|
||||
|
||||
get_xres() {
|
||||
key="$1"
|
||||
def="$2"
|
||||
if [ -r "$XRES_FILE" ]; then
|
||||
val="$(awk -F: -v k="$key" '
|
||||
$0 !~ /^[[:space:]]*[!#]/ {
|
||||
kpart = $1
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", kpart)
|
||||
if (kpart == k) {
|
||||
sub(/^[^:]*:[[:space:]]*/, "", $0)
|
||||
gsub(/^[[:space:]"'\'']+|[[:space:]"'\'']+$/, "", $0)
|
||||
print $0
|
||||
}
|
||||
if [ -r "$XRES_FILE" ]; then
|
||||
eval "$(awk '
|
||||
$0 !~ /^[[:space:]]*[!#]/ {
|
||||
idx = index($0, ":")
|
||||
if (idx <= 0) next
|
||||
k = substr($0, 1, idx - 1)
|
||||
v = substr($0, idx + 1)
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", k)
|
||||
gsub(/^[[:space:]"'\'']+|[[:space:]"'\'']+$/, "", v)
|
||||
if (k == "theme.bgMain" || k == "theme.bgOverlay" || k == "theme.bgHeader" ||
|
||||
k == "theme.fgMain" || k == "theme.fgBright" || k == "theme.fgMuted" ||
|
||||
k == "theme.accent" || k == "theme.selBg" || k == "theme.border" ||
|
||||
k == "theme.danger" || k == "theme.dangerBg" || k == "theme.fontFace" ||
|
||||
k == "theme.baseFontSize") {
|
||||
sub(/^theme\./, "", k)
|
||||
gsub(/[^A-Za-z0-9_]/, "_", k)
|
||||
vals[k] = v
|
||||
}
|
||||
' "$XRES_FILE" | tail -n 1)"
|
||||
if [ -n "$val" ]; then
|
||||
printf '%s' "$val"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
printf '%s' "$def"
|
||||
}
|
||||
}
|
||||
END {
|
||||
for (k in vals) {
|
||||
s = vals[k]
|
||||
gsub(/'\''/, "'\''\\'\'''\''", s)
|
||||
printf "X_%s='\''%s'\''\n", k, s
|
||||
}
|
||||
}
|
||||
' "$XRES_FILE")"
|
||||
fi
|
||||
|
||||
BG_MAIN="$(get_xres "theme.bgMain" "#0f1419")"
|
||||
BG_OVERLAY="$(get_xres "theme.bgOverlay" "$(get_xres "theme.bgHeader" "$BG_MAIN")")"
|
||||
FG_MAIN="$(get_xres "theme.fgMain" "#e6e1cf")"
|
||||
FG_BRIGHT="$(get_xres "theme.fgBright" "$FG_MAIN")"
|
||||
FG_MUTED="$(get_xres "theme.fgMuted" "#7b8898")"
|
||||
ACCENT="$(get_xres "theme.accent" "$(get_xres "theme.selBg" "#59c2ff")")"
|
||||
BORDER="$(get_xres "theme.border" "#283444")"
|
||||
DANGER="$(get_xres "theme.danger" "#f07178")"
|
||||
DANGER_BG="$(get_xres "theme.dangerBg" "#4c1d24")"
|
||||
FONT_FACE="$(get_xres "theme.fontFace" "Fira Code")"
|
||||
BG_MAIN="${X_bgMain:-#0f1419}"
|
||||
BG_OVERLAY="${X_bgOverlay:-${X_bgHeader:-$BG_MAIN}}"
|
||||
FG_MAIN="${X_fgMain:-#e6e1cf}"
|
||||
FG_BRIGHT="${X_fgBright:-$FG_MAIN}"
|
||||
FG_MUTED="${X_fgMuted:-#7b8898}"
|
||||
ACCENT="${X_accent:-${X_selBg:-#59c2ff}}"
|
||||
BORDER="${X_border:-#283444}"
|
||||
DANGER="${X_danger:-#f07178}"
|
||||
DANGER_BG="${X_dangerBg:-#4c1d24}"
|
||||
FONT_FACE="${X_fontFace:-Fira Code}"
|
||||
|
||||
BASE_SIZE="$(get_xres "theme.baseFontSize" "32")"
|
||||
BASE_SIZE="${X_baseFontSize:-32}"
|
||||
case "$BASE_SIZE" in
|
||||
''|*[!0-9]*) BASE_SIZE=32 ;;
|
||||
esac
|
||||
@@ -129,7 +135,7 @@ mv -f "$OUT_CONF.tmp" "$OUT_CONF"
|
||||
|
||||
if [ "${1:-}" != "--no-restart" ] && command -v dunstctl >/dev/null 2>&1; then
|
||||
if pidof dunst >/dev/null 2>&1; then
|
||||
dunstctl reload "$OUT_CONF" 2>/dev/null || {
|
||||
dunstctl reload "$OUT_CONF" >/dev/null 2>&1 || {
|
||||
killall -q dunst 2>/dev/null || true
|
||||
DISPLAY="${DISPLAY:-:0}" dunst -config "$OUT_CONF" >/dev/null 2>&1 </dev/null &
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user