| 1 | #!/bin/env bash |
| 2 | |
| 3 | mode="$(printf "Integrated\nHybrid\nNvidia" | aurora-run --dmenu -p "Select the graphics mode:")" |
| 4 | |
| 5 | # Exit if no selection was made |
| 6 | [ -z "$mode" ] && exit 1 |
| 7 | |
| 8 | notify-send "Switching to $mode mode..." |
| 9 | |
| 10 | # Map mode to envycontrol argument |
| 11 | arg=$(echo "$mode" | tr '[:upper:]' '[:lower:]') |
| 12 | |
| 13 | # hybrid: --rtd3 lets the dGPU power off when idle |
| 14 | set -- -s "$arg" |
| 15 | [ "$arg" = hybrid ] && set -- "$@" --rtd3 |
| 16 | |
| 17 | if sudo -A envycontrol "$@"; then |
| 18 | notify-send "Graphics mode set to $mode" |
| 19 | else |
| 20 | notify-send "Failed to set graphics mode to $mode" |
| 21 | fi |