mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Revise switching process
This commit is contained in:
@@ -146,7 +146,7 @@ show_toggle_menu() {
|
|||||||
|
|
||||||
show_tweaks_menu() {
|
show_tweaks_menu() {
|
||||||
case $(menu "Tweaks" " Toggle Hybrid GPU") in
|
case $(menu "Tweaks" " Toggle Hybrid GPU") in
|
||||||
*"Toggle Hybrid GPU"*) omarchy-toggle-hybrid-gpu ;;
|
*"Toggle Hybrid GPU"*) present_terminal omarchy-toggle-hybrid-gpu ;;
|
||||||
*) show_trigger_menu ;;
|
*) show_trigger_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,28 +17,36 @@ gpu_mode=$(supergfxctl -g)
|
|||||||
|
|
||||||
case "$gpu_mode" in
|
case "$gpu_mode" in
|
||||||
"Integrated")
|
"Integrated")
|
||||||
# Switch to hybrid mode
|
if gum confirm "Enable dedicated GPU and reboot?"; then
|
||||||
sudo sed -i "s/\"mode\": \".*\"/\"mode\": \"Hybrid\"/" /etc/supergfxd.conf
|
# Switch to hybrid mode
|
||||||
|
sudo sed -i "s/\"mode\": \".*\"/\"mode\": \"Hybrid\"/" /etc/supergfxd.conf
|
||||||
|
|
||||||
# Let hybrid mode be the default after system sleep
|
# Let hybrid mode be the default after system sleep
|
||||||
sudo rm -rf /usr/lib/systemd/system-sleep/force-igpu.sh
|
sudo rm -rf /usr/lib/systemd/system-sleep/force-igpu.sh
|
||||||
|
|
||||||
notify-send " Hybrid GPU" "Enabling dedicated GPU. Rebooting..."
|
echo "Enabling dedicated GPU..."
|
||||||
omarchy-cmd-reboot
|
|
||||||
|
supergfxctl -m Hybrid
|
||||||
|
omarchy-cmd-reboot
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
"Hybrid")
|
"Hybrid")
|
||||||
# Switch to integrated mode
|
if gum confirm "Use only integrated GPU and reboot?"; then
|
||||||
sudo sed -i "s/\"mode\": \".*\"/\"mode\": \"Integrated\"/" /etc/supergfxd.conf
|
# 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)
|
# Force igpu mode after system sleep (or dgpu could get activated)
|
||||||
sudo mkdir -p /usr/lib/systemd/system-sleep
|
sudo mkdir -p /usr/lib/systemd/system-sleep
|
||||||
sudo cp $OMARCHY_PATH/default/systemd/system-sleep/force-igpu.sh /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" "Restricting to integrated GPU. Rebooting..."
|
echo "Disabling dedicated GPU..."
|
||||||
omarchy-cmd-reboot
|
|
||||||
|
supergfxctl -m Vfio
|
||||||
|
supergfxctl -m Integrated
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
notify-send " Hybrid GPU" "Hybrid GPU not found or in unknown mode."
|
echo "Hybrid GPU not found or in unknown mode."
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user