Lock and suspend does'nt work Macbook Pro 2015

Hello everyone,

I’m using EndeavourOS with Hyperland on my old 2015 121-bit MacBook Pro. I’ve configured the lock screen and I use the shortcut SUPER + L to lock and then put my computer to sleep.

I’m using HyperLock and Hyperidle.

My problem is this: when I lock my computer, the HyperLock screen appears and sleep mode works, but after a few seconds, it wakes up for no apparent reason.

After some research, I think the LID0 service is causing this. I disabled it, and that worked. I also created the file “/etc/systemd/system/fix-macbook-lid.service” to permanently disable it, which also worked. However, when I close my 2015 MacBook, the Apple logo lights up, and I think the computer is waking up.

Is there a solution to make sleep mode work correctly when I close my computer? And do I have the right solution?

So, for your help

//  “/etc/systemd/system/fix-macbook-lid.service”

GNU nano 9.0 /etc/systemd/system/fix-macbook-lid.service
[Unit]
Description=Disable Wake-by-Lid (LID)
After=multi-user.target

[Service]
Type=oneshot

This command checks if LID0 is ‘enabled’ and disables it if it is

ExecStart=/bin/sh -c “grep -q ‘LID0.*enabled’ /proc/acpi/wakeup && echo LID0 > /proc/acpi/wakeup”
RemainAfterExit=yes

[Installer]
WantedBy=multi-user.target
// hypridle.conf

general {
    lock_cmd = pidof hyprlock || hyprlock
    before_sleep_cmd = loginctl lock-session
    after_sleep_cmd = hyprctl dispatch dpms on
}

# 1. Verrouiller l'écran après 2 minutes (120s)
listener {
    timeout = 120
    on-timeout = loginctl lock-session
}

# 2. Éteindre l'écran après 2.5 minutes (150s) - Optionnel mais conseillé
listener {
    timeout = 150
    on-timeout = hyprctl dispatch dpms off
    on-resume = hyprctl dispatch dpms on
}

# 3. Mise en veille totale après 3 minutes (180s)
listener {
    timeout = 180
    on-timeout = systemctl suspend
}
// hyprland.conf

bind = SUPER, L, exec, loginctl lock-session && sleep 1.5 && systemctl suspend

Hello @TristeTmp ,
Have you tried uncommenting
in

/etc/systemd/logind.conf
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
 journalctl -b 0 | grep suspend
máj 02 17:02:31 a-83k7 kernel: Low-power S0 idle used by default for system suspend
máj 02 17:02:34 a-83k7 kernel: nvme 0000:01:00.0: platform quirk: setting simple suspend
máj 02 17:02:49 a-83k7 rtkit-daemon[1671]: Handling system-suspend using logind.
máj 02 17:03:20 a-83k7 systemd-sleep[2557]: Going to suspend...
máj 02 17:03:20 a-83k7 systemd-sleep[2555]: Performing sleep operation 'suspend'...
máj 02 17:03:20 a-83k7 kernel: PM: suspend entry (s2idle)
máj 02 17:03:32 a-83k7 kernel: printk: Suspending console(s) (use no_console_suspend to debug)
máj 02 17:03:33 a-83k7 kernel: queueing ieee80211 work while going to suspend
máj 02 17:03:33 a-83k7 systemd-sleep[2555]: System returned from sleep operation 'suspend'.
máj 02 17:03:33 a-83k7 kernel: PM: suspend exit
máj 02 17:03:33 a-83k7 systemd-sleep[2604]: Waking up from suspend...
máj 02 17:03:33 a-83k7 systemd[1]: systemd-suspend.service: Deactivated successfully.
máj 02 17:03:33 a-83k7 systemd-logind[884]: Operation 'suspend' finished.
 distro  │ EndeavourOS x86_64
 kernel  │ Linux 7.0.3-zen1-1-zen
 wm      │ Hyprland 0.54.3 (Wayland)

Lenovo 15ARP