improve envyswitch script
This commit is contained in:
parent
31eb6f0171
commit
77210a41ae
|
|
@ -1,21 +1,17 @@
|
|||
#!/bin/env bash
|
||||
|
||||
mode="$(printf "Integrated\nHybrid\nNvidia" | rofi -dmenu -case-smart -matching "fuzzy" -p "Select the graphics mode:")"
|
||||
printf $mode
|
||||
|
||||
# Exit if no selection was made
|
||||
[ -z "$mode" ] && exit 1
|
||||
|
||||
case "$mode" in
|
||||
Integrated)
|
||||
sudo -A envycontrol -s integrated && notify-send "Graphics mode set to integrated"
|
||||
;;
|
||||
Hybrid)
|
||||
sudo -A envcontrol -s hybrid && notify-send "Graphics mode set to hybrid"
|
||||
;;
|
||||
Nvidia)
|
||||
sudo -A envycontrol -s nvidia && notify-send "Graphics mode set to nvidia"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
notify-send "Switching to $mode mode..."
|
||||
|
||||
# Map mode to envycontrol argument
|
||||
arg=$(echo "$mode" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if sudo -A envycontrol -s "$arg"; then
|
||||
notify-send "Graphics mode set to $mode"
|
||||
else
|
||||
notify-send "Failed to set graphics mode to $mode"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue