Hyprland: Hyprland crashes when disconnecting HDMI monitor

Hyprland Version

Hyprland, built from branch  at commit b08b72358ad549fd066e5be0fc3aa4c9df367607 dirty ().
Tag: v0.27.2

flags: (if any)

Bug or Regression?

Bug

Description

Hyprland will work fine when connecting my laptop to an HDMI screen, but when I disconnect it Hyprland will crash with SIGABRT. Originally assuming maybe its because my monitor configuration was weird (i was attempting to mirror an HDMI screen onto internal, and wondered if maybe Hyprland was crashing because it lost a display).

This was my hyprland.conf when this issue was happening. It would work perfectly fine when connecting, but it would crash on a disconnect.

monitor=HDMI-A-1,3840x2160,0x0,2
monitor=eDP-1,1920x1080,0x0,1,mirror,HDMI-A-1

I set out to use https://github.com/coffebar/hyprland-monitor-attached to get around the issue by dynamically using hyprctl keyword monitor ... to reconfigure my monitors on the fly as necessary.

hyprland.conf

monitor=eDP-1,highres,auto,1

exec-once = /usr/bin/hyprland-monitor-attached ~/bin/on_mon_attach ~/bin/on_mon_detach

~/bin/on_mon_attach

hyprctl --batch "keyword monitor HDMI-A-1,3840x2160,0x0,2;keyword monitor eDP-1,1920x1080,0x0,1,mirror,HDMI-A-1"

~/bin/on_mon_detach

hyprctl keyword monitor eDP-1,highres,auto,1

This is my new and current setup. I hoped this would also work, but it still had the exact same behaviour, perfectly fine when first connecting, but a crash when the HDMI cable disconnects from the laptop.

How to reproduce

Using the above configuration (probably fixing resolutions), attach an HDMI cable into the device, and once its connected and displaying correctly disconnect it. Hyprland should freeze up and within a few seconds crash, taking you back to either tty or your login manager.

Crash reports, logs, images, videos

hyprland.log hyprlandCrashReport72209.txt coredump_72209.txt

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Same issue here. It was introduced with 0.29 for me.

@jakubreron fixed in 8b9cc9a8dbebc0dc988a97d95c49cce2993529e1

I’ve found a workaround for my issue: First I need to execute

  hyprctl reload
  sleep 1;

and only then

  hyprctl --batch "keyword monitor DP-2,1920x1080,0x0,1; keyword monitor LVDS-1,disabled"

With this approach, Hyprland doesn’t crash