kanshi

kanshi

According to the official page, kanshi allows you to define output profiles that are automatically enabled and disabled on hotplug.

Why do I use it

When I connect my monitor to my laptop, I want laptop screen to turn off.
And when I disconnect my monitor, I want laptop screen to come back.

Installation

doas pacman -S kanshi

My Configuration

profile external_only {
	output HDMI-A-1 enable
	output eDP-1 disable
}

profile mobile {
	output eDP-1 enable
}

To make it work with Sway, go here.