20 lines
545 B
Bash
20 lines
545 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# If ANY external monitor exists, do NOT lock on lid close (clamshell use-case).
|
|
# Your internal panel is eDP-1.
|
|
# Anything not starting with eDP is treated as external.
|
|
|
|
if hyprctl monitors -j | grep -q '"name":"[^"]\+"' ; then
|
|
if hyprctl monitors -j | grep -q '"name":"DP-1"' ; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
# Generic: if any monitor is not eDP-1, assume external exists.
|
|
if hyprctl monitors -j | grep -q '"name":"[^"]\+"' && hyprctl monitors -j | grep -vq '"name":"eDP-1"'; then
|
|
exit 0
|
|
fi
|
|
|
|
exec hyprlock
|