mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-06 04:20:23 +00:00
31 lines
1005 B
Bash
31 lines
1005 B
Bash
# Fix NVMe suspend issues on MacBook models
|
|
# This prevents NVMe drives from failing to wake from sleep properly
|
|
MACBOOK_MODEL=$(cat /sys/class/dmi/id/product_name 2>/dev/null || true)
|
|
|
|
if [[ "$MACBOOK_MODEL" =~ MacBook(8,1|9,1|10,1)|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
|
|
echo "Detected MacBook model: $MACBOOK_MODEL"
|
|
|
|
NVME_DEVICE="/sys/bus/pci/devices/0000:01:00.0/d3cold_allowed"
|
|
|
|
if [[ -f "$NVME_DEVICE" ]]; then
|
|
echo "Applying NVMe suspend fix..."
|
|
|
|
cat <<EOF | sudo tee /etc/systemd/system/omarchy-nvme-suspend-fix.service >/dev/null
|
|
[Unit]
|
|
Description=Omarchy NVMe Suspend Fix for MacBook
|
|
|
|
[Service]
|
|
ExecStart=/bin/bash -c 'echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed'
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
sudo systemctl enable omarchy-nvme-suspend-fix.service
|
|
sudo systemctl daemon-reload
|
|
else
|
|
echo "Warning: NVMe device not found at expected PCI address (0000:01:00.0)"
|
|
echo "This fix may not be needed for this MacBook model"
|
|
fi
|
|
fi
|