Improve wayland configs
This commit is contained in:
parent
35f4e0c88f
commit
ceea1c316a
18 changed files with 549 additions and 41 deletions
12
.config/waybar/colors.css
Normal file
12
.config/waybar/colors.css
Normal file
|
@ -0,0 +1,12 @@
|
|||
@define-color background-darker #1E1F29;
|
||||
@define-color background #282a36;
|
||||
@define-color selection #44475a;
|
||||
@define-color foreground #f8f8f2;
|
||||
@define-color comment #6272a4;
|
||||
@define-color cyan #8be9fd;
|
||||
@define-color green #50fa7b;
|
||||
@define-color orange #ffb86c;
|
||||
@define-color pink #ff79c6;
|
||||
@define-color purple #bd93f9;
|
||||
@define-color red #ff5555;
|
||||
@define-color yellow #f1fa8c;
|
80
.config/waybar/config
Normal file
80
.config/waybar/config
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"layer": "top",
|
||||
"position": "bottom",
|
||||
"height": 24,
|
||||
"spacing": 4,
|
||||
"modules-left": [
|
||||
"wlr/workspaces"
|
||||
],
|
||||
"modules-center": [
|
||||
],
|
||||
"modules-right": [
|
||||
"network",
|
||||
"cpu",
|
||||
"temperature",
|
||||
"memory",
|
||||
"custom/pacman",
|
||||
"idle_inhibitor",
|
||||
"custom/weather",
|
||||
"clock",
|
||||
"tray"
|
||||
],
|
||||
"wlr/workspaces": {
|
||||
"on-click": "activate",
|
||||
"all-outputs": true,
|
||||
"sort-by-number": true,
|
||||
"persistent_workspaces": {
|
||||
"01": [],
|
||||
"02": [],
|
||||
"03": [],
|
||||
"04": [],
|
||||
"05": [],
|
||||
"06": [],
|
||||
"07": [],
|
||||
"08": [],
|
||||
"09": [],
|
||||
"10": []
|
||||
}
|
||||
},
|
||||
"sway/workspaces": {
|
||||
"disable-scroll": true,
|
||||
"all-outputs": true,
|
||||
"format": "{name}",
|
||||
"persistent_workspaces": {
|
||||
"01": [],
|
||||
"02": [],
|
||||
"03": [],
|
||||
"04": [],
|
||||
"05": [],
|
||||
"06": [],
|
||||
"07": [],
|
||||
"08": [],
|
||||
"09": [],
|
||||
"10": []
|
||||
}
|
||||
},
|
||||
"hyprland/window": {
|
||||
"max-length": 128
|
||||
},
|
||||
"clock": {
|
||||
"format": "{:%Y-%m-%d %H:%M:%S}",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||
},
|
||||
"tray": {
|
||||
"spacing": 4
|
||||
},
|
||||
"custom/pacman": {
|
||||
"format": " {}",
|
||||
"interval": 3600,
|
||||
"exec": "checkupdates | wc -l",
|
||||
"on-click": "alacritty -e 'archlinux-update'; pkill -SIGRTMIN+8 waybar",
|
||||
"signal": 8
|
||||
},
|
||||
"custom/weather": {
|
||||
"exec": "~/.config/waybar/wttr.py",
|
||||
"return-type": "json",
|
||||
"format": "{}",
|
||||
"tooltip": true,
|
||||
"interval": 1200
|
||||
}
|
||||
}
|
36
.config/waybar/style.css
Normal file
36
.config/waybar/style.css
Normal file
|
@ -0,0 +1,36 @@
|
|||
@import url("./colors.css");
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: Iosevka;
|
||||
font-size: 11pt;
|
||||
min-height: 0;
|
||||
}
|
||||
window#waybar {
|
||||
opacity: 1;
|
||||
background: @background-darker;
|
||||
color: @foreground;
|
||||
border-bottom: 2px solid @background;
|
||||
}
|
||||
#workspaces button {
|
||||
padding: 0 10px;
|
||||
background: @background;
|
||||
color: @foreground;
|
||||
}
|
||||
#workspaces button:hover {
|
||||
box-shadow: inherit;
|
||||
text-shadow: inherit;
|
||||
background-image: linear-gradient(0deg, @selection, @background-darker);
|
||||
}
|
||||
#workspaces button.active,
|
||||
#workspaces button.focused,
|
||||
#workspaces button.visible {
|
||||
background-image: linear-gradient(0deg, @purple, @selection);
|
||||
}
|
||||
#taskbar button.active {
|
||||
background-image: linear-gradient(0deg, @pruple, @background-darker);
|
||||
}
|
||||
#clock {
|
||||
padding: 0 4px;
|
||||
background: @background;
|
||||
}
|
115
.config/waybar/wttr.py
Executable file
115
.config/waybar/wttr.py
Executable file
|
@ -0,0 +1,115 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python -p python3 python3Packages.requests
|
||||
|
||||
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['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]['FeelsLikeC']+"°"
|
||||
|
||||
data['tooltip'] = f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°</b>\n"
|
||||
data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\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['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))
|
Loading…
Add table
Add a link
Reference in a new issue