Don't suspend when closing laptop lid if HDMI is connected

Hello,

When I close my laptop’s lid, it suspends. This is normal behaviour, and I don’t want to disable it.
However, I want my laptop not to suspend when I close the lid, if it is connected to an external monitor through HDMI (docked mode). It should just turn of the laptop display and switch to the external monitor as main screen.

Is there a setting for this? Is it possible?

It’s somewhat possible, but not something I can pull straight out of a hat though… :tophat:

Look into shell scripting and see if:

  • You can execute a script when the lid is shut.
  • Commands that can read/change/override the relevant settings if certain options are true.

I’m not 100% sure where MATE stores display settings, but it could be a config file or gconf.