Keep Laptop On When Closed: Simple Settings Guide
In this article
Yes—you can keep a laptop running while the lid is closed by adjusting the power‑management settings and, if needed, connecting external peripherals.
What You'll Need
- Power adapter (recommended for sustained operation)
- External monitor, keyboard and mouse if you plan to use the laptop in clamshell mode
- Administrator access to the operating system
Step‑by‑Step
- Identify your operating system. The exact menus differ between Windows, macOS and Linux, so follow the sub‑steps that match your platform.
- Windows 10/11
- Open Settings (Windows key + I).
- Navigate to System > Power & sleep.
- Click the link for Additional power settings on the right side. This opens the classic Power Options window.
- In the left column, select Choose what closing the lid does.
- For the rows “When I close the lid” set both “On battery” and “Plugged in” to Do nothing.
- Click Save changes. The laptop will now ignore the lid‑close event and stay on.
- macOS (Ventura and later)
- Connect an external display, keyboard and mouse. macOS only allows true clamshell operation when these are attached.
- Plug the power adapter; clamshell mode requires external power.
- Open System Settings and go to Displays.
- Check the box for Prevent computer from sleeping automatically when the display is off.
- Close the lid. The internal display will turn off, but the system stays awake and drives the external monitor.
If you prefer not to use an external monitor, you can keep the machine awake by opening System Settings > Battery and disabling the option that puts the computer to sleep when the display is off, but this will keep the internal screen active even when closed, which may cause heat buildup.
- Linux (systemd‑based distributions)
- Open a terminal with root privileges (sudo -i or use sudo for each command).
- Edit the logind configuration file: sudo nano /etc/systemd/logind.conf.
- Find the line that reads #HandleLidSwitch=suspend and change it to HandleLidSwitch=ignore. Remove the leading # if present.
- Save the file and exit the editor.
- Restart the logind service: sudo systemctl restart systemd-logind.
- The system will now ignore lid‑close events. You can verify with sudo loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p LidSwitchIgnore.
- Check for manufacturer utilities. Some laptops (especially from Dell, HP, Lenovo) ship with power‑management software that can override OS settings. Open that utility and look for a Lid Switch or Sleep on Close option, then set it to Do nothing.
- Test the configuration. Close the lid briefly and observe whether the system stays on (LEDs stay lit, external monitor remains active, network connections persist). If it sleeps, move to the troubleshooting section.
Common Mistakes
- Forgetting to plug the power adapter. Many laptops automatically suspend on lid close when running on battery to preserve charge.
- Changing the “When I close the lid” setting for only one power state (e.g., only “Plugged in”). The other state will still trigger sleep.
- Leaving the manufacturer’s power‑management tool set to its default, which can override the OS configuration.
- Closing the lid without an external monitor attached on macOS; the system will go to sleep because clamshell mode requires an external display.
- Modifying the Linux logind file but forgetting to restart the service, so the old setting remains active.
Tips
- Use a docking station or USB‑C hub that supplies power and video; this reduces cable clutter and ensures the laptop receives adequate power while closed.
- Place the laptop on a hard, flat surface with good airflow. Closed lids can trap heat, so consider a laptop stand that elevates the chassis.
- If you need the laptop to stay awake for long downloads or server‑type tasks, enable “High performance” power plan (Windows) or disable “Put hard disks to sleep when possible”.
- On macOS, enable Power Nap in System Settings > Battery if you want background tasks (mail, updates) to run while the lid is closed.
- On Linux, you can also set HandleLidSwitchDocked=ignore to keep the setting active when an external monitor is detected.
Troubleshooting
- Laptop still sleeps after changing settings.
- Restart the computer. Some power‑policy changes only take effect after a reboot.
- Double‑check that the correct power plan is active (Windows) or that the “Prevent computer from sleeping automatically” box is still checked (macOS).
- External monitor turns off when the lid is closed.
- Ensure the external display is set as the primary monitor in the OS display settings.
- On macOS, go to System Settings > Displays and verify that “Allow display mirroring” is off; macOS sometimes disables the external screen if it thinks the internal one is the only active display.
- Heat buildup concerns.
- Monitor CPU temperature with a tool like HWMonitor (Windows), iStat Menus (macOS) or lm‑sensors (Linux). If temperatures exceed safe limits, consider adding a cooling pad or keeping the lid slightly ajar.
- Some BIOS/UEFI settings include a “Thermal policy” that can be adjusted to favor performance over aggressive throttling.
- Manufacturer software reverts the setting after a reboot.
- Open the vendor utility (Dell Power Manager, Lenovo Vantage, HP Command Center) and look for a “Lid close action” option. Set it to Do nothing and save the profile.
- If the utility does not expose the option, check the BIOS/UEFI. Look for a “Lid Switch” or “Sleep on Lid Close” entry and disable it.
- Linux changes have no effect.
- Confirm the file syntax is correct; a missing newline at the end of /etc/systemd/logind.conf can cause the parser to ignore the line.
- Run sudo loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p HandleLidSwitch to see the active value.
- If the value still shows “suspend”, another service (e.g., upower) may be handling the event. Consider adding “HandleLidSwitchIgnoreInhibited=yes” to the same file.
Frequently Asked Questions
Can I keep my laptop on while closed without an external monitor?
Yes, on Windows and Linux you can set the lid action to Do nothing, which keeps the system awake even without a monitor. On macOS, true clamshell mode requires an external display; otherwise the machine will sleep.
Will keeping the lid closed damage my laptop?
Not if the device has adequate ventilation. Closed lids can restrict airflow, so use a stand or cooling pad and monitor temperatures during prolonged use.
Do I need to be plugged into AC power?
While not strictly required on Windows or Linux, most laptops default to sleep on battery to preserve charge. Plugging in ensures the “Do nothing” setting works consistently.
What if my laptop still goes to sleep after I changed the settings?
Check for vendor‑specific power utilities, BIOS/UEFI lid settings, and make sure the correct power plan is active. A reboot often finalises the change.
Can I use this setup for running background downloads or a home server?
Absolutely. Just ensure the laptop stays powered, has sufficient cooling, and that network adapters are set to stay active when the display is off.
Is there a way to temporarily override the setting without changing the system configuration?
Press the power button briefly (do not hold) to wake the system, or use a keyboard shortcut such as Fn+F4 on some models that toggles sleep behavior. These shortcuts vary by manufacturer.