|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# omarchy:summary=Show idle, screensaver, and lock diagnostics |
| 4 | +# omarchy:group=debug |
| 5 | +# omarchy:args=[log-lines] |
| 6 | +# omarchy:examples=omarchy debug idle | omarchy-debug-idle 400 |
| 7 | + |
| 8 | +lines=${1:-200} |
| 9 | +if [[ ! $lines =~ ^[0-9]+$ ]]; then |
| 10 | + lines=200 |
| 11 | +fi |
| 12 | + |
| 13 | +section() { |
| 14 | + printf '\n== %s ==\n' "$1" |
| 15 | +} |
| 16 | + |
| 17 | +section "Time" |
| 18 | +date -Is |
| 19 | + |
| 20 | +section "Idle IPC status" |
| 21 | +omarchy-shell idle status 2>&1 | jq . 2>/dev/null || omarchy-shell idle status 2>&1 || true |
| 22 | + |
| 23 | +section "Quickshell instances" |
| 24 | +quickshell list -p "$OMARCHY_PATH/shell" --any-display 2>&1 || true |
| 25 | + |
| 26 | +section "Recent idle logs" |
| 27 | +quickshell --no-color log -p "$OMARCHY_PATH/shell" --any-display --tail "$lines" --log-times -r 'quickshell.wayland.idle_notify=true' 2>&1 \ |
| 28 | + | grep -Ei 'omarchy idle|idle_notify|screensaver|lock|error|warn|failed' || true |
| 29 | + |
| 30 | +section "Relevant processes" |
| 31 | +ps -eo pid=,args= \ |
| 32 | + | grep -E 'quickshell -n -p|dbus-monitor.*PrepareForSleep|org\.omarchy\.screensaver|omarchy-screensaver|(^|/| )tte( |$)' \ |
| 33 | + | grep -v grep || true |
| 34 | + |
| 35 | +section "Hyprland screensaver clients" |
| 36 | +hyprctl clients -j 2>/dev/null \ |
| 37 | + | jq -r '.[] | select(.class == "org.omarchy.screensaver" or .initialClass == "org.omarchy.screensaver") | [.pid,.class,.initialClass,.title,.focusHistoryID] | @tsv' || true |
| 38 | + |
| 39 | +section "Idle inhibitors" |
| 40 | +hyprctl clients -j 2>/dev/null \ |
| 41 | + | jq -r '.[] | select(.inhibitingIdle == true or ((.tags // []) | index("noidle"))) | [.pid,.class,.title,((.tags // []) | join(",")),.inhibitingIdle] | @tsv' || true |
| 42 | + |
| 43 | +section "Screensaver detector" |
| 44 | +if hyprctl clients -j 2>/dev/null | jq -e '.[] | select(.class == "org.omarchy.screensaver" or .initialClass == "org.omarchy.screensaver")' >/dev/null; then |
| 45 | + echo "running-window" |
| 46 | +elif pgrep -f '[o]rg.omarchy.screensaver' >/dev/null; then |
| 47 | + echo "running-process" |
| 48 | +elif omarchy-toggle-enabled screensaver-off; then |
| 49 | + echo "disabled" |
| 50 | +else |
| 51 | + echo "stopped" |
| 52 | +fi |
| 53 | + |
| 54 | +section "Lock detector" |
| 55 | +omarchy-shell lock status 2>&1 | jq . 2>/dev/null || omarchy-shell lock status 2>&1 || true |
0 commit comments