mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Compare commits
14 Commits
b1af966819
...
toggle-hyb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79dc4c4b52 | ||
|
|
3678b27170 | ||
|
|
08fead671e | ||
|
|
df65a4aaef | ||
|
|
b218655301 | ||
|
|
5fac51272c | ||
|
|
4921d68ee1 | ||
|
|
7e18659cd6 | ||
|
|
989229d515 | ||
|
|
64f7880b08 | ||
|
|
8e21a5341f | ||
|
|
e73f56b1b1 | ||
|
|
16edd8982b | ||
|
|
06d06c0c3d |
@@ -88,10 +88,11 @@ show_learn_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_trigger_menu() {
|
show_trigger_menu() {
|
||||||
case $(menu "Trigger" " Capture\n Share\n Toggle") in
|
case $(menu "Trigger" " Capture\n Share\n Toggle\n Tweaks") in
|
||||||
*Capture*) show_capture_menu ;;
|
*Capture*) show_capture_menu ;;
|
||||||
*Share*) show_share_menu ;;
|
*Share*) show_share_menu ;;
|
||||||
*Toggle*) show_toggle_menu ;;
|
*Toggle*) show_toggle_menu ;;
|
||||||
|
*Tweaks*) show_tweaks_menu ;;
|
||||||
*) show_main_menu ;;
|
*) show_main_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@@ -143,6 +144,13 @@ show_toggle_menu() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_tweaks_menu() {
|
||||||
|
case $(menu "Tweaks" " Toggle Hybrid GPU") in
|
||||||
|
*"Toggle Hybrid GPU"*) present_terminal omarchy-toggle-hybrid-gpu ;;
|
||||||
|
*) show_trigger_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
show_style_menu() {
|
show_style_menu() {
|
||||||
case $(menu "Style" " Theme\n Font\n Background\n Hyprland\n Screensaver\n About") in
|
case $(menu "Style" " Theme\n Font\n Background\n Hyprland\n Screensaver\n About") in
|
||||||
*Theme*) show_theme_menu ;;
|
*Theme*) show_theme_menu ;;
|
||||||
|
|||||||
55
bin/omarchy-toggle-hybrid-gpu
Executable file
55
bin/omarchy-toggle-hybrid-gpu
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
#!/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
|
||||||
|
# FIXME: Convert this to OPR instead of AUR
|
||||||
|
omarchy-pkg-aur-add supergfxctl
|
||||||
|
sudo systemctl enable supergfxd
|
||||||
|
sudo 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")
|
||||||
|
if gum confirm "Enable dedicated GPU and reboot?"; then
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Remove the startup delay override (not needed for Hybrid mode)
|
||||||
|
sudo rm -rf /etc/systemd/system/supergfxd.service.d/delay-start.conf
|
||||||
|
|
||||||
|
omarchy-cmd-reboot
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"Hybrid")
|
||||||
|
if gum confirm "Use only integrated GPU and reboot?"; then
|
||||||
|
# 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 -p $OMARCHY_PATH/default/systemd/system-sleep/force-igpu /usr/lib/systemd/system-sleep/
|
||||||
|
|
||||||
|
# Delay supergfxd startup to avoid race condition with display manager
|
||||||
|
# that can cause system freeze when booting in Integrated mode
|
||||||
|
sudo mkdir -p /etc/systemd/system/supergfxd.service.d
|
||||||
|
sudo cp -p $OMARCHY_PATH/default/systemd/system/supergfxd.service.d/delay-start.conf /etc/systemd/system/supergfxd.service.d/
|
||||||
|
|
||||||
|
omarchy-cmd-reboot
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Hybrid GPU not found or in unknown mode."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
18
default/systemd/system-sleep/force-igpu
Executable file
18
default/systemd/system-sleep/force-igpu
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Use the Vfio to Integrated trick to turn off NVIDIA dgpu when in integrated mode
|
||||||
|
# without needing to restart the computer. This is needed because computers like the Asus G14
|
||||||
|
# will wake after suspend in Hybrid mode, even if the system was in Integrated mode before
|
||||||
|
# suspending.
|
||||||
|
|
||||||
|
if [[ $1 == "post" ]]; then
|
||||||
|
# small delay so the device is fully re-enumerated
|
||||||
|
sleep 4
|
||||||
|
|
||||||
|
# force-bind dGPU to vfio (fully detached from nvidia)
|
||||||
|
/usr/bin/supergfxctl -m Vfio
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# then go back to Integrated, which powers it off again
|
||||||
|
/usr/bin/supergfxctl -m Integrated
|
||||||
|
fi
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[Service]
|
||||||
|
# Delay startup to avoid race condition with display manager initialization
|
||||||
|
# when booting in Integrated mode. Without this delay, the system can freeze
|
||||||
|
# on boot because supergfxd tries to disable the dGPU while the display
|
||||||
|
# subsystem is still initializing.
|
||||||
|
ExecStartPre=/bin/sleep 5
|
||||||
Reference in New Issue
Block a user