buncha stuff
This commit is contained in:
+12
-12
@@ -21,7 +21,7 @@
|
||||
},
|
||||
|
||||
"clock": {
|
||||
"format": "{: %H:%M %a %B %d}",
|
||||
"format": " {:%H:%M %a %B %d}",
|
||||
"tooltip-format": "<tt><big>{calendar}</big></tt>"
|
||||
},
|
||||
"custom/music": {
|
||||
@@ -42,22 +42,22 @@
|
||||
"critical": 15
|
||||
},
|
||||
"full-at": "99",
|
||||
"format": "<span font='Font Awesome 5 Free 11'>{icon}</span> {capacity}%",
|
||||
"format-icons": ["","", "","", "", "", "", "", "", ""],
|
||||
"format-good": " {capacity}%", // An empty format will hide the module
|
||||
"format-full": " Full",
|
||||
"format-charging": "{capacity}% "
|
||||
"format": "{icon} {capacity}%",
|
||||
"format-icons": ["","", "","", ""],
|
||||
"format-good": " {capacity}%", // An empty format will hide the module
|
||||
"format-full": " Full",
|
||||
"format-charging": " {capacity}% "
|
||||
},
|
||||
"custom/wlsunset": {
|
||||
"format": "<span size='large'>{icon}</span>",
|
||||
"format": "{icon}",
|
||||
"format-icons": [""],
|
||||
"on-click": "wlsunset -l 47.6 -L -122.3 -t 3000 -T 3100"
|
||||
},
|
||||
"network": {
|
||||
"interval": 5,
|
||||
"format-wifi": " {essid}",
|
||||
"format-ethernet": " {ifname}",
|
||||
"format-disconnected": "",
|
||||
"format-ethernet": " {ifname}",
|
||||
"format-disconnected": " ",
|
||||
"tooltip-format-wifi": "{essid}:{signalStrength}\nSpeed:{bandwidthDownBits} \n{ipaddr}",
|
||||
"on-click": "alacritty -e nmtui"
|
||||
},
|
||||
@@ -67,17 +67,17 @@
|
||||
"on-click": "pavucontrol",
|
||||
"on-scroll-down": "amixer set Master 3%-",
|
||||
"format": "",
|
||||
"format": "<span size='large'>{icon}</span> {volume}%",
|
||||
"format": "{icon} {volume}%",
|
||||
"format-muted": "",
|
||||
"format-icons": {
|
||||
"headset": "",
|
||||
"headphone": "",
|
||||
"default": ["", "", " "]
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
},
|
||||
|
||||
"custom/power": {
|
||||
"format": "{}",
|
||||
"format": "{}",
|
||||
//"exec": "echo ; echo logout",
|
||||
"on-click": "wlogout -p layer-shell",
|
||||
"interval" : 86400, // once every day
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
{
|
||||
"layer": "top",
|
||||
"position": "top",
|
||||
"height": 44,
|
||||
"modules-left": ["hyprland/workspaces"],
|
||||
"modules-center": ["clock","custom/padd","custom/weather"],
|
||||
"modules-right": ["custom/l_end","custom/music","custom/padd","pulseaudio","custom/padd","network", "custom/padd","battery","custom/padd","custom/wlsunset","custom/padd", "tray","custom/power","custom/padd"],
|
||||
"hyprland/workspaces": {
|
||||
"disable-scroll": true,
|
||||
"all-outputs": true,
|
||||
"format": "<span size='large'>{icon}</span>",
|
||||
},
|
||||
|
||||
"sway/mode": {
|
||||
"format": "<span style='italic'>{}</span>"
|
||||
},
|
||||
|
||||
"tray": {
|
||||
"icon-size": 18,
|
||||
"spacing": 8
|
||||
},
|
||||
|
||||
"clock": {
|
||||
"format": " {:%H:%M %a %B %d}",
|
||||
"tooltip-format": "<tt><big>{calendar}</big></tt>"
|
||||
},
|
||||
"custom/music": {
|
||||
"exec": "~/.config/waybar/scripts/music.py",
|
||||
"interval": 3,
|
||||
"tooltip": false
|
||||
},
|
||||
"custom/weather": {
|
||||
"exec": "~/.config/waybar/scripts/weather.py",
|
||||
"interval": 600,
|
||||
"tooltip": false
|
||||
},
|
||||
"battery": {
|
||||
"interval": 15,
|
||||
"states": {
|
||||
// "good": 95,
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"full-at": "99",
|
||||
"format": "{icon} {capacity}%",
|
||||
"format-icons": ["","", "","", ""],
|
||||
"format-good": " {capacity}%", // An empty format will hide the module
|
||||
"format-full": " Full",
|
||||
"format-charging": " {capacity}% "
|
||||
},
|
||||
"custom/wlsunset": {
|
||||
"format": "{icon}",
|
||||
"format-icons": [""],
|
||||
"on-click": "wlsunset -l 47.6 -L -122.3 -t 3000 -T 3100"
|
||||
},
|
||||
"network": {
|
||||
"interval": 5,
|
||||
"format-wifi": " {essid}",
|
||||
"format-ethernet": " {ifname}",
|
||||
"format-disconnected": " ",
|
||||
"tooltip-format-wifi": "{essid}:{signalStrength}\nSpeed:{bandwidthDownBits} \n{ipaddr}",
|
||||
"on-click": "alacritty -e nmtui"
|
||||
},
|
||||
"pulseaudio": {
|
||||
"scroll-step": 1,
|
||||
"on-scroll-up": "amixer set Master 3%+",
|
||||
"on-click": "pavucontrol",
|
||||
"on-scroll-down": "amixer set Master 3%-",
|
||||
"format": "",
|
||||
"format": "{icon} {volume}%",
|
||||
"format-muted": "",
|
||||
"format-icons": {
|
||||
"headset": "",
|
||||
"headphone": "",
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
},
|
||||
|
||||
"custom/power": {
|
||||
"format": "{}",
|
||||
//"exec": "echo ; echo logout",
|
||||
"on-click": "wlogout -p layer-shell",
|
||||
"interval" : 86400, // once every day
|
||||
"tooltip": true
|
||||
},
|
||||
|
||||
"custom/l_end": {
|
||||
"format": " ",
|
||||
"interval" : "once",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"custom/r_end": {
|
||||
"format": " ",
|
||||
"interval" : "once",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"custom/sl_end": {
|
||||
"format": " ",
|
||||
"interval" : "once",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"custom/sr_end": {
|
||||
"format": " ",
|
||||
"interval" : "once",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"custom/rl_end": {
|
||||
"format": " ",
|
||||
"interval" : "once",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"custom/rr_end": {
|
||||
"format": " ",
|
||||
"interval" : "once",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"custom/padd": {
|
||||
"format": " ",
|
||||
"interval" : "once",
|
||||
"tooltip": false
|
||||
}
|
||||
}
|
||||
@@ -8,27 +8,26 @@ API_KEY = "99631af2d6db903d1f689c7d2cb13764"
|
||||
CITY_ID = "5809844"
|
||||
UNITS = "metric"
|
||||
|
||||
|
||||
def celsius_to_fahrenheit(celsius):
|
||||
return (celsius * 9 / 5) + 32
|
||||
|
||||
|
||||
def get_weather_icon(description):
|
||||
icons = {
|
||||
"clear sky": "",
|
||||
"few clouds": "",
|
||||
"scattered clouds": "",
|
||||
"broken clouds": "",
|
||||
"overcast clouds": "",
|
||||
"shower rain": "",
|
||||
"light rain": "",
|
||||
"rain": "",
|
||||
"moderate rain": "",
|
||||
"thunderstorm": "",
|
||||
"snow": "",
|
||||
"mist": "",
|
||||
"haze": "",
|
||||
"smoke": ""
|
||||
"clear sky": "☀️",
|
||||
"few clouds": "🌤️",
|
||||
"scattered clouds": "🌥️",
|
||||
"broken clouds": "☁️",
|
||||
"overcast clouds": "☁️",
|
||||
"shower rain": "🌦️",
|
||||
"light rain": "🌧️",
|
||||
"rain": "🌧️",
|
||||
"moderate rain": "🌧️",
|
||||
"thunderstorm": "⛈️",
|
||||
"snow": "❄️",
|
||||
"mist": "🌫️",
|
||||
"haze": "🌫️",
|
||||
"smoke": "🌫️",
|
||||
}
|
||||
return icons.get(description, "❓")
|
||||
|
||||
@@ -39,6 +38,7 @@ try:
|
||||
)
|
||||
response.raise_for_status()
|
||||
weather_data = response.json()
|
||||
#print(weather_data)
|
||||
|
||||
weather_desc = weather_data["weather"][0]["description"]
|
||||
#print(weather_desc)
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import sys
|
||||
import re
|
||||
|
||||
|
||||
def fahrenheit_to_celsius(fahrenheit):
|
||||
return (fahrenheit - 32) * 5 / 9
|
||||
|
||||
|
||||
def get_weather():
|
||||
try:
|
||||
response = requests.get("http://wttr.in/sea?format=1")
|
||||
response.raise_for_status()
|
||||
return response.text.strip()
|
||||
except requests.exceptions.RequestException as e:
|
||||
return f"Error: {e}"
|
||||
|
||||
|
||||
def format_weather(weather):
|
||||
try:
|
||||
# print(f"Raw weather data: '{weather}'") # Debug print
|
||||
match = re.match(r"(\D+)\s+(\+?[\d.]+)°F", weather)
|
||||
if not match:
|
||||
return "Error: Unexpected weather format"
|
||||
|
||||
icon = match.group(1).strip()
|
||||
temp_f = round(float(match.group(2)))
|
||||
temp_c = round(fahrenheit_to_celsius(temp_f))
|
||||
return f"{icon} {temp_c}°C / {temp_f}°F"
|
||||
except Exception as e:
|
||||
return f"Error formatting weather data: {e}"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
weather = get_weather()
|
||||
if weather.startswith("Error"):
|
||||
print(weather)
|
||||
sys.exit(1)
|
||||
else:
|
||||
formatted_weather = format_weather(weather)
|
||||
print(formatted_weather)
|
||||
@@ -2,7 +2,7 @@
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: Iosevka, FontAwesome;
|
||||
font-family: "Iosevka Fixed", "Font Awesome 6 Free";
|
||||
font-size: 15px;
|
||||
min-height: 0;
|
||||
color: #bebebe;
|
||||
|
||||
Reference in New Issue
Block a user