This commit is contained in:
cronyakatsuki 2022-03-21 18:05:05 +01:00
parent 5fe9ae3c00
commit 19ee4a7871
10 changed files with 152 additions and 25 deletions

41
dmenugpu Executable file
View file

@ -0,0 +1,41 @@
#!/bin/sh
already_in()
{
quick-notify "Gpu Manager" "Already in $new_mode mode"
}
switch()
{
if sudo envycontrol.py --switch $new_mode; then
quick-notify "Gpu Manager" "Switched to $new_mode mode"
else
quick-notify "Gpu Manager" "Failed to switch to $new_mode mode"
fi
}
case "$(printf "integrated\\nhybrid\\nnvidia" | dmenu -p "Choose gpu mode")" in
"integrated") new_mode="integrated";;
"nvidia") new_mode="nvidia";;
"hybrid") new_mode="hybrid";;
esac
current_mode=$(envycontrol.py --status | awk '{ print $5 }')
if [ $current_mode = "integrated" ]; then
case $new_mode in
"integrated") already_in;;
"nvidia") quick-notify "Gpu Manager" "You need to first reboot into hybrid mode";;
"hybrid") switch;;
esac
elif [ $current_mode = "hybrid" ]; then
case $new_mode in
"hybrid") already_in;;
*) switch;;
esac
elif [ $current_mode = "nvidia" ]; then
case $new_mode in
"nvidia") already_in;;
*) switch;;
esac
fi