#!/bin/bash

# omarchy:summary=Lock the screen
# omarchy:group=system
# omarchy:name=lock
# omarchy:examples=omarchy system lock

pidof hyprlock || hyprlock &

# Set keyboard layout to default (first layout)
hyprctl switchxkblayout all 0 > /dev/null 2>&1

# Ensure 1password is locked
if pgrep -x "1password" >/dev/null; then
  1password --lock &
fi

# Avoid running screensaver when locked
pkill -f org.omarchy.screensaver
