Skip to content

Instantly share code, notes, and snippets.

@aron-hoogeveen
aron-hoogeveen / README.md
Last active November 29, 2025 16:54
Hyprland disable/enable display on HDMI connect/disconnect

A small setup for Hyprland to disable a monitor (e.g. the laptop buildin screen) using hyprctl when a second screen is connected, and to re-enable the screen when all external displays have been disconnected.

  1. Create the file switcher.sh in your preferred directory (e.g. /home/yourusername/scripts/).
  2. Create the file hypr-display-switcher.service in /etc/systemd/user/.
  3. Create the file hyprland-display-switcher.rules in /etc/udev/rules.d/.
  4. (optional) Make sure that on every login the environment value HYPR_BUILDIN_MON is set to your preferred settings.
  5. Add exec-once = /path/to/switcher.sh to your hyprland config, so it get's set up when you log in.
  6. Reload the systemd daemon with systemctl daemon-reload.
  7. Test the setup by (un)plugging a display to your computer.
@aron-hoogeveen
aron-hoogeveen / index.html
Last active February 1, 2025 15:33
Example html page breaks for printing
<!DOCTYPE html>
<head>
<style>
@media print {
.page, .page-break {
break-after:page
}
}
</style>
</head>