Initial commit: waybar config
This commit is contained in:
commit
610709287d
1
colors.css
Symbolic link
1
colors.css
Symbolic link
@ -0,0 +1 @@
|
||||
/home/Nicholai/.cache/wal/colors-waybar.css
|
||||
152
config.jsonc
Normal file
152
config.jsonc
Normal file
@ -0,0 +1,152 @@
|
||||
{
|
||||
"layer": "top",
|
||||
"position": "top",
|
||||
"mod": "dock",
|
||||
"exclusive": true,
|
||||
"passthrough": false,
|
||||
"gtk-layer-shell": true,
|
||||
"height": 20,
|
||||
"modules-left": ["clock","custom/weather","custom/wallpaper","hyprland/window"],
|
||||
"modules-center": ["hyprland/workspaces"],
|
||||
"modules-right": ["network", "bluetooth", "temperature","custom/power_profile","battery","backlight","pulseaudio","pulseaudio#microphone"],
|
||||
"hyprland/window": {
|
||||
"format": "{}"
|
||||
},
|
||||
|
||||
|
||||
"hyprland/workspaces": {
|
||||
"format": "{name} : {icon}",
|
||||
"format-icons": {
|
||||
"1": "",
|
||||
"2": "",
|
||||
"3": "",
|
||||
"4": "",
|
||||
"5": "",
|
||||
"active": "",
|
||||
"default": ""
|
||||
},
|
||||
"persistent-workspaces": {
|
||||
"Virtual-1": [1, 2, 3, 4, 5]
|
||||
}
|
||||
},
|
||||
|
||||
"custom/wallpaper": {
|
||||
"format": "Wallpaper",
|
||||
"interval": 1,
|
||||
"tooltip": true,
|
||||
// "exec": "~/scripts/pywal/wallpapermenu.sh",
|
||||
"on-click": "~/scripts/pywal/wallpapermenu.sh",
|
||||
"return-type" : "json"
|
||||
},
|
||||
|
||||
|
||||
"custom/power_profile":{
|
||||
//shows the current power profile and switches to next on click
|
||||
// "exec": "asusctl profile -p | sed s:'Active profile is'::",
|
||||
"interval": 30,
|
||||
"format": "{}",
|
||||
// "on-click": "asusctl profile -n; pkill -SIGRTMIN+8 waybar",
|
||||
"signal": 8
|
||||
},
|
||||
|
||||
"custom/weather" : {
|
||||
//shows the current weather and forecast
|
||||
"tooltip" : true,
|
||||
"format" : "{}",
|
||||
"interval" : 30,
|
||||
"exec" : "~/.config/waybar/scripts/waybar-wttr.py",
|
||||
"return-type" : "json"
|
||||
},
|
||||
|
||||
// "tray": {
|
||||
// "icon-size": 18,
|
||||
// "spacing": 10
|
||||
// },
|
||||
|
||||
// "clock": {
|
||||
// "format": "{: %I:%M %p %a, %b %e}",
|
||||
// "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||
// },
|
||||
"clock": {
|
||||
"format": "{:%I:%M %p}" // hours:minutes AM/PM
|
||||
// or 24-hour: "{:%H:%M}"
|
||||
},
|
||||
|
||||
|
||||
// "backlight": {
|
||||
// "device": "intel_backlight",
|
||||
// "format": "{icon} {percent}%",
|
||||
// "format-icons": ["", "", ""],
|
||||
// "on-scroll-up": "brightnessctl set 1%+",
|
||||
// "on-scroll-down": "brightnessctl set 1%-",
|
||||
// "min-length": 6
|
||||
// },
|
||||
|
||||
"battery": {
|
||||
"states": {
|
||||
"good": 95,
|
||||
"warning": 30,
|
||||
"critical": 20
|
||||
},
|
||||
"format": "{icon} {capacity}%",
|
||||
"format-charging": " {capacity}%",
|
||||
"format-plugged": " {capacity}%",
|
||||
"format-alt": "{time} {icon}",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", "", "", ""]
|
||||
},
|
||||
|
||||
"pulseaudio": {
|
||||
"format": "{icon} {volume}%",
|
||||
"tooltip": false,
|
||||
"format-muted": " Muted",
|
||||
"on-click": "pamixer -t",
|
||||
"on-scroll-up": "pamixer -i 5",
|
||||
"on-scroll-down": "pamixer -d 5",
|
||||
"scroll-step": 5,
|
||||
"format-icons": {
|
||||
"headphone": "",
|
||||
"hands-free": "",
|
||||
"headset": "",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": ["", "", ""]
|
||||
}
|
||||
},
|
||||
|
||||
"pulseaudio#microphone": {
|
||||
"format": "{format_source}",
|
||||
"format-source": " {volume}%",
|
||||
"format-source-muted": " Muted",
|
||||
"on-click": "pamixer --default-source -t",
|
||||
"on-scroll-up": "pamixer --default-source -i 5",
|
||||
"on-scroll-down": "pamixer --default-source -d 5",
|
||||
"scroll-step": 5
|
||||
},
|
||||
|
||||
"temperature": {
|
||||
"thermal-zone": 1,
|
||||
"format": "{temperatureF}°F ",
|
||||
"critical-threshold": 80,
|
||||
"format-critical": "{temperatureC}°C "
|
||||
},
|
||||
|
||||
"network": {
|
||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||
"format-wifi": " {signalStrength}%",
|
||||
"format-ethernet": "{ipaddr}/{cidr}",
|
||||
"tooltip-format": "{essid} - {ifname} via {gwaddr}",
|
||||
"format-linked": "{ifname} (No IP)",
|
||||
"format-disconnected": "Disconnected ⚠",
|
||||
"format-alt": "{ifname}:{essid} {ipaddr}/{cidr}"
|
||||
},
|
||||
|
||||
"bluetooth": {
|
||||
"format": " {status}",
|
||||
"format-connected": " {num_connections}",
|
||||
"tooltip-format": "{controller_alias}",
|
||||
"tooltip-format-connected": "{device_enumerate}",
|
||||
"tooltip-format-enumerate-connected": "{device_alias}",
|
||||
"on-click": "blueman-manager" // launch the GUI when you left‑click
|
||||
}
|
||||
}
|
||||
119
scripts/waybar-wttr.py
Executable file
119
scripts/waybar-wttr.py
Executable file
@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import requests
|
||||
from datetime import datetime
|
||||
|
||||
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/?format=j1").json()
|
||||
|
||||
|
||||
#Def format_time(time):
|
||||
# return time.replace("00", "").zfill(2)
|
||||
|
||||
|
||||
def format_temp(temp):
|
||||
return (hour['FeelsLikeF']+"°").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)
|
||||
|
||||
tempint = int(weather['current_condition'][0]['FeelsLikeF'])
|
||||
#extrachar = ''
|
||||
if tempint > 0 and tempint < 10:
|
||||
extrachar = '+'
|
||||
|
||||
|
||||
data['text'] = ' '+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \
|
||||
" "+extrachar+weather['current_condition'][0]['FeelsLikeF']+"°"
|
||||
|
||||
data['tooltip'] = f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_F']}°</b>\n"
|
||||
data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeF']}°\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<b>"
|
||||
if i == 0:
|
||||
data['tooltip'] += "Today, "
|
||||
if i == 1:
|
||||
data['tooltip'] += "Tomorrow, "
|
||||
data['tooltip'] += f"{day['date']}</b>\n"
|
||||
data['tooltip'] += f"⬆️ {day['maxtempF']}° ⬇️ {day['mintempF']}° "
|
||||
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['FeelsLikeF'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
|
||||
|
||||
|
||||
print(json.dumps(data))
|
||||
175
style.css
Normal file
175
style.css
Normal file
@ -0,0 +1,175 @@
|
||||
|
||||
@import 'colors.css';
|
||||
|
||||
* {
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
font-family: "JetBrainsMono Nerd Font";
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#workspaces button {
|
||||
padding: 5px;
|
||||
color: @color4;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
color: @color11;
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
color: @color12;
|
||||
background: @color2;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
color: @color12;
|
||||
background: @color8;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background: @background;
|
||||
color: @color12;
|
||||
border-radius: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
#custom-power_profile,
|
||||
#custom-weather,
|
||||
#window,
|
||||
#clock,
|
||||
#battery,
|
||||
#pulseaudio,
|
||||
#network,
|
||||
#bluetooth,
|
||||
#temperature,
|
||||
#workspaces,
|
||||
#tray,
|
||||
#backlight {
|
||||
background: @background;
|
||||
color: @color12;
|
||||
opacity: 0.8;
|
||||
padding: 0px 10px;
|
||||
margin: 3px 0px;
|
||||
margin-top: 10px;
|
||||
border: 1px solid #181825;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
background: @background;
|
||||
border-radius: 5px 0px 0px 5px;
|
||||
}
|
||||
|
||||
#temperature.critical {
|
||||
color: #d13a3a;
|
||||
}
|
||||
|
||||
#backlight {
|
||||
background: @background;
|
||||
border-radius: 5px 0px 0px 5px;
|
||||
}
|
||||
|
||||
#tray {
|
||||
border-radius: 5px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#workspaces {
|
||||
background: @background;
|
||||
color: @color11;
|
||||
border-radius: 5px;
|
||||
margin-left: 10px;
|
||||
padding-right: 0px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
#custom-power_profile {
|
||||
color: @color9;
|
||||
border-left: 0px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
#window {
|
||||
background: @background;
|
||||
border-radius: 5px;
|
||||
margin-left: 60px;
|
||||
margin-right: 60px;
|
||||
}
|
||||
|
||||
#clock {
|
||||
background: @background;
|
||||
color: @color12;
|
||||
border-radius: 5px;
|
||||
margin-left: 10px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
#custom-wallpaper {
|
||||
background: @background;
|
||||
color: @color12;
|
||||
opacity: 0.8;
|
||||
padding: 0px 10px;
|
||||
margin: 3px 0px;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
margin-left: 10px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
#network {
|
||||
color: @color5;
|
||||
background: @background;
|
||||
border-radius: 5px 0px 0px 5px;
|
||||
border-left: 0px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
#bluetooth {
|
||||
color: @color5;
|
||||
background: @background;
|
||||
border-radius: 0px 5px 5px 0px;
|
||||
margin-right: 10px
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
color: @color10;
|
||||
background: @background;
|
||||
border-left: 0px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
#pulseaudio.microphone {
|
||||
color: @color11;
|
||||
background: @background;
|
||||
border-left: 0px;
|
||||
border-right: 0px;
|
||||
border-radius: 0px 5px 5px 0px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#battery {
|
||||
color: @color12;
|
||||
background: @background;
|
||||
border-radius: 0 5px 5px 0;
|
||||
margin-right: 10px;
|
||||
border-left: 0px;
|
||||
}
|
||||
|
||||
#custom-weather {
|
||||
border-radius: 0px 5px 5px 0px;
|
||||
border-right: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user