Toggle hybrid GPU mode via supergfxctl

Very useful for Asus G14 and other laptops with NVIDIA + AMD iGPU
combos.
This commit is contained in:
David Heinemeier Hansson
2026-01-15 17:56:08 -05:00
parent 5ff76df5e4
commit 06d06c0c3d
3 changed files with 75 additions and 1 deletions

44
bin/omarchy-toggle-hybrid-gpu Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
# Toggle dedicated vs integrated GPU mode via supergfxd (for hybrid gpu laptops, like Asus G14).
# Requires reboot to take effect.
# Ensure supergfxctl has been installed
if omarchy-cmd-missing supergfxctl; then
omarchy-pkg-aur-add supergfxctl
systemctl enable supergfxd
systemctl start supergfxd
# Needed to deal with restoring to sleep where going through VFIO first means we don't need to reboot.
sudo sed -i "s/\"vfio_enable\": \".*\"/\"vfio_enable\": true/" /etc/supergfxd.conf
fi
gpu_mode=$(supergfxctl -g)
case "$gpu_mode" in
"Integrated")
# Switch to hybrid mode
sudo sed -i "s/\"mode\": \".*\"/\"mode\": \"Hybrid\"/" /etc/supergfxd.conf
# Let hybrid mode be the default after system sleep
sudo rm -rf /usr/lib/systemd/system-sleep/force-igpu.sh
notify-send " Hybrid GPU" "Switching to dedicated GPU. Rebooting..."
omarchy-cmd-reboot
;;
"Hybrid")
# Switch to integrated mode
sudo sed -i "s/\"mode\": \".*\"/\"mode\": \"Integrated\"/" /etc/supergfxd.conf
# Force igpu mode after system sleep (or dgpu could get activated)
sudo mkdir -p /usr/lib/systemd/system-sleep
sudo cp $OMARCHY_PATH/default/systemd/system-sleep/force-igpu.sh /usr/lib/systemd/system-sleep/
notify-send " Hybrid GPU" "Switching to integrated GPU. Rebooting..."
omarchy-cmd-reboot
;;
*)
notify-send " Hybrid GPU" "Hybrid GPU not found or in unknown mode."
return 1
;;
esac