power menu, redshift, polybar
This commit is contained in:
25
.config/polybar/scripts/system-gpu-optimus/README.md
Normal file
25
.config/polybar/scripts/system-gpu-optimus/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Script: system-gpu-optimus
|
||||
|
||||
A script that shows the current GPU in use, given that the GPUs are managed by [optimus-manager](https://github.com/Askannz/optimus-manager).
|
||||
|
||||
The script also allows for switching GPU in one click.
|
||||
Be aware that this will log you out of your session without asking for confirmation.
|
||||
|
||||

|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
Set `hybrid_switching` to `1` if the system switches between hybrid and nvidia.
|
||||
Otherwise the system switches between intel and nvidia.
|
||||
|
||||
|
||||
## Module
|
||||
|
||||
```ini
|
||||
[module/system-gpu-optimus]
|
||||
type = custom/script
|
||||
exec = ~/polybar-scripts/system-gpu-optimus.sh
|
||||
interval = 1200
|
||||
click-right = ~/polybar-scripts/system-gpu-optimus.sh --switch
|
||||
```
|
||||
BIN
.config/polybar/scripts/system-gpu-optimus/screenshots/1.png
Normal file
BIN
.config/polybar/scripts/system-gpu-optimus/screenshots/1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
icon_intel="#1"
|
||||
icon_nvidia="#2"
|
||||
icon_hybrid="#3"
|
||||
|
||||
hybrid_switching=0
|
||||
|
||||
|
||||
gpu_current() {
|
||||
mode=$(optimus-manager --print-mode)
|
||||
|
||||
echo "$mode" | cut -d ' ' -f 5 | tr -d '[:space:]'
|
||||
}
|
||||
|
||||
gpu_switch() {
|
||||
mode=$(gpu_current)
|
||||
|
||||
if [ "$mode" = "intel" ]; then
|
||||
next="nvidia"
|
||||
elif [ "$mode" = "nvidia" ]; then
|
||||
if [ "$hybrid_switching" = 1 ]; then
|
||||
next="hybrid"
|
||||
else
|
||||
next="intel"
|
||||
fi
|
||||
elif [ "$mode" = "hybrid" ]; then
|
||||
next="nvidia"
|
||||
fi
|
||||
|
||||
optimus-manager --switch "$next" --no-confirm
|
||||
}
|
||||
|
||||
gpu_display(){
|
||||
mode=$(gpu_current)
|
||||
|
||||
if [ "$mode" = "intel" ]; then
|
||||
echo "$icon_intel"
|
||||
elif [ "$mode" = "nvidia" ]; then
|
||||
echo "$icon_nvidia"
|
||||
elif [ "$mode" = "hybrid" ]; then
|
||||
echo "$icon_hybrid"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--switch)
|
||||
gpu_switch
|
||||
;;
|
||||
*)
|
||||
gpu_display
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user