aboutsummaryrefslogtreecommitdiff
path: root/.config/waybar/scripts/envyswitch.sh
blob: 60c09a4feeaae3aa2a8ecbb0254a387b72e9d17f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/env bash

mode="$(printf "Integrated\nHybrid\nNvidia" | rofi -dmenu -case-smart -matching "fuzzy" -p "Select the graphics mode:")"

# Exit if no selection was made
[ -z "$mode" ] && exit 1

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