--- /dev/null
+#!/bin/sh
+
+{% if grains['host'] == 'baryte' %}
+{% set ext = "DP-3" %}
+{% else %}
+{% set ext = "DP-1" %}
+{% endif %}
+
+FILE="/proc/acpi/button/lid/LID*/state"
+last=-1
+while true; do
+ grep -q open ${FILE}
+ current="$?"
+ if [ $last -ne $current ]; then
+ if [ $current -eq 0 ]; then
+ swaymsg output {{ ext }} disable
+ swaymsg output eDP-1 enable
+ else
+ swaymsg output eDP-1 disable
+ swaymsg output {{ ext }} enable
+ fi
+ fi
+ last=$current
+ sleep 0.5
+done