mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-12 18:10:56 +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
76 lines
2.4 KiB
Bash
Executable File
76 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Desktop entry, MIME registration and verification for Unity Hub.
|
|
#
|
|
# Sourced by fix_unity.sh; split out to keep it under the 250-line cap.
|
|
# Sourced rather than run, so it inherits the caller's strict mode and
|
|
# the helper functions and variables defined above the source line.
|
|
|
|
create_handler_desktop() {
|
|
local exec_cmd="$1"
|
|
local dest="$DESKTOP_DIR/unityhub-url-handler.desktop"
|
|
log_info "Writing handler desktop entry: $dest"
|
|
cat >"$dest" <<DESK
|
|
[Desktop Entry]
|
|
Name=Unity Hub URL Handler
|
|
Comment=Handle unityhub:// links for Unity Hub sign-in
|
|
Exec=${exec_cmd}
|
|
Terminal=false
|
|
Type=Application
|
|
Icon=unityhub
|
|
Categories=Development;
|
|
StartupWMClass=Unity Hub
|
|
MimeType=x-scheme-handler/unityhub;x-scheme-handler/unity;
|
|
NoDisplay=true
|
|
DESK
|
|
log_ok "Desktop entry created/updated."
|
|
echo "$dest"
|
|
}
|
|
|
|
register_mime_handler() {
|
|
local desktop_file="$1"
|
|
# Update desktop database if available
|
|
if command -v update-desktop-database >/dev/null 2>&1; then
|
|
update-desktop-database "$DESKTOP_DIR" || true
|
|
else
|
|
log_warn "update-desktop-database not found (install desktop-file-utils)."
|
|
fi
|
|
|
|
# Register as default handler for both schemes
|
|
if command -v xdg-mime >/dev/null 2>&1; then
|
|
xdg-mime default "$(basename "$desktop_file")" x-scheme-handler/unityhub || true
|
|
xdg-mime default "$(basename "$desktop_file")" x-scheme-handler/unity || true
|
|
else
|
|
log_error "xdg-mime not found (install xdg-utils)."
|
|
return 1
|
|
fi
|
|
log_ok "MIME handler registered for unityhub:// (and unity://)."
|
|
}
|
|
|
|
verify_registration() {
|
|
local expected cur1 cur2
|
|
expected="$(basename "$1")"
|
|
cur1="$(xdg-mime query default x-scheme-handler/unityhub 2>/dev/null || true)"
|
|
cur2="$(xdg-mime query default x-scheme-handler/unity 2>/dev/null || true)"
|
|
log_info "Current handler (unityhub): ${cur1:-<none>}"
|
|
log_info "Current handler (unity): ${cur2:-<none>}"
|
|
if [[ $cur1 == "$expected" ]]; then
|
|
log_ok "unityhub scheme correctly set to $expected"
|
|
else
|
|
log_warn "unityhub scheme not set to $expected (currently: ${cur1:-none})."
|
|
fi
|
|
}
|
|
|
|
maybe_test_open() {
|
|
if [[ $RUN_TEST == true ]]; then
|
|
log_info "Opening test link: unityhub://v1/editor-signin"
|
|
if command -v xdg-open >/dev/null 2>&1; then
|
|
xdg-open 'unityhub://v1/editor-signin' >/dev/null 2>&1 || true
|
|
log_ok "Test link invoked. Check if Unity Hub launches or focuses."
|
|
else
|
|
log_warn "xdg-open not found; cannot run test automatically."
|
|
fi
|
|
else
|
|
log_info "You can test manually with: xdg-open 'unityhub://v1/editor-signin'"
|
|
fi
|
|
}
|