When you are watching a video, giving a presentation, or running a long build, automatic screen lock gets in the way. On Omarchy (Hyprland + hypridle), there is no built-in toggle for it.
omarchy-toggle-lock adds a keybinding to turn automatic screen lock on and off. A small Waybar indicator shows an open lock icon when the lock is disabled. Otherwise, nothing is shown.
Lock before suspend (before_sleep_cmd) stays active regardless of the toggle, so your machine still locks when it goes to sleep.
Requirements
- Omarchy (Hyprland, hypridle, Waybar)
Installation
git clone https://github.com/AlexZeitler/omarchy-toggle-lock.git
cd omarchy-toggle-lock
./install.shThe install script will:
- Copy
toggle-lockandlock-session-if-enabledto~/.local/bin/ - Patch
~/.config/hypr/hypridle.confto use the toggle-aware lock command - Add a Waybar custom module with an automatically chosen free signal number
- Append the indicator styles to
~/.config/waybar/style.css - Add a
SUPER SHIFT + Lkeybinding to~/.config/hypr/overrides.conf - Restart Waybar
How it works
toggle-lockcreates or removes~/.cache/screen-lock-disabledand signals Waybar to updatelock-session-if-enabledchecks for that file before callingloginctl lock-session- Waybar reads the state file and shows the indicator accordingly
You can also click the indicator in Waybar to toggle the lock state.
Manual Waybar setup
If the install script could not patch your Waybar config automatically, add "custom/lock-indicator" to your modules list in ~/.config/waybar/config.jsonc, then add the module definition:
"custom/lock-indicator": {
"on-click": "toggle-lock",
"exec": "if [ -f ~/.cache/screen-lock-disabled ]; then echo '{\"text\": \"\u\", \"tooltip\": \"Screen lock disabled\", \"class\": \"active\"}'; else echo '{\"text\": \"\"}'; fi",
"signal": 11,
"return-type": "json"
}Make sure the signal number is not already used by another custom module.
The source code is on GitHub.
