diff --git a/noctalia/settings.json b/noctalia/settings.json index e09ba7c..cda3c4a 100644 --- a/noctalia/settings.json +++ b/noctalia/settings.json @@ -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\"", diff --git a/sway/scripts/lid.sh b/sway/scripts/lid.sh index 2603e0c..324a4f8 100755 --- a/sway/scripts/lid.sh +++ b/sway/scripts/lid.sh @@ -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)