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
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
|
|
||||||
reminder_output=$(remind -h ~/.reminders)
|
reminder_output=$(remind -h ~/.config/remind/reminders)
|
||||||
|
|
||||||
# Check if the reminder_output is not empty
|
# Check if the reminder_output is not empty
|
||||||
if [ -n "$reminder_output" ]; then
|
if [ -n "$reminder_output" ]; then
|
||||||
echo "Reminders:"
|
remind -h ~/.config/remind/reminders
|
||||||
remind -h ~/.reminders
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"height": 35,
|
"height": 35,
|
||||||
"modules-left": ["sway/workspaces"],
|
"modules-left": ["sway/workspaces"],
|
||||||
"modules-center": ["clock"],
|
"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": {
|
"sway/workspaces": {
|
||||||
"disable-scroll": true,
|
"disable-scroll": true,
|
||||||
"all-outputs": true,
|
"all-outputs": true,
|
||||||
@@ -24,7 +24,16 @@
|
|||||||
"format": "{: %H:%M %A %B %d}",
|
"format": "{: %H:%M %A %B %d}",
|
||||||
"tooltip-format": "<tt><big>{calendar}</big></tt>"
|
"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": {
|
"battery": {
|
||||||
"interval": 30,
|
"interval": 30,
|
||||||
"states": {
|
"states": {
|
||||||
@@ -67,7 +76,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"custom/power": {
|
"custom/power": {
|
||||||
"format": "⏻{}",
|
"format": "{}",
|
||||||
//"exec": "echo ; echo logout",
|
//"exec": "echo ; echo logout",
|
||||||
"on-click": "wlogout -p layer-shell",
|
"on-click": "wlogout -p layer-shell",
|
||||||
"interval" : 86400, // once every day
|
"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: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
font-family: Iosevka, FontAwesome;
|
font-family: Iosevka, FontAwesome;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
color: #bebebe;
|
||||||
}
|
}
|
||||||
|
|
||||||
window#waybar {
|
window#waybar {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
background: #000000;
|
background: #000000;
|
||||||
color: #bebebe;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Specific module styles */
|
||||||
#workspaces button {
|
#workspaces button {
|
||||||
color: #bebebe;
|
|
||||||
background: transparent;
|
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 {
|
#workspaces button.active {
|
||||||
color: white;
|
color: white;
|
||||||
margin: 5px 10px 0 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button.urgent{
|
#workspaces button.urgent {
|
||||||
margin: 5px 10px 0 10px;
|
|
||||||
padding: 0px 8px 0px 8px;
|
|
||||||
animation-duration: 0.5s;
|
animation-duration: 0.5s;
|
||||||
animation-timing-function: linear;
|
animation-timing-function: linear;
|
||||||
animation-iteration-count: infinite;
|
animation-iteration-count: infinite;
|
||||||
animation-direction: alternate;
|
animation-direction: alternate;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mode {
|
#mode {
|
||||||
font-family: "Iosevka";
|
font-family: "Iosevka";
|
||||||
margin: 0px 15px 0px 15px;
|
|
||||||
padding: 0px 12px 0px 12px;
|
|
||||||
color: black;
|
color: black;
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#battery{
|
#battery {
|
||||||
color: #bebebe;
|
|
||||||
margin:7px 4px 0 4px;
|
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
padding: 0px 5px 0px 5px;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#network {
|
#network {
|
||||||
color: #bebebe;
|
|
||||||
margin:7px 4px 4px 4px;
|
|
||||||
font-size: 16.5px;
|
|
||||||
border-radius: 6px;
|
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 {
|
@keyframes critical {
|
||||||
to {
|
to {
|
||||||
background: rgba(187,56,0, 1);
|
background: rgba(187,56,0, 1);
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
margin:7px 4px 0 4px;
|
|
||||||
padding: 3px 8px 2px 8px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes urgent {
|
@keyframes urgent {
|
||||||
to {
|
to {
|
||||||
background: rgba(212,140,0, 1);
|
background: rgba(212,140,0, 1);
|
||||||
@@ -85,8 +63,6 @@ window#waybar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#battery.critical:not(.charging) {
|
#battery.critical:not(.charging) {
|
||||||
padding: 0px 6px 0px 6px;
|
|
||||||
color: #bebebe;
|
|
||||||
animation-name: critical;
|
animation-name: critical;
|
||||||
animation-duration: 0.5s;
|
animation-duration: 0.5s;
|
||||||
animation-timing-function: linear;
|
animation-timing-function: linear;
|
||||||
@@ -95,54 +71,36 @@ window#waybar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#clock {
|
#clock {
|
||||||
border: none;
|
|
||||||
color: #bebebe;
|
|
||||||
font-family: Manjari;
|
font-family: Manjari;
|
||||||
font-size: 16.5px;
|
|
||||||
border-radius: 0;
|
|
||||||
padding: 3px 6px 2px 0px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#clock:hover {
|
#custom-weather {
|
||||||
box-shadow: inherit;
|
font-family: Manjari;
|
||||||
text-shadow: inherit;
|
|
||||||
background: inherit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-wlsunset {
|
#custom-music {
|
||||||
margin:7px 4px 0 4px;
|
font-family: Manjari;
|
||||||
color: #bebebe;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
|
||||||
/* padding: 0px px 5px 0px; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-wlsunset:hover {
|
#custom-wlsunset {}
|
||||||
box-shadow: inherit;
|
|
||||||
text-shadow: inherit;
|
|
||||||
background: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pulseaudio {
|
#pulseaudio {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
margin:7px 4px 0 4px;
|
}
|
||||||
font-size: 16.5px;
|
|
||||||
color: #bebebe;
|
#custom-power {
|
||||||
/* border-radius: 5px; */
|
margin:0px 3px 0px 0px;
|
||||||
/* padding: 0px 5px 0px 5px; */
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tray {
|
#tray {
|
||||||
margin: 7px 15px 3px 4px;
|
margin: 7px 10px 8px 4px;
|
||||||
background: rgba(40,40,40, .65);
|
background: rgba(40,40,40, .65);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 5px 3px 5px 5px;
|
padding: 5px 5px 5px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#idle_inhibitor {
|
#idle_inhibitor {
|
||||||
color: #bebebe;
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
margin: 7px 4px 0 4px;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 0px 5px 0px 5px;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user