resources/dev

Sway Window Manager

Issue dpms

My original idle command was

exec swayidle -w \
    timeout 300 $lock_screen \
    timeout 600 'swaymsg "output * dpms off"' \
         resume 'swaymsg "output * dpms on"' \
    before-sleep $lock_screen

With this command my laptop screen would never turn back on, even manually calling swaymsg "output eDP-1 dpms on" would not do anything.

My workaround is to only turn off screens that are not my laptop:

#!/bin/bash
OUTPUTS=$(swaymsg -t get_outputs --raw | jq '.[] | .name')
for OUTPUT in $OUTPUTS; do
  if [ "$OUTPUT" == "\"eDP-1\"" ]; then
    continue
  fi
  swaymsg "output $OUTPUT dpms off"
done