# Laptop optimization

This ensures your laptop stays awake with the lid closed, maintains a stable network connection and boots quickly by ignoring unused network interfaces.

---

1.  ## Lid and sleep configuration

    These steps prevent the system from suspending or shutting down when the lid is closed or the power button is pressed.

   1. ### Open logind config

             ```sh
             sudo nano /etc/systemd/logind.conf
             ```

   2. ### Update config

             Update the following lines to `ignore` to keep the system awake.

             ```sh title="/etc/systemd/logind.conf"
             HandleSuspendKey=ignore
             HandleLidSwitch=ignore
             HandleLidSwitchExternalPower=ignore
             HandleLidSwitchDocked=ignore
             ```

   3. ### Restart logind

             ```sh
             sudo systemctl restart systemd-logind
             ```

2.  ## Disable system-wide sleep

    To prevent the kernel from attempting to sleep even if triggered by software, create a “no-sleep” override.

       

   1. ### Create nosuspend config

             ```sh
             sudo mkdir -p /etc/systemd/sleep.conf.d/ && sudo nano /etc/systemd/sleep.conf.d/nosuspend.conf
             ```

   2. ### Add config

             ```sh title="/etc/systemd/sleep.conf.d/nosuspend.conf"
             [Sleep]
             AllowSuspend=no
             AllowHibernation=no
             AllowSuspendThenHibernate=no
             AllowHybridSleep=no
             ```

   3. ### Reload daemon

             ```sh
             sudo systemctl daemon-reload
             ```
