From ba0666999e6635f7b9914947ba69db1efd1bf71f Mon Sep 17 00:00:00 2001 From: RaphaelKimmig Date: Fri, 8 Aug 2025 21:11:35 +0200 Subject: [PATCH] Lock 1password on screen lock (#564) * feat: lock 1password on screen lock * chore: add migration for omarchy-lock-screen --- bin/omarchy-lock-screen | 12 ++++++++++++ bin/omarchy-menu | 2 +- config/hypr/hypridle.conf | 3 +-- migrations/1754679822.sh | 5 +++++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100755 bin/omarchy-lock-screen create mode 100644 migrations/1754679822.sh diff --git a/bin/omarchy-lock-screen b/bin/omarchy-lock-screen new file mode 100755 index 00000000..c8bb4bc6 --- /dev/null +++ b/bin/omarchy-lock-screen @@ -0,0 +1,12 @@ +#!/bin/bash + +# Lock the screen +pidof hyprlock || hyprlock + +# Ensure 1password is locked +if pgrep -x "1password" >/dev/null; then + 1password --lock +fi + +# Avoid running screensaver when locked +pkill -f "alacritty --class Screensaver" diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 388dee22..b29d192e 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -273,7 +273,7 @@ show_update_config_menu() { show_system_menu() { case $(menu "System" " Lock\n󰤄 Suspend\n Relaunch\n󰜉 Restart\n󰐥 Shutdown") in - *Lock*) hyprlock ;; + *Lock*) $OMARCHY_BIN_PATH/omarchy-lock-screen ;; *Suspend*) systemctl suspend ;; *Relaunch*) uwsm stop ;; *Restart*) systemctl reboot ;; diff --git a/config/hypr/hypridle.conf b/config/hypr/hypridle.conf index 2c568e37..4853dc9a 100644 --- a/config/hypr/hypridle.conf +++ b/config/hypr/hypridle.conf @@ -1,8 +1,7 @@ general { - lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances. + lock_cmd = omarchy-lock-screen # lock screen and 1password before_sleep_cmd = loginctl lock-session # lock before suspend. after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display. - on_lock_cmd = pkill -f "alacritty --class Screensaver" # avoid running screensaver when locked on_unlock_cmd = omarchy-restart-waybar # prevent stacking of waybar when waking } diff --git a/migrations/1754679822.sh b/migrations/1754679822.sh new file mode 100644 index 00000000..fa53f033 --- /dev/null +++ b/migrations/1754679822.sh @@ -0,0 +1,5 @@ +echo "Lock 1password on screen lock" + +if ! grep -q "omarchy-lock-screen" ~/.config/hypr/hypridle.conf; then + ~/.local/share/omarchy/bin/omarchy-refresh-hypridle +fi