omarchy-toggle-lock - toggle automatic screen lock on Hyprland

Published on Friday, April 3, 2026

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.

Waybar indicator showing the lock icon when screen lock is disabled

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.sh

The install script will:

  • Copy toggle-lock and lock-session-if-enabled to ~/.local/bin/
  • Patch ~/.config/hypr/hypridle.conf to 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 + L keybinding to ~/.config/hypr/overrides.conf
  • Restart Waybar

How it works

  • toggle-lock creates or removes ~/.cache/screen-lock-disabled and signals Waybar to update
  • lock-session-if-enabled checks for that file before calling loginctl 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.

What are your thoughts about
"omarchy-toggle-lock - toggle automatic screen lock on Hyprland"?
Drop me a line - I'm looking forward to your feedback!