finally fixed a ton of shit about waybar and added music and weather widget
This commit is contained in:
5
.bashrc
5
.bashrc
@@ -13,12 +13,11 @@ elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
|
||||
reminder_output=$(remind -h ~/.reminders)
|
||||
reminder_output=$(remind -h ~/.config/remind/reminders)
|
||||
|
||||
# Check if the reminder_output is not empty
|
||||
if [ -n "$reminder_output" ]; then
|
||||
echo "Reminders:"
|
||||
remind -h ~/.reminders
|
||||
remind -h ~/.config/remind/reminders
|
||||
fi
|
||||
|
||||
#######################################################
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"height": 35,
|
||||
"modules-left": ["sway/workspaces"],
|
||||
"modules-center": ["clock"],
|
||||
"modules-right": ["custom/l_end","custom/wlsunset","custom/padd","pulseaudio", "custom/padd","network", "custom/padd","battery", "tray", "custom/power","custom/padd"],
|
||||
"modules-right": ["custom/l_end","custom/music","custom/padd","custom/weather","custom/padd","pulseaudio", "custom/padd","network", "custom/padd","battery","custom/padd","custom/wlsunset","custom/padd", "tray","custom/power","custom/padd"],
|
||||
"sway/workspaces": {
|
||||
"disable-scroll": true,
|
||||
"all-outputs": true,
|
||||
@@ -24,7 +24,16 @@
|
||||
"format": "{: %H:%M %A %B %d}",
|
||||
"tooltip-format": "<tt><big>{calendar}</big></tt>"
|
||||
},
|
||||
|
||||
"custom/music": {
|
||||
"exec": "~/.config/waybar/scripts/music.py",
|
||||
"interval": 5,
|
||||
"tooltip": false
|
||||
},
|
||||
"custom/weather": {
|
||||
"exec": "~/.config/waybar/scripts/weather.py",
|
||||
"interval": 600,
|
||||
"tooltip": true
|
||||
},
|
||||
"battery": {
|
||||
"interval": 30,
|
||||
"states": {
|
||||
@@ -67,7 +76,7 @@
|
||||
},
|
||||
|
||||
"custom/power": {
|
||||
"format": "⏻{}",
|
||||
"format": "{}",
|
||||
//"exec": "echo ; echo logout",
|
||||
"on-click": "wlogout -p layer-shell",
|
||||
"interval" : 86400, // once every day
|
||||
|
||||
22
.config/waybar/scripts/music.py
Executable file
22
.config/waybar/scripts/music.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
def get_playerctl_metadata(field):
|
||||
result = subprocess.run(
|
||||
["playerctl", "--player=strawberry", "metadata", field],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return result.stdout.strip()
|
||||
return None
|
||||
|
||||
|
||||
artist = get_playerctl_metadata("artist")
|
||||
title = get_playerctl_metadata("title")
|
||||
|
||||
if artist and title:
|
||||
print(f" {artist} - {title}")
|
||||
54
.config/waybar/scripts/weather.py
Executable file
54
.config/waybar/scripts/weather.py
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
|
||||
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": "",
|
||||
"shower rain": "",
|
||||
"rain": "",
|
||||
"thunderstorm": "",
|
||||
"snow": "",
|
||||
"mist": "",
|
||||
"overcast clouds": "",
|
||||
}
|
||||
return icons.get(description, "❓")
|
||||
|
||||
|
||||
try:
|
||||
response = requests.get(
|
||||
f"http://api.openweathermap.org/data/2.5/weather?id={CITY_ID}&units={UNITS}&appid={API_KEY}"
|
||||
)
|
||||
response.raise_for_status()
|
||||
weather_data = response.json()
|
||||
|
||||
weather_desc = weather_data["weather"][0]["description"]
|
||||
temp_c = weather_data["main"]["temp"]
|
||||
temp_f = celsius_to_fahrenheit(temp_c)
|
||||
weather_icon = get_weather_icon(weather_desc)
|
||||
|
||||
print(f"{weather_icon} {temp_c:.1f}°C / {temp_f:.1f}°F")
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"Error: {e}")
|
||||
print(json.dumps({"text": "", "tooltip": "Could not retrieve weather data"}))
|
||||
sys.exit(1)
|
||||
|
||||
except json.JSONDecodeError:
|
||||
print("Error: Failed to parse JSON response")
|
||||
print(response.content)
|
||||
sys.exit(1)
|
||||
@@ -1,81 +1,59 @@
|
||||
\* {
|
||||
/* General styles */
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: Iosevka, FontAwesome;
|
||||
font-size: 15px;
|
||||
min-height: 0;
|
||||
color: #bebebe;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
opacity: 0.7;
|
||||
background: #000000;
|
||||
color: #bebebe;
|
||||
}
|
||||
|
||||
/* Specific module styles */
|
||||
#workspaces button {
|
||||
color: #bebebe;
|
||||
background: transparent;
|
||||
padding: 0px 5px 0px 5px;
|
||||
margin: 5px 10px 0 10px;
|
||||
}
|
||||
#workspaces button.focused {
|
||||
color: white;
|
||||
margin: 5px 10px 0 10px;
|
||||
}
|
||||
|
||||
#workspaces button.focused,
|
||||
#workspaces button.active {
|
||||
color: white;
|
||||
margin: 5px 10px 0 10px;
|
||||
}
|
||||
|
||||
#workspaces button.urgent{
|
||||
margin: 5px 10px 0 10px;
|
||||
padding: 0px 8px 0px 8px;
|
||||
#workspaces button.urgent {
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
border-radius: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
#mode {
|
||||
font-family: "Iosevka";
|
||||
margin: 0px 15px 0px 15px;
|
||||
padding: 0px 12px 0px 12px;
|
||||
color: black;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#battery{
|
||||
color: #bebebe;
|
||||
margin:7px 4px 0 4px;
|
||||
#battery {
|
||||
border-radius: 5px;
|
||||
padding: 0px 5px 0px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
#network {
|
||||
color: #bebebe;
|
||||
margin:7px 4px 4px 4px;
|
||||
font-size: 16.5px;
|
||||
border-radius: 6px;
|
||||
/* padding: 0px 5px 0px 5px; */
|
||||
}
|
||||
|
||||
#custom-power {
|
||||
color: #bebebe;
|
||||
margin:7px 4px 0 4px;
|
||||
font-size: 16.5px;
|
||||
border-radius: 6px;
|
||||
/*padding: 0px 0px 0px 0px;*/
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes critical {
|
||||
to {
|
||||
background: rgba(187,56,0, 1);
|
||||
border-radius: 7px;
|
||||
margin:7px 4px 0 4px;
|
||||
padding: 3px 8px 2px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes urgent {
|
||||
to {
|
||||
background: rgba(212,140,0, 1);
|
||||
@@ -85,8 +63,6 @@ window#waybar {
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
padding: 0px 6px 0px 6px;
|
||||
color: #bebebe;
|
||||
animation-name: critical;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
@@ -95,54 +71,36 @@ window#waybar {
|
||||
}
|
||||
|
||||
#clock {
|
||||
border: none;
|
||||
color: #bebebe;
|
||||
font-family: Manjari;
|
||||
font-size: 16.5px;
|
||||
border-radius: 0;
|
||||
padding: 3px 6px 2px 0px;
|
||||
}
|
||||
|
||||
#clock:hover {
|
||||
box-shadow: inherit;
|
||||
text-shadow: inherit;
|
||||
background: inherit;
|
||||
#custom-weather {
|
||||
font-family: Manjari;
|
||||
}
|
||||
|
||||
#custom-wlsunset {
|
||||
margin:7px 4px 0 4px;
|
||||
color: #bebebe;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
/* padding: 0px px 5px 0px; */
|
||||
#custom-music {
|
||||
font-family: Manjari;
|
||||
}
|
||||
|
||||
#custom-wlsunset:hover {
|
||||
box-shadow: inherit;
|
||||
text-shadow: inherit;
|
||||
background: inherit;
|
||||
}
|
||||
#custom-wlsunset {}
|
||||
|
||||
#pulseaudio {
|
||||
background: transparent;
|
||||
margin:7px 4px 0 4px;
|
||||
font-size: 16.5px;
|
||||
color: #bebebe;
|
||||
/* border-radius: 5px; */
|
||||
/* padding: 0px 5px 0px 5px; */
|
||||
}
|
||||
|
||||
#custom-power {
|
||||
margin:0px 3px 0px 0px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
#tray {
|
||||
margin: 7px 15px 3px 4px;
|
||||
margin: 7px 10px 8px 4px;
|
||||
background: rgba(40,40,40, .65);
|
||||
border-radius: 6px;
|
||||
padding: 5px 3px 5px 5px;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
#idle_inhibitor {
|
||||
color: #bebebe;
|
||||
background: transparent;
|
||||
margin: 7px 4px 0 4px;
|
||||
border-radius: 6px;
|
||||
padding: 0px 5px 0px 5px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user