1
1
mirror of https://github.com/rywng/dotfiles.git synced 2024-11-23 03:11:49 +08:00
dotfiles/.config/sway/scripts/lid_switch/laptop_screen.sh
2024-05-01 11:58:43 +08:00

20 lines
363 B
Bash
Executable File

#!/bin/sh
# Disable and enable laptop screen only when external monitors found
monitor_count=$(swaymsg -t get_outputs | grep name | wc -l)
laptop_output="eDP-1"
if [ $monitor_count -gt 1 ]; then
case "$1" in
disable)
swaymsg output $laptop_output disable
;;
enable)
swaymsg output $laptop_output enable
;;
*)
echo "Invalid argument"
;;
esac
fi