mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-22 00:22:19 +01:00
Two levels of pure taxonomy carrying no information, and a 2-directory
cap leaves no room for them. Categories now sit directly under
linux_configuration/: features, fixes, utils, misc, fresh-install,
installers, diagnostics, gaming, boot_recovery, periodic_background, lib,
meta, tests. A script's own lib/ and tests/ are exempt from the cap, so
those stay put.
Depth violations 248 -> 139; roughly 40 of the remainder are inside
digital_wellbeing and hosts, deferred until the guard-lib repoint.
The moves are the easy half. What breaks is every path that counted
levels, and three classes of it had to be found by resolving paths rather
than reading diffs:
- 52 relative `source` lines for lib/common.sh and lib/android.sh. The
correct prefix differs per file: 40 were ../../ and 12 were ../../../,
so a blanket replace would have fixed one set and broken the other.
- REPO_ROOT in 7 fixes/lib/tests harnesses and setup_syncyomi_guard.sh,
each walking up four levels from a directory now two levels shallower.
This caused a real regression -- the fixes suite went red with
"log_warn: command not found" -- caught by running it and comparing
against the pre-move baseline worktree.
- conftest.py's sys.path entries, which took the pytest gate down with
14 collection errors, and the `# shellcheck source=` directives, which
took shellcheck down with SC1091.
16 symlinks in $HOME broke, including the entire i3blocks bar. All
repointed, and cpu_monitor/memory/disk/time/volume were run to confirm
they emit real output rather than merely resolving.
Verified: 1798 tests pass at 100% coverage, 8 of 9 lib/tests suites pass
(the ninth needs the coverage jail, identically at baseline), pre-commit
is clean, and the two untracked secret configs are still ignored after
their gitignore paths changed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
86 lines
2.6 KiB
Bash
Executable File
86 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# The status report and the usage text.
|
|
#
|
|
# Sourced by music_parallelism.sh; split out to keep it under the 250-line cap.
|
|
# Sourced rather than run, so it inherits the caller's strict mode and reads
|
|
# the interval and MUSIC_* configuration set above the source line.
|
|
|
|
# Show status
|
|
show_status() {
|
|
echo "Music Parallelism Monitor Status"
|
|
echo "================================="
|
|
echo ""
|
|
|
|
echo "Focus Applications (window-based detection):"
|
|
local focus_running=false
|
|
|
|
# Check windows (OPTIMIZED: single xdotool call with combined regex)
|
|
if command -v xdotool &>/dev/null && [[ ${#FOCUS_APPS_WINDOWS[@]} -gt 0 ]]; then
|
|
local regex
|
|
printf -v regex '%s|' "${FOCUS_APPS_WINDOWS[@]}"
|
|
regex="${regex%|}" # strip trailing |
|
|
if xdotool search --name "$regex" &>/dev/null 2>&1; then
|
|
echo " ✓ Focus window detected"
|
|
focus_running=true
|
|
fi
|
|
fi
|
|
|
|
# Check processes using shared /proc-based helper (fork-free)
|
|
if is_focus_app_running >/dev/null 2>&1; then
|
|
echo " ✓ Focus process running"
|
|
focus_running=true
|
|
fi
|
|
|
|
if ! $focus_running; then
|
|
echo " (none detected)"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Music Services:"
|
|
local music_running=false
|
|
if music_services=$(find_music_services 2>/dev/null); then
|
|
echo "$music_services" | while read -r svc; do
|
|
echo " ♪ $svc (RUNNING)"
|
|
done
|
|
music_running=true
|
|
fi
|
|
if ! $music_running; then
|
|
echo " (none detected)"
|
|
fi
|
|
|
|
echo ""
|
|
if $focus_running && $music_running; then
|
|
echo "⚠️ CONFLICT: Focus app and music running together!"
|
|
echo " Music would be killed in monitoring mode."
|
|
elif $focus_running; then
|
|
echo "✓ Focus mode active (no music playing)"
|
|
elif $music_running; then
|
|
echo "✓ Music playing (no focus app detected - this is fine)"
|
|
else
|
|
echo "✓ Idle (nothing detected)"
|
|
fi
|
|
}
|
|
|
|
# Show usage
|
|
show_usage() {
|
|
echo "Music Parallelism Prevention Script"
|
|
echo "===================================="
|
|
echo ""
|
|
echo "Usage: $0 [command]"
|
|
echo ""
|
|
echo "Commands:"
|
|
echo " monitor - Start monitoring (default, checks every ${CHECK_INTERVAL}s)"
|
|
echo " instant - Instant monitoring (${FAST_CHECK_INTERVAL}s active / ${IDLE_CHECK_INTERVAL}s idle)"
|
|
echo " status - Show current status of focus apps and music services"
|
|
echo " kill - Immediately kill all music services"
|
|
echo " help - Show this help message"
|
|
echo ""
|
|
echo "Description:"
|
|
echo " This script prevents multitasking between focus work and music."
|
|
echo " When a focus application (VS Code, Steam, etc.) is detected"
|
|
echo " alongside a music streaming service, the music is stopped."
|
|
echo ""
|
|
echo " Music is allowed when no focus apps are running."
|
|
echo ""
|
|
}
|