I’ve been loving the XFCE desktop environment, but one annoyance I have is this: on my laptop, if I’m using only an external monitor and unplug it, XFCE doesn’t automatically turn the laptop screen back on, and I’m left with no display.
In this state, I can switch to a different virtual console with, e.g., Ctrl + Alt + F1
. I had hoped a simple xrandr -d :0 --auto
would have fixed it, but I kept getting messages like Configure crtc 0 failed
. As I found from this forum thread, the trick is you need to have the display active, so something like chvt 7; sleep 2; xrandr -d :0 --auto
will work.
What a pain! I don’t want to switch to a virtual console, log in, and run some series of commands just to get my X display back.
Then it dawned on me: just add a keybinding to run the xrandr
command. I keep my keybindings in my xmonad window manager configuration, so I added this:
,((modMask, xK_F7), spawn "xrandr --auto")
Now I can recover from this black screen annoyance with a simple key combination.
Leave a Reply