1
1
mirror of https://github.com/rywng/dotfiles.git synced 2024-11-15 15:31:50 +08:00
dotfiles/.config/sway/scripts/lid_switch/laptop_screen.sh

20 lines
363 B
Bash
Raw Normal View History

2024-05-01 11:58:43 +08:00
#!/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