Fix power profile switching that breaks after a power-profiles-daemon update when mise provides python3
Read issue #11031 (open), which supports every claim: the install-only sed in install/config/fix-powerprofilesctl-shebang.sh, no pacman hook, reversion on reinstall or upgrade, and the callers omarchy-powerprofiles-set, omarchy-powerprofiles-list and Menu.qml. Confirmed on this workstation (power-profiles-daemon 0.30-1, python 3.14.7-1, python-gobject 3.56.3-1) that /usr/bin/powerprofilesctl starts #!/bin/python3, that pacman -Qkk power-profiles-daemon reports it altered, that the install script is byte-identical to quattro and is called only from install/config/all.sh, and that no Omarchy hook in /usr/share/libalpm/hooks or /etc/pacman.d/hooks touches it. pacman-conf HookDir prints /etc/pacman.d/hooks/, and alpm-hooks(5) says Exec arguments are split on whitespace with quoting honoured, so the single-quoted sed expression survives. /bin is a symlink to usr/bin, so #!/usr/bin/python3 and Omarchy's #!/bin/python3 are the same interpreter. omarchy-powerprofiles-set accepts autodetect. The hook was not exercised by an actual package upgrade.
Symptom
Power profile changes stop working after an update: the power panel does nothing and the profile no longer follows AC and battery. Running the CLI by hand fails:
$ powerprofilesctl get
ModuleNotFoundError: No module named 'gi'
head -1 /usr/bin/powerprofilesctl prints #!/usr/bin/env python3, and which python3 points under ~/.local/share/mise.
Cause
powerprofilesctl is a Python script that imports from gi.repository import Gio, GLib (PyGObject), which only the system Python has. With #!/usr/bin/env python3 it runs whichever python3 is first in PATH, and a mise-installed Python has no gi module. Omarchy's installer step install/config/fix-powerprofilesctl-shebang.sh rewrites the shebang to #!/bin/python3, but it runs once at install and there is no pacman hook, so any reinstall or upgrade of power-profiles-daemon restores the packaged line. omarchy-powerprofiles-set and omarchy-powerprofiles-list both call powerprofilesctl. Confirmed on this workstation that the edited shebang is in place and pacman -Qkk power-profiles-daemon reports the file altered. Issue #11031 is open.
Fix
**Restore it now:**
sudo sed -i '1s|^#!/usr/bin/env python3$|#!/usr/bin/python3|' /usr/bin/powerprofilesctl
head -1 /usr/bin/powerprofilesctl
**Keep it across upgrades** with a pacman hook. /etc/pacman.d/hooks is pacman's default HookDir:
sudo install -Dm644 /dev/stdin /etc/pacman.d/hooks/90-powerprofilesctl-system-python.hook <<'EOF'
[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = power-profiles-daemon
[Action]
Description = Pin powerprofilesctl to the system python3
When = PostTransaction
Exec = /usr/bin/sed -i '1s|^#!/usr/bin/env python3$|#!/usr/bin/python3|' /usr/bin/powerprofilesctl
EOF
Then re-apply the profile for the current power source:
omarchy-powerprofiles-set autodetect
Verify
powerprofilesctl get prints a profile name, and head -1 /usr/bin/powerprofilesctl still reads #!/usr/bin/python3 after the next power-profiles-daemon upgrade. pacman -Qkk power-profiles-daemon reporting the file as altered is expected.