Clamshell mode solution zorin 18 pro

Hey everyone,

I recently had trouble getting clamshell mode working on my Lenovo ThinkPad X1 Carbon Gen 13 running Zorin OS 18.1 Pro. My setup is Thunderbolt 5 out of the X1 Carbon into a CalDigit TS5 dock, connected to a Samsung Odyssey 49" ultrawide. Every time I closed the lid, the external monitor would go to sleep.

After reading through previous forum threads (now closed) and playing around with my settings, I found the solution. It's a two-part fix — logind.conf alone wasn't enough because GNOME has its own lid-close handler that overrides it. All commands below are run in the terminal.

Step 1: Edit logind.conf

Open the file:
sudo nano /etc/systemd/logind.conf

You'll find these three lines commented out by default. Uncomment them (remove the #) and set them as follows:

HandleLidSwitch=suspend
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

These cover three different scenarios — undocked, on external power, and docked. Linux doesn't always reliably detect a Thunderbolt dock as "docked," so setting both ExternalPower and Docked to ignore covers your bases. HandleLidSwitch stays on suspend so your laptop still sleeps when you close the lid without a dock.

Then restart the service:
sudo systemctl restart systemd-logind

Step 2: Override GNOME's lid-close behavior

This was the key part I was missing. Even with logind configured correctly, GNOME's power settings daemon has its own lid-close handler that can override logind. Run these two commands:

gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'

The first tells GNOME to do nothing when the lid closes on AC power (i.e. docked). The second keeps the normal sleep behavior when you're on battery with no dock.

After both steps, clamshell mode worked perfectly — closed the lid and the ultrawide stayed on. Hope this helps someone else with a similar setup!

Welcome to the Forum!

I switched the Thread Category to Tutorials & Guides because this is a Guide and not a Help Request. Thank You for sharing it.