Workspace Session Recovery
The workspace session scripts save the current Hyprland clients to JSON, then restore the latest capture by moving existing windows back to their saved workspaces and relaunching the supported missing apps.
Use this before risky layout work, before restarting Hyprland, or when you want a quick recovery point for open workspaces.
Capture a session
Section titled “Capture a session”Capture every visible workspace:
workspace-captureCapture only the active workspace:
workspace-capture --current-workspaceBy default captures are written to:
~/.local/state/workspace-sessions/workspace-<timestamp>.jsonThe script also writes a capture log to:
~/.local/state/workspace-sessions/capture.logTo write a named capture:
workspace-capture --output=~/workspace-before-restart.jsonRestore safely
Section titled “Restore safely”Start with a dry run. It prints the restore plan without launching or moving windows:
workspace-restore --dry-runRestore the newest capture from the state directory:
workspace-restoreRestore a specific file:
workspace-restore --file=~/workspace-before-restart.jsonThe restore log is written to:
~/.local/state/workspace-sessions/restore.logWhat gets restored
Section titled “What gets restored”The restore script reads hyprctl -j clients and tries these paths in order:
- Reuse a still-running window by saved address.
- Match an existing window by class and workspace.
- Launch a supported missing app, then move it to the saved workspace.
- Restore floating geometry or tiled size when the saved client has enough geometry data.
- Switch back to the saved active workspace at the end.
Supported relaunch paths are encoded in workspace-restore and currently cover Chromium, work Chrome app windows, Slack, Discord, Twitch webapps, generic Chrome webapps with captured URLs, and Ghostty terminals with the saved working directory.
Unsupported classes are skipped with a reason in the restore output.
Browser URLs
Section titled “Browser URLs”workspace-capture can attach a real browser URL when the browser URL state file exists:
${XDG_STATE_HOME:-~/.local/state}/browser-urls.jsonWhen that file is missing, Chromium windows can still be matched or relaunched by class, but generic webapp URL recovery is limited.
Workspace menu
Section titled “Workspace menu”The Walker menu wraps the common actions:
workspace-menuThe shared Hypr binding is:
SUPER+ALT+WIt offers capture, dry-run restore, restore, and relayout actions. On the desktop host it also exposes the host-specific workspace setup action.
Recovery flow
Section titled “Recovery flow”- Run
workspace-capturebefore the risky change. - Make the change, restart Hyprland, or recover from the crash.
- Run
workspace-restore --dry-runand read the plan. - Run
workspace-restorewhen the plan looks safe. - Check
restore.logfor skipped windows.
Troubleshooting
Section titled “Troubleshooting”If nothing restores, check that a capture exists:
ls ~/.local/state/workspace-sessionsIf restore launches too much, try moving only existing windows:
workspace-restore --no-launchIf restore launches apps but leaves current placement alone:
workspace-restore --no-moveIf you want to inspect one capture directly:
jq '.clients[] | {workspace: .workspace.id, class, title, browser_url}' ~/.local/state/workspace-sessions/workspace-*.jsonRollback
Section titled “Rollback”The restore script only moves, resizes, and launches windows. There is no persistent layout state to undo. Move windows manually or rerun a better capture file with --file=....