waybar: Added custom/refresh_rate module

This commit is contained in:
GaspardCulis 2024-01-10 16:34:34 +01:00
parent dd014256e7
commit 73343d4c1c
3 changed files with 37 additions and 0 deletions

View file

@ -14,6 +14,7 @@
"temperature", "temperature",
"custom/power_profile", "custom/power_profile",
"custom/gpu_status", "custom/gpu_status",
"custom/refresh_rate",
"battery", "battery",
"pulseaudio", "pulseaudio",
"pulseaudio#microphone", "pulseaudio#microphone",
@ -104,6 +105,16 @@
"signal": 9 "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": { "pulseaudio": {
"format": "{icon} {volume}%", "format": "{icon} {volume}%",
"tooltip": false, "tooltip": false,

View 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\"}"

View file

@ -45,6 +45,7 @@ tooltip {
#custom-power_profile, #custom-power_profile,
#custom-gpu_status, #custom-gpu_status,
#custom-refresh_rate,
#custom-weather, #custom-weather,
#window, #window,
#clock, #clock,
@ -141,6 +142,14 @@ tooltip {
color: #edae49; color: #edae49;
} }
#custom-refresh_rate {
color: #a6e3a1;
}
#custom-refresh_rate.overdrive {
color: #edae49;
}
#window { #window {
border-radius: 10px; border-radius: 10px;
margin-left: 60px; margin-left: 60px;