]> git.mdlowis.com Git - proto/labwc.git/commitdiff
docs/autostart: add swayidle with wlopm example
authorJohan Malm <jgm323@gmail.com>
Thu, 21 Apr 2022 20:22:10 +0000 (21:22 +0100)
committerJohan Malm <jgm323@gmail.com>
Thu, 21 Apr 2022 20:22:10 +0000 (21:22 +0100)
...to turn outputs on/off following the addition of
wlr-output-power-management protocol support (commit c23397f3)

docs/autostart

index d382408bd38ee2043d68fe176fcfcaf7ab8e5932..c79f1c34faf0437665af782a734c81ebcabc4e9b 100644 (file)
@@ -20,14 +20,24 @@ waybar >/dev/null 2>&1 &
 # as mako to function correctly. Thunderbird is an example of this.
 mako >/dev/null 2>&1 &
 
-# Lock screen after 5 minutes
+# Lock screen after 5 minutes; turn off display after another 5 minutes.
 #
-# Note that we do not yet support turning off displays in the context of idle
-# system power management. Disabling outputs, for example by
-# `wlr-randr --output whatever --off` re-arranges views (since a837fefc),
-# so is not a good idea.
-# A swayidle-friendly implementation may be written using
-# wlr-output-power-management-unstable-v1.xml and could then work with a client
-# such as https://git.sr.ht/~leon_plickat/wlopm
-swayidle -w timeout 300 'swaylock -f -c 000000' >/dev/null 2>&1 &
-
+# Note that in the context of idle system power management, it is *NOT* a good
+# idea to turn off displays by 'disabling outputs' for example by
+# `wlr-randr --output <whatever> --off` because this re-arranges views
+# (since a837fef). Instead use a wlr-output-power-management client such as
+# https://git.sr.ht/~leon_plickat/wlopm
+#
+# The swayidle example below only turns on/off one output. If you have
+# multiple outputs, you could write a script like this:
+#
+#       #!/bin/sh
+#       wlopm | while IFS=' ' read -r output state; do
+#               wlopm --toggle "${output}"
+#       done
+#
+swayidle -w \
+       timeout 3 'swaylock -f -c 000000' \
+       timeout 6 'wlopm --off eDP-1' \
+       resume 'wlopm --on eDP-1' \
+       before-sleep 'swaylock -f -c 000000' >/dev/null 2>&1 &