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
+55
-16
@@ -57,7 +57,20 @@ done
|
||||
|
||||
detect_edid_scale() {
|
||||
_dpi="96"
|
||||
if [ -n "${DISPLAY:-}" ] && command -v xrandr >/dev/null 2>&1; then
|
||||
if [ -n "${DISPLAY:-}" ] && command -v xdpyinfo >/dev/null 2>&1; then
|
||||
_xdpy_dpi="$(xdpyinfo 2>/dev/null | awk '/resolution:/ {
|
||||
split($2, a, "x")
|
||||
d = a[1] + 0
|
||||
if (d >= 48 && d <= 384 && (d < 94 || d > 98)) {
|
||||
print d
|
||||
exit
|
||||
}
|
||||
}' || true)"
|
||||
if [ -n "${_xdpy_dpi:-}" ]; then
|
||||
_dpi="$_xdpy_dpi"
|
||||
fi
|
||||
fi
|
||||
if [ "$_dpi" = "96" ] && [ -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/)) {
|
||||
@@ -82,12 +95,6 @@ detect_edid_scale() {
|
||||
_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
|
||||
@@ -113,19 +120,27 @@ CALC="$(awk -v raw="$SCALE" -v touch="$TOUCH" 'BEGIN {
|
||||
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
|
||||
if (gdk_scale <= 1) gdk_dpi = "1.0"
|
||||
else if (gdk_scale == 2) gdk_dpi = "0.5"
|
||||
else if (gdk_scale == 4) gdk_dpi = "0.25"
|
||||
else gdk_dpi = sprintf("%.3f", 1.0 / gdk_scale)
|
||||
raw_cur = 24.0 * s
|
||||
if (raw_cur < 20.0) cur_sz = 16
|
||||
else if (raw_cur < 32.0) cur_sz = 24
|
||||
else if (raw_cur < 44.0) cur_sz = 32
|
||||
else if (raw_cur < 64.0) cur_sz = 48
|
||||
else cur_sz = 64
|
||||
t = (touch == "1" || touch == 1) ? 1 : 0
|
||||
printf "%.2f %d %d %d %d\n", s, xft_dpi, gdk_scale, cur_sz, t
|
||||
printf "%.2f %d %d %s %d %d\n", s, xft_dpi, gdk_scale, gdk_dpi, cur_sz, t
|
||||
}')"
|
||||
|
||||
set -- $CALC
|
||||
SCALE="$1"
|
||||
XFT_DPI="$2"
|
||||
GDK_SCALE="$3"
|
||||
XCURSOR_SIZE="$4"
|
||||
TOUCH="$5"
|
||||
GDK_DPI_SCALE="$4"
|
||||
XCURSOR_SIZE="$5"
|
||||
TOUCH="$6"
|
||||
|
||||
mkdir -p "$CONF_DIR"
|
||||
|
||||
@@ -146,7 +161,7 @@ cat > "$TMP_ENV" <<EOF
|
||||
export ANODE_SCALE="$SCALE"
|
||||
export ANODE_TOUCH="$TOUCH"
|
||||
export GDK_SCALE="$GDK_SCALE"
|
||||
export GDK_DPI_SCALE="1.0"
|
||||
export GDK_DPI_SCALE="$GDK_DPI_SCALE"
|
||||
export ADW_DISABLE_PORTAL="1"
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR="0"
|
||||
export QT_ENABLE_HIGHDPI_SCALING="1"
|
||||
@@ -159,9 +174,33 @@ mv -f "$TMP_ENV" "$ENV_FILE"
|
||||
|
||||
if [ "$DO_APPLY" = "1" ]; then
|
||||
if [ -x "$SCRIPT_DIR/anode-apply-theme" ]; then
|
||||
"$SCRIPT_DIR/anode-apply-theme"
|
||||
ANODE_SCALE="$SCALE" ANODE_TOUCH="$TOUCH" "$SCRIPT_DIR/anode-apply-theme"
|
||||
elif command -v anode-apply-theme >/dev/null 2>&1; then
|
||||
anode-apply-theme
|
||||
ANODE_SCALE="$SCALE" ANODE_TOUCH="$TOUCH" anode-apply-theme
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${DISPLAY:-}" ] && [ "${ANODE_NO_SIGNAL:-0}" != "1" ]; then
|
||||
if command -v xsetroot >/dev/null 2>&1; then
|
||||
XCURSOR_SIZE="$XCURSOR_SIZE" xsetroot -cursor_name left_ptr >/dev/null 2>&1 || true
|
||||
fi
|
||||
if [ "${ANODE_NO_DBUS:-0}" != "1" ]; then
|
||||
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
|
||||
dbus-update-activation-environment --systemd \
|
||||
ANODE_SCALE="$SCALE" ANODE_TOUCH="$TOUCH" \
|
||||
GDK_SCALE="$GDK_SCALE" GDK_DPI_SCALE="$GDK_DPI_SCALE" \
|
||||
QT_SCALE_FACTOR="$SCALE" XCURSOR_SIZE="$XCURSOR_SIZE" >/dev/null 2>&1 || \
|
||||
dbus-update-activation-environment \
|
||||
ANODE_SCALE="$SCALE" ANODE_TOUCH="$TOUCH" \
|
||||
GDK_SCALE="$GDK_SCALE" GDK_DPI_SCALE="$GDK_DPI_SCALE" \
|
||||
QT_SCALE_FACTOR="$SCALE" XCURSOR_SIZE="$XCURSOR_SIZE" >/dev/null 2>&1 || true
|
||||
fi
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
systemctl --user set-environment \
|
||||
ANODE_SCALE="$SCALE" ANODE_TOUCH="$TOUCH" \
|
||||
GDK_SCALE="$GDK_SCALE" GDK_DPI_SCALE="$GDK_DPI_SCALE" \
|
||||
QT_SCALE_FACTOR="$SCALE" XCURSOR_SIZE="$XCURSOR_SIZE" >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user