#!/bin/bash
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/../../lib/logging.sh"

log "Installing TLP (laptop power management)..."
sudo pacman -S --noconfirm --needed tlp tlp-rdw

log "Enabling TLP and masking rfkill to avoid conflicts..."
enable_service tlp.service; start_service tlp.service
enable_service NetworkManager-dispatcher.service
sudo systemctl mask systemd-rfkill.service systemd-rfkill.socket
log "TLP installed."
