diff --git a/bar/waybar/config.jsonc b/bar/waybar/config.jsonc index 7c107a7..9f32d36 100755 --- a/bar/waybar/config.jsonc +++ b/bar/waybar/config.jsonc @@ -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, diff --git a/bar/waybar/scripts/refresh_rate.sh b/bar/waybar/scripts/refresh_rate.sh new file mode 100755 index 0000000..19c6d80 --- /dev/null +++ b/bar/waybar/scripts/refresh_rate.sh @@ -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\"}" diff --git a/bar/waybar/style.css b/bar/waybar/style.css index fe41a6c..8afe660 100755 --- a/bar/waybar/style.css +++ b/bar/waybar/style.css @@ -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;