fix lock on lid closed
This commit is contained in:
parent
55ac166402
commit
7d0c2d7937
@ -173,6 +173,7 @@
|
||||
{
|
||||
"colorizeDistroLogo": false,
|
||||
"colorizeSystemIcon": "secondary",
|
||||
"colorizeSystemText": "none",
|
||||
"customIconPath": "",
|
||||
"enableColorization": true,
|
||||
"icon": "noctalia",
|
||||
@ -398,7 +399,7 @@
|
||||
"customCommands": "[]",
|
||||
"enabled": true,
|
||||
"fadeDuration": 5,
|
||||
"lockCommand": "qs -c noctalia-shell ipc call session lock",
|
||||
"lockCommand": "sh -c '/usr/sbin/playerctl -a pause >/dev/null 2>&1 || true; /usr/sbin/qs -c noctalia-shell ipc call lockScreen lock'",
|
||||
"lockTimeout": 300,
|
||||
"resumeLockCommand": "",
|
||||
"resumeScreenOffCommand": "swaymsg \"output * dpms on\"",
|
||||
|
||||
@ -3,20 +3,19 @@
|
||||
action="$1"
|
||||
internal="${2:-eDP-1}"
|
||||
|
||||
active_count="$(swaymsg -t get_outputs | python3 -c 'import json,sys; print(sum(1 for o in json.load(sys.stdin) if o.get("active")))' 2>/dev/null)"
|
||||
external_active_count="$(swaymsg -t get_outputs | python3 -c 'import json,sys; internal=sys.argv[1]; outputs=json.load(sys.stdin); print(sum(1 for o in outputs if o.get("active") and o.get("name") != internal and not o.get("non_desktop", False)))' "$internal" 2>/dev/null)"
|
||||
|
||||
if [ -z "$active_count" ]; then
|
||||
active_count=1
|
||||
if [ -z "$external_active_count" ]; then
|
||||
external_active_count=0
|
||||
fi
|
||||
|
||||
case "$action" in
|
||||
on)
|
||||
if [ "$active_count" -le 1 ]; then
|
||||
qs -c noctalia-shell ipc call session lock
|
||||
sleep 1
|
||||
systemctl suspend
|
||||
else
|
||||
if [ "$external_active_count" -gt 0 ]; then
|
||||
swaymsg "output $internal disable"
|
||||
else
|
||||
/usr/sbin/playerctl -a pause >/dev/null 2>&1 || true
|
||||
/usr/sbin/qs -c noctalia-shell ipc call lockScreen lock
|
||||
fi
|
||||
;;
|
||||
off)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user