aboutsummaryrefslogtreecommitdiffstats
path: root/system/usr
diff options
context:
space:
mode:
authorSpacedio <spacedio@thernusen.net>2026-06-03 22:39:11 -0400
committerSpacedio <spacedio@thernusen.net>2026-06-03 22:39:11 -0400
commit7846c1b33585a88333d2b0ac2270d0d304a2eeac (patch)
tree27839140aef97d0fd24b8bd405df1583edca86af /system/usr
parentc9631b31a16b18140b7e471193618f5618fd0521 (diff)
downloaddotfiles-7846c1b33585a88333d2b0ac2270d0d304a2eeac.tar.gz
Continuing work on the Polybar dGPU module. Switched from Pulseaudio to Pipewire.
Diffstat (limited to 'system/usr')
-rwxr-xr-xsystem/usr/gpu-toggle1
-rwxr-xr-xsystem/usr/polybar-gpu-trigger29
-rwxr-xr-xsystem/usr/system-maintenance5
-rwxr-xr-xsystem/usr/system-update2
4 files changed, 34 insertions, 3 deletions
diff --git a/system/usr/gpu-toggle b/system/usr/gpu-toggle
index 35d6c47..b44022f 100755
--- a/system/usr/gpu-toggle
+++ b/system/usr/gpu-toggle
@@ -1,4 +1,5 @@
#!/bin/bash
+# /usr/local/bin/gpu-toggle
# -------------------------------------------------------------------------
# GPU-TOGGLE: Discrete Graphics Power & Bus Management
diff --git a/system/usr/polybar-gpu-trigger b/system/usr/polybar-gpu-trigger
new file mode 100755
index 0000000..55b52fc
--- /dev/null
+++ b/system/usr/polybar-gpu-trigger
@@ -0,0 +1,29 @@
+#!/bin/bash
+# /usr/local/bin/polybar-gpu-trigger
+
+# 1. Critical sleep to prevent the udev timing race condition
+sleep 0.5
+
+# Find the Process ID (PID) of Polybar
+POLYBAR_PID=$(pgrep -x polybar)
+if [ -z "$POLYBAR_PID" ]; then
+ exit 0
+fi
+
+# Loop through found PIDs to locate the correct user context
+for pid in $POLYBAR_PID; do
+ if [ -f "/proc/$pid/environ" ]; then
+ USER_UID=$(stat -c "%u" "/proc/$pid")
+ USER_NAME=$(id -nu "$USER_UID")
+
+ # Safely parse the environment file for XDG_RUNTIME_DIR
+ XDG_DIR=$(tr '\0' '\n' < "/proc/$pid/environ" | grep '^XDG_RUNTIME_DIR=' | cut -d= -f2-)
+
+ if [ -n "$XDG_DIR" ]; then
+ # Drop root privileges and forcefully send the text directly into Polybar
+ sudo -u "$USER_NAME" XDG_RUNTIME_DIR="$XDG_DIR" \
+ polybar-msg action "#gpu-status.send.0" >/dev/null 2>&1
+ break
+ fi
+ fi
+done
diff --git a/system/usr/system-maintenance b/system/usr/system-maintenance
index d2918c6..f7a7051 100755
--- a/system/usr/system-maintenance
+++ b/system/usr/system-maintenance
@@ -1,4 +1,5 @@
#!/bin/bash
+# /usr/local/bin/system-maintenance
# Configuration
MARKER_FILE="/var/log/last_maintenance_timestamp"
@@ -14,7 +15,7 @@ if [ $((CURRENT_TIME - LAST_RUN)) -ge $INTERVAL ]; then
{
echo "-------------------------------------------"
echo "[$(date)] Starting weekly maintenance..."
-
+
# 1. Trim SSD
/usr/sbin/fstrim -v /
@@ -23,7 +24,7 @@ if [ $((CURRENT_TIME - LAST_RUN)) -ge $INTERVAL ]; then
# Update timestamp marker
touch "$MARKER_FILE"
-
+
echo "[$(date)] Maintenance complete."
} >> "$LOG_OUT" 2>&1
fi
diff --git a/system/usr/system-update b/system/usr/system-update
index 4187e46..79b26a8 100755
--- a/system/usr/system-update
+++ b/system/usr/system-update
@@ -1,5 +1,5 @@
#!/bin/bash
-# /usr/local/bin/sys-update
+# /usr/local/bin/system-update
# Formal system maintenance utility with administrative enforcement
LOG_FILE="/var/log/system-update.log"