diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index be90d58b..ae0b0b76 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -15,7 +15,7 @@ "custom/arch", "hyprland/workspaces", "cava", - "custom/wf-recorder" + "custom/wf-recorder", ], "modules-center": ["custom/music"], "modules-right": [ @@ -24,7 +24,7 @@ "custom/weather", "clock", "pulseaudio", - "custom/notifications" + "custom/notifications", ], "custom/wf-recorder": { "format": "{}", @@ -33,33 +33,35 @@ "tooltip": "false", "exec-if": "pgrep 'wf-recorder'", "on-click": "exec $HOME/.config/hypr/scripts/rofi/recording", - "signal": 8 + "signal": 8, }, "custom/updates": { "format": "{} {icon}", "return-type": "json", "format-icons": { "has-updates": "󱍷", - "updated": "󰂪" + "updated": "󰂪", }, "exec-if": "which waybar-module-pacman-updates", "exec": "waybar-module-pacman-updates", "on-click": "kitty --class center-float-large topgrade -k --only system", - "on-click-right": "kitty --class center-float-large topgrade -k --no-self-update" + "on-click-right": "kitty --class center-float-large topgrade -k --no-self-update", }, "custom/arch": { "format": "  ", "tooltip": false, "on-click": "sleep 0.1 && rofi -show drun", - "on-click-right": "wleave" + "on-click-right": "wleave", }, "custom/weather": { - "exec": "python3 ~/.config/waybar/scripts/weather.py", + "exec": "wttrbar --location Alicante", "restart-interval": 300, + "tooltip": true, + "format": "{}°", "return-type": "json", "on-click": "kitty --hold --class center-float wttr Alicante", "on-click-right": "kitty --hold --class center-float wttr -v2 Alicante", - "on-click-middle": "xdg-open https://www.eltiempo.es/alicante.html" + "on-click-middle": "xdg-open https://wttr.in/alicante", }, "custom/notifications": { "tooltip": false, @@ -72,14 +74,14 @@ "inhibited-notification": "", "inhibited-none": "", "dnd-inhibited-notification": "", - "dnd-inhibited-none": "" + "dnd-inhibited-none": "", }, "return-type": "json", "exec-if": "which swaync-client", "exec": "swaync-client -swb", "on-click": "sleep 0.1 && swaync-client -t -sw", "on-click-right": "swaync-client -d -sw", - "escape": true + "escape": true, }, "hyprland/workspaces": { "disable-scroll": true, @@ -96,18 +98,18 @@ "7": "", "8": "", "9": "", - "10": "" + "10": "", }, "on-scroll-up": "hyprctl dispatch workspace r-1", "on-scroll-down": "hyprctl dispatch workspace r+1", "on-click": "activate", - "sort-by-number": true + "sort-by-number": true, }, "hyprland/language": { "format": "{}", "format-en": " US", "format-es": " ES", - "on-click": "hyprctl switchxkblayout evision-usb-device next" + "on-click": "hyprctl switchxkblayout evision-usb-device next", }, "clock": { "tooltip-format": "{calendar}", @@ -122,8 +124,8 @@ "days": "{}", "weeks": "W{}", "weekdays": "{}", - "today": "{}" - } + "today": "{}", + }, }, "interval": 1, "format": "{:%H:%M:%OS}  ", @@ -133,9 +135,9 @@ "on-click-forward": "tz_up", "on-click-backward": "tz_down", "on-scroll-up": "shift_up", - "on-scroll-down": "shift_down" + "on-scroll-down": "shift_down", }, - "on-click-middle": "thunderbird -calendar && hyprctl dispatch workspace 23" + "on-click-middle": "thunderbird -calendar && hyprctl dispatch workspace 23", }, "pulseaudio": { "format": "{icon} {volume}% {format_source}", @@ -151,14 +153,14 @@ "phone": " ", "portable": " ", "car": " ", - "default": [" ", " ", " "] + "default": [" ", " ", " "], }, "tooltip-format": "{desc}, {volume}%", "on-click": "swayosd-client --output-volume mute-toggle", "on-click-right": "swayosd-client --input-volume mute-toggle", "on-click-middle": "pypr toggle volume", "on-scroll-up": "swayosd-client --output-volume +1", - "on-scroll-down": "swayosd-client --output-volume -1" + "on-scroll-down": "swayosd-client --output-volume -1", }, "cava": { "autosens": 1, @@ -172,7 +174,7 @@ "", "", "", - "" + "", ], "framerate": 75, "higher_cutoff_freq": 10000, @@ -186,7 +188,7 @@ "waves": false, "on-click": "kitty --class center-float-mini cava", "on-click-right": "qpwgraph", - "on-click-middle": "easyeffects" + "on-click-middle": "easyeffects", }, "custom/music": { "format": "{icon} {}", @@ -194,14 +196,14 @@ "max-length": 100, "format-icons": { "spotify": " ", - "default": " " + "default": " ", }, "escape": true, "exec": "$HOME/.config/waybar/scripts/mediaplayer.py 2> /dev/null", "on-click": "playerctl --player=spotify play-pause", "on-scroll-up": "playerctl --player=spotify next", - "on-scroll-down": "playerctl --player=spotify previous" - } + "on-scroll-down": "playerctl --player=spotify previous", + }, }, { "height": 50, @@ -222,7 +224,7 @@ "temperature#cpu", "custom/gpu-usage", "temperature#gpu", - "custom/notifications" + "custom/notifications", ], "hyprland/window": { "format": "{}", @@ -230,15 +232,15 @@ "rewrite": { "(.*) — LibreWolf": "󰇧 $1", "(.*) - Discord": "󰙯 $1", - "(.*) - fish": "> [$1]" + "(.*) - fish": "> [$1]", }, - "separate-outputs": false + "separate-outputs": false, }, "custom/arch": { "format": "  ", "tooltip": false, "on-click": "sleep 0.1 && rofi -show drun", - "on-click-right": "wleave" + "on-click-right": "wleave", }, "custom/notifications": { "tooltip": false, @@ -251,14 +253,14 @@ "inhibited-notification": "", "inhibited-none": "", "dnd-inhibited-notification": "", - "dnd-inhibited-none": "" + "dnd-inhibited-none": "", }, "return-type": "json", "exec-if": "which swaync-client", "exec": "swaync-client -swb", "on-click": "sleep 0.1 && swaync-client -t -sw", "on-click-right": "swaync-client -d -sw", - "escape": true + "escape": true, }, "hyprland/workspaces": { "disable-scroll": true, @@ -276,31 +278,31 @@ "17": "", "18": "", "19": "", - "20": "" + "20": "", }, "on-scroll-up": "hyprctl dispatch workspace r-1", "on-scroll-down": "hyprctl dispatch workspace r+1", "on-click": "activate", - "sort-by-number": true + "sort-by-number": true, }, "cpu": { "on-click": "kitty --class center-float-large btop", "format": "CPU: {usage}%", "tooltip": false, - "interval": 2 + "interval": 2, }, "custom/gpu-usage": { "exec": "cat /sys/class/hwmon/hwmon1/device/gpu_busy_percent", "on-click": "kitty --class center-float-large nvtop", "format": "GPU: {}%", "return-type": "", - "interval": 2 + "interval": 2, }, "memory": { "format": "{}%  ", "on-click": "kitty --class center-float-large btop", "tooltip": true, - "interval": 2 + "interval": 2, }, "temperature#cpu": { "critical-threshold": 90, @@ -310,7 +312,7 @@ "format": "{icon} {temperatureC}°C", "format-icons": ["", "", ""], "tooltip": true, - "interval": 2 + "interval": 2, }, "temperature#gpu": { "critical-threshold": 80, @@ -320,8 +322,8 @@ "format": "{icon} {temperatureC}°C", "format-icons": ["", "", ""], "tooltip": true, - "interval": 2 - } + "interval": 2, + }, }, { "height": 50, @@ -341,7 +343,7 @@ "format": "  ", "tooltip": false, "on-click": "sleep 0.1 && rofi -show drun", - "on-click-right": "wleave" + "on-click-right": "wleave", }, "custom/notifications": { "tooltip": false, @@ -354,14 +356,14 @@ "inhibited-notification": "", "inhibited-none": "", "dnd-inhibited-notification": "", - "dnd-inhibited-none": "" + "dnd-inhibited-none": "", }, "return-type": "json", "exec-if": "which swaync-client", "exec": "swaync-client -swb", "on-click": "sleep 0.1 && swaync-client -t -sw", "on-click-right": "swaync-client -d -sw", - "escape": true + "escape": true, }, "hyprland/workspaces": { "disable-scroll": true, @@ -378,15 +380,15 @@ "27": "", "28": "", "29": "", - "30": "" + "30": "", }, "on-scroll-up": "hyprctl dispatch workspace r-1", "on-scroll-down": "hyprctl dispatch workspace r+1", "on-click": "activate", - "sort-by-number": true + "sort-by-number": true, }, "tray": { - "spacing": 10 + "spacing": 10, }, "clock#cl2": { "tooltip-format": "{calendar}", @@ -401,8 +403,8 @@ "days": "{}", "weeks": "W{}", "weekdays": "{}", - "today": "{}" - } + "today": "{}", + }, }, "format": "{:%H:%M  - %A, %B %d, %Y  }", "actions": { @@ -410,9 +412,9 @@ "on-click-forward": "tz_up", "on-click-backward": "tz_down", "on-scroll-up": "shift_up", - "on-scroll-down": "shift_down" + "on-scroll-down": "shift_down", }, - "on-click-middle": "thunderbird -calendar && hyprctl dispatch workspace 23" - } - } + "on-click-middle": "thunderbird -calendar && hyprctl dispatch workspace 23", + }, + }, ] diff --git a/.config/waybar/scripts/weather.py b/.config/waybar/scripts/weather.py deleted file mode 100755 index 0ecffbcc..00000000 --- a/.config/waybar/scripts/weather.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python - -import json -from datetime import datetime - -import requests - -WEATHER_CODES = { - "113": "🌈", - "116": "⛅️", - "119": "☁️", - "122": "☁️", - "143": "🌫", - "176": "🌦", - "179": "🌧", - "182": "🌧", - "185": "🌧", - "200": "⛈", - "227": "🌨", - "230": "❄️", - "248": "🌫", - "260": "🌫", - "263": "🌦", - "266": "🌦", - "281": "🌧", - "284": "🌧", - "293": "🌦", - "296": "🌦", - "299": "🌧", - "302": "🌧", - "305": "🌧", - "308": "🌧", - "311": "🌧", - "314": "🌧", - "317": "🌧", - "320": "🌨", - "323": "🌨", - "326": "🌨", - "329": "❄️", - "332": "❄️", - "335": "❄️", - "338": "❄️", - "350": "🌧", - "353": "🌦", - "356": "🌧", - "359": "🌧", - "362": "🌧", - "365": "🌧", - "368": "🌨", - "371": "❄️", - "374": "🌧", - "377": "🌧", - "386": "⛈", - "389": "🌩", - "392": "⛈", - "395": "❄️", -} - -data = {} - - -weather = requests.get("https://wttr.in/Alicante?format=j1").json() - - -def format_time(time): - return time.replace("00", "").zfill(2) - - -def format_temp(): - return (hour["FeelsLikeC"] + "°").ljust(3) - - -def format_chances(hour): - chances = { - "chanceoffog": "Fog", - "chanceoffrost": "Frost", - "chanceofovercast": "Overcast", - "chanceofrain": "Rain", - "chanceofsnow": "Snow", - "chanceofsunshine": "Sunshine", - "chanceofthunder": "Thunder", - "chanceofwindy": "Wind", - } - - conditions = [] - for event in chances.keys(): - if int(hour[event]) > 0: - conditions.append(chances[event] + " " + hour[event] + "%") - return ", ".join(conditions) - - -data["text"] = ( - WEATHER_CODES[weather["current_condition"][0]["weatherCode"]] - + " " - + weather["current_condition"][0]["temp_C"] - + "°C" -) - -data[ - "tooltip" -] = f"{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°C\n" -data["tooltip"] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°C\n" -data["tooltip"] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n" -data["tooltip"] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n" -for i, day in enumerate(weather["weather"]): - data["tooltip"] += f"\n" - if i == 0: - data["tooltip"] += "Today, " - if i == 1: - data["tooltip"] += "Tomorrow, " - data["tooltip"] += f"{day['date']}\n" - data["tooltip"] += f"⬆️ {day['maxtempC']}° ⬇️ {day['mintempC']}° " - data[ - "tooltip" - ] += f"🌅 {day['astronomy'][0]['sunrise']} 🌇 {day['astronomy'][0]['sunset']}\n" - for hour in day["hourly"]: - if i == 0: - if int(format_time(hour["time"])) < datetime.now().hour - 2: - continue - data[ - "tooltip" - ] += f"{format_time(hour['time'])} {WEATHER_CODES[hour['weatherCode']]} {format_temp(hour['FeelsLikeC'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n" - - -print(json.dumps(data)) diff --git a/.local/bin/wttrbar b/.local/bin/wttrbar new file mode 100755 index 00000000..3dd7a737 Binary files /dev/null and b/.local/bin/wttrbar differ