Integrate managed lock screen recovery
This commit is contained in:
1 parent
a80a6f4dda
commit
3e98cc2216
9 files changed
+100
-8
No files matched your search
@@ -102,7 +102,7 @@ class RepairResult:
|
||||
|
||||
CHECK_ORDER = (
|
||||
"desktop.hyprland", "desktop.quickshell", "desktop.notifications", "desktop.portals",
|
||||
"desktop.hyprpaper", "desktop.hypridle", "desktop.vicinae", "input.pipewire",
|
||||
"desktop.hyprpaper", "desktop.hypridle", "desktop.hyprlock", "desktop.vicinae", "input.pipewire",
|
||||
"input.clipboard", "input.wallpaper", "input.capture", "input.ocr", "input.brightness",
|
||||
"integration.nextcloud", "integration.rustdesk", "integration.kdeconnect", "integration.bluebubbles",
|
||||
"integration.home-assistant", "integration.calendar", "panama.runtime-links", "panama.vicinae-commands",
|
||||
@@ -159,6 +159,7 @@ CHECK_TITLES = {
|
||||
"desktop.portals": "Desktop portals",
|
||||
"desktop.hyprpaper": "Hyprpaper",
|
||||
"desktop.hypridle": "Hypridle",
|
||||
"desktop.hyprlock": "Lock screen",
|
||||
"desktop.vicinae": "Vicinae",
|
||||
"input.pipewire": "PipeWire",
|
||||
"input.clipboard": "Clipboard",
|
||||
@@ -320,6 +321,41 @@ def check_portals(config: DoctorConfig) -> Check:
|
||||
return Check("desktop.portals", "desktop-foundation", "Desktop portals", "warning", detail)
|
||||
|
||||
|
||||
def check_hyprlock(config: DoctorConfig) -> Check:
|
||||
helper = config.root / "config/dot/quickshell/scripts/panama-lock"
|
||||
tracked_fallback = config.config_home / "hypr/hyprlock.conf"
|
||||
generated_config = config.state_home / "panama/hyprlock.conf"
|
||||
# The doctor seals PATH for every probe. Invoke the authored helper with a
|
||||
# fixed system-only PATH so its bash shebang and jq dependency remain
|
||||
# available without inheriting arbitrary parent executables.
|
||||
result = run_command(("/usr/bin/env", "PATH=/usr/bin:/bin", str(helper), "status"), config)
|
||||
|
||||
if result.state != "ok":
|
||||
if tracked_fallback.is_file():
|
||||
return Check("desktop.hyprlock", "desktop-foundation", "Lock screen", "warning", "Managed lock-screen status is unavailable; the tracked fallback remains available.")
|
||||
return Check("desktop.hyprlock", "desktop-foundation", "Lock screen", "error", "No usable lock-screen configuration is available.")
|
||||
|
||||
try:
|
||||
state = json.loads(result.stdout)
|
||||
generated = state["generated"]
|
||||
path = state["path"]
|
||||
fallback = state["fallback"]
|
||||
error = state["error"]
|
||||
if not isinstance(generated, bool) or not isinstance(path, str) \
|
||||
or not isinstance(fallback, bool) or not isinstance(error, str):
|
||||
raise ValueError
|
||||
except (json.JSONDecodeError, KeyError, TypeError, ValueError):
|
||||
if tracked_fallback.is_file():
|
||||
return Check("desktop.hyprlock", "desktop-foundation", "Lock screen", "warning", "Managed lock-screen status is invalid; the tracked fallback remains available.")
|
||||
return Check("desktop.hyprlock", "desktop-foundation", "Lock screen", "error", "No usable lock-screen configuration is available.")
|
||||
|
||||
if generated and not fallback and generated_config.is_file():
|
||||
return Check("desktop.hyprlock", "desktop-foundation", "Lock screen", "ok", "Managed lock-screen configuration is available.")
|
||||
if tracked_fallback.is_file():
|
||||
return Check("desktop.hyprlock", "desktop-foundation", "Lock screen", "warning", "The tracked lock-screen fallback is in use.")
|
||||
return Check("desktop.hyprlock", "desktop-foundation", "Lock screen", "error", "No usable lock-screen configuration is available.")
|
||||
|
||||
|
||||
def check_brightness(config: DoctorConfig) -> Check:
|
||||
result = run_command(("panama-brightness", "list"), config)
|
||||
instructions = Action("instructions", "View setup instructions", target="ddc-permissions")
|
||||
@@ -514,7 +550,7 @@ def unavailable_versions() -> list[dict[str, str]]:
|
||||
def collect_checks(config: DoctorConfig) -> list[Check]:
|
||||
probes: dict[str, Callable[[], Check]] = {
|
||||
"desktop.hyprland": lambda: check_hyprland(config), "desktop.quickshell": lambda: check_quickshell(config), "desktop.notifications": lambda: check_notifications(config), "desktop.portals": lambda: check_portals(config),
|
||||
"desktop.hyprpaper": lambda: service_check("desktop.hyprpaper", "Hyprpaper", "hyprpaper", config, Action("repair", "Restart Hyprpaper")), "desktop.hypridle": lambda: service_check("desktop.hypridle", "Hypridle", "hypridle", config, Action("repair", "Restart Hypridle")), "desktop.vicinae": lambda: service_check("desktop.vicinae", "Vicinae", "vicinae", config, Action("repair", "Restart Vicinae")), "input.pipewire": lambda: service_check("input.pipewire", "PipeWire", "pipewire", config),
|
||||
"desktop.hyprpaper": lambda: service_check("desktop.hyprpaper", "Hyprpaper", "hyprpaper", config, Action("repair", "Restart Hyprpaper")), "desktop.hypridle": lambda: service_check("desktop.hypridle", "Hypridle", "hypridle", config, Action("repair", "Restart Hypridle")), "desktop.hyprlock": lambda: check_hyprlock(config), "desktop.vicinae": lambda: service_check("desktop.vicinae", "Vicinae", "vicinae", config, Action("repair", "Restart Vicinae")), "input.pipewire": lambda: service_check("input.pipewire", "PipeWire", "pipewire", config),
|
||||
"input.clipboard": lambda: simple_ipc_check("input.clipboard", "Clipboard", "clipboard", config), "input.wallpaper": lambda: simple_ipc_check("input.wallpaper", "Wallpaper", "wallpaper", config), "input.capture": lambda: simple_ipc_check("input.capture", "Capture", "capture", config), "input.ocr": lambda: executable_check("input.ocr", "OCR", "tesseract", config), "input.brightness": lambda: check_brightness(config),
|
||||
"integration.nextcloud": lambda: check_nextcloud(config), "integration.rustdesk": lambda: check_rustdesk(config), "integration.kdeconnect": lambda: check_kdeconnect(config), "integration.bluebubbles": lambda: check_bluebubbles(config), "integration.home-assistant": lambda: check_home_assistant(config), "integration.calendar": lambda: check_calendar(config),
|
||||
"panama.runtime-links": lambda: check_runtime_links(config), "panama.vicinae-commands": lambda: check_vicinae_commands(config), "panama.selected-terminal": lambda: executable_check("panama.selected-terminal", "Selected terminal", "kitty", config), "panama.selected-launcher": lambda: executable_check("panama.selected-launcher", "Selected launcher", "vicinae", config), "panama.processes": lambda: check_processes(config), "panama.caffeine": lambda: check_caffeine(config),
|
||||
|
||||
@@ -50,6 +50,8 @@ Singleton {
|
||||
return String(DesktopPreferences.get("wallpaperPath") ?? "");
|
||||
}
|
||||
property var applyWallpaper: function(path) { Wallpaper.set(path); }
|
||||
property var regenerateLock: function() { LockScreen.regenerate(); }
|
||||
property var lockBusy: function() { return LockScreen.busy; }
|
||||
property var reloadShell: function() { Quickshell.reload(false); }
|
||||
property var protectedDisplays: ({})
|
||||
|
||||
@@ -119,6 +121,7 @@ Singleton {
|
||||
root.applyCompositor();
|
||||
root.reloadKeybinds();
|
||||
root.applyWallpaper(root.currentWallpaper());
|
||||
root.regenerateLock();
|
||||
|
||||
settleReload.attempts = 0;
|
||||
settleReload.restart();
|
||||
@@ -135,7 +138,7 @@ Singleton {
|
||||
// Let the current instances finish their external writes before a
|
||||
// soft reload replaces them. The cap keeps a failed external tool
|
||||
// from leaving restored Home state stale indefinitely.
|
||||
if ((!root.keybindsReloading() && !root.systemBusy()) || attempts >= 30) {
|
||||
if ((!root.keybindsReloading() && !root.systemBusy() && !root.lockBusy()) || attempts >= 30) {
|
||||
stop();
|
||||
root.setDisplayBlocked(false);
|
||||
root.protectedDisplays = ({});
|
||||
|
||||
@@ -42,6 +42,8 @@ Singleton {
|
||||
property var reloadKeybinds: function() { Keybinds.applyReload(); }
|
||||
property var keybindsReloading: function() { return Keybinds.reloading; }
|
||||
property var applyWallpaper: function(path) { Wallpaper.set(path); }
|
||||
property var regenerateLock: function() { LockScreen.regenerate(); }
|
||||
property var lockBusy: function() { return LockScreen.busy; }
|
||||
|
||||
readonly property bool busy: monitorQuery.running || serviceQuery.running || versionQuery.running
|
||||
|| configWrite.running || configVerify.running || bluebubblesQuery.running
|
||||
@@ -537,6 +539,7 @@ Singleton {
|
||||
root.applyPersistedDisplayPolicy();
|
||||
root.reloadKeybinds();
|
||||
root.applyWallpaper(String(DesktopPreferences.get("wallpaperPath") ?? ""));
|
||||
root.regenerateLock();
|
||||
resetRelease.attempts = 0;
|
||||
resetRelease.restart();
|
||||
}
|
||||
@@ -549,7 +552,7 @@ Singleton {
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
attempts++;
|
||||
if ((!root.keybindsReloading() && !root.busy) || attempts >= 50) {
|
||||
if ((!root.keybindsReloading() && !root.busy && !root.lockBusy()) || attempts >= 50) {
|
||||
stop();
|
||||
root.setDisplayBlocked(false);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@ ShellRoot {
|
||||
SettingsBackup.systemBusy = function() { return false; };
|
||||
SettingsBackup.currentWallpaper = function() { return "/tmp/restored-wallpaper.jpg"; };
|
||||
SettingsBackup.applyWallpaper = function(path) { root.record("wallpaper.set:" + path); };
|
||||
SettingsBackup.regenerateLock = function() { root.record("lock.regenerate"); };
|
||||
SettingsBackup.lockBusy = function() { return false; };
|
||||
SettingsBackup.reloadShell = function() { root.record("shell.reload"); };
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ ShellRoot {
|
||||
SystemSettings.reloadKeybinds = function() { root.recordReset("keybinds.reload"); };
|
||||
SystemSettings.keybindsReloading = function() { return false; };
|
||||
SystemSettings.applyWallpaper = function(path) { root.recordReset("wallpaper.set:" + path); };
|
||||
SystemSettings.regenerateLock = function() { root.recordReset("lock.regenerate"); };
|
||||
SystemSettings.lockBusy = function() { return false; };
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
|
||||
Reference in new issue
Block a user