waybar: Added custom/refresh_rate module
This commit is contained in:
parent
dd014256e7
commit
73343d4c1c
3 changed files with 37 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
"temperature",
|
||||
"custom/power_profile",
|
||||
"custom/gpu_status",
|
||||
"custom/refresh_rate",
|
||||
"battery",
|
||||
"pulseaudio",
|
||||
"pulseaudio#microphone",
|
||||
|
@ -104,6 +105,16 @@
|
|||
"signal": 9
|
||||
},
|
||||
|
||||
"custom/refresh_rate": {
|
||||
"exec": "~/.config/waybar/scripts/refresh_rate.sh",
|
||||
"return-type": "json",
|
||||
"interval": 10,
|
||||
"tooltip": false,
|
||||
"format": "{}Hz",
|
||||
"on-click": "~/.config/waybar/scripts/refresh_rate.sh toggle; pkill -SIGRTMIN+10 waybar",
|
||||
"signal": 10
|
||||
},
|
||||
|
||||
"pulseaudio": {
|
||||
"format": "{icon} {volume}%",
|
||||
"tooltip": false,
|
||||
|
|
17
bar/waybar/scripts/refresh_rate.sh
Executable file
17
bar/waybar/scripts/refresh_rate.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
refresh_rate=$(hyprctl -j monitors | jq '.[0].refreshRate | round')
|
||||
class="overdrive"
|
||||
if [ "$refresh_rate" == "60" ]; then
|
||||
class=normal
|
||||
fi
|
||||
|
||||
if [ "$1" == "toggle" ]; then
|
||||
if [ "$refresh_rate" == "60" ]; then
|
||||
hyprctl keyword monitor eDP-1,2560x1440@165,auto,1
|
||||
else
|
||||
hyprctl keyword monitor eDP-1,2560x1440@60,auto,1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "{\"text\": \"$refresh_rate\", \"class\": \"$class\"}"
|
|
@ -45,6 +45,7 @@ tooltip {
|
|||
|
||||
#custom-power_profile,
|
||||
#custom-gpu_status,
|
||||
#custom-refresh_rate,
|
||||
#custom-weather,
|
||||
#window,
|
||||
#clock,
|
||||
|
@ -141,6 +142,14 @@ tooltip {
|
|||
color: #edae49;
|
||||
}
|
||||
|
||||
#custom-refresh_rate {
|
||||
color: #a6e3a1;
|
||||
}
|
||||
|
||||
#custom-refresh_rate.overdrive {
|
||||
color: #edae49;
|
||||
}
|
||||
|
||||
#window {
|
||||
border-radius: 10px;
|
||||
margin-left: 60px;
|
||||
|
|
Loading…
Reference in a new issue