waybar: add envyswitch script

This commit is contained in:
krolxon 2025-08-09 22:24:21 +05:30
parent f835448ed5
commit 31eb6f0171
3 changed files with 25 additions and 3 deletions

View File

@ -85,6 +85,7 @@
"exec": "~/.config/waybar/scripts/gpu_mode.sh", "exec": "~/.config/waybar/scripts/gpu_mode.sh",
"format": "{}", "format": "{}",
"interval": "once", "interval": "once",
"on-click": "~/.config/waybar/scripts/envyswitch.sh",
}, },
"cpu": { "cpu": {
"format": " {usage:2}%", "format": " {usage:2}%",

View File

@ -0,0 +1,21 @@
#!/bin/env bash
mode="$(printf "Integrated\nHybrid\nNvidia" | rofi -dmenu -case-smart -matching "fuzzy" -p "Select the graphics mode:")"
printf $mode
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

View File

@ -3,11 +3,11 @@
# The famous "get a menu of emojis to copy" script. # The famous "get a menu of emojis to copy" script.
# Get user selection via dmenu from emoji file. # Get user selection via dmenu from emoji file.
chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -i -l 30 | sed "s/ .*//") chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | rofi -dmenu -i -l 30 | sed "s/ .*//")
# Exit if none chosen. # Exit if none chosen.
[ -z "$chosen" ] && exit [ -z "$chosen" ] && exit
xdotool type "$chosen" wtype "$chosen"
printf "$chosen" | xclip -selection clipboard printf "$chosen" | wl-copy
notify-send "'$chosen' copied to clipboard." & notify-send "'$chosen' copied to clipboard." &