Compare commits

...

3 Commits

Author SHA1 Message Date
1741067800 add fonts.nix 2023-08-06 09:35:28 +02:00
19c4f11670 add xcursor.nix 2023-08-06 09:24:27 +02:00
dfbab59b45 enable gtk 2023-08-06 09:17:38 +02:00
11 changed files with 511 additions and 332 deletions

View File

@ -4,10 +4,13 @@
./bat.nix ./bat.nix
./dunst.nix ./dunst.nix
./git.nix ./git.nix
./gtk.nix
./hyprland.nix ./hyprland.nix
./kitty.nix ./kitty.nix
./librewolf.nix ./librewolf.nix
./neovim.nix ./neovim.nix
./waybar.nix ./waybar.nix
./xcursor.nix
./xresources.nix
]; ];
} }

View File

@ -6,5 +6,23 @@
package = pkgs.papirus-icon-theme; package = pkgs.papirus-icon-theme;
name = "Papirus"; name = "Papirus";
}; };
settings = {
global = {
geometry = "1870x5-25+45";
width = 350;
separator_height = 5;
padding = 24;
horizontal_padding = 24;
frame_width = 3;
idle_threshold = 120;
alignment = "center";
word_wrap = "yes";
transparency = 5;
format = "<b>%s</b>: %b";
markup = "full";
min_icon_size = 32;
max_icon_size = 128;
};
};
}; };
} }

21
home/gtk.nix Normal file
View File

@ -0,0 +1,21 @@
{ pkgs, ... }: {
gtk = {
enable = true;
cursorTheme = {
package = pkgs.phinger-cursors;
name = "phinger-cursors";
};
gtk3.extraConfig = {
gtk-decoration-layout = "menu";
gtk-xft-antialias = 1;
gtk-xft-hinting = 1;
gtk-xft-hintstyle = "hintfull";
gtk-xft-rgba = "rgb";
gtk-recent-files-enable = false;
};
iconTheme = {
package = pkgs.fluent-icon-theme;
name = "Fluent-dark";
};
};
}

View File

@ -3,10 +3,16 @@
in { in {
xdg.configFile."hypr/hyprland.conf".text = '' xdg.configFile."hypr/hyprland.conf".text = ''
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,hyprland
env = GDK_BACKEND,wayland
env = QT_QPA_PLATFORM,wayland
general { general {
gaps_in = 0 gaps_in = 1
gaps_out = -1 gaps_out = 1
border_size = 0 border_size = 1
layout = master layout = master
} }
@ -31,7 +37,7 @@ in {
special_scale_factor = 1 special_scale_factor = 1
} }
exec-once = waybar
$SUPER = ${modifier}; $SUPER = ${modifier};
bind = $SUPER, Q, exec, kitty bind = $SUPER, Q, exec, kitty

View File

@ -1,429 +1,393 @@
{ {
xdg.configFile."waybar/config".text = /* json */ '' xdg.configFile."waybar/config".text = /* json */ ''
{ {
"layer": "top", "layer": "top",
"position": "bottom", "position": "top",
"height": 35, "mod": "dock",
"spacing": 4, "exclusive": true,
"margin-top": 0, "passthrough": false,
"margin-bottom":0, "gtk-layer-shell": true,
"height": 0,
"modules-left": [
"clock",
"custom/weather",
"wlr/workspaces"
],
"modules-center": ["hyprland/window"],
"modules-right": [
"tray",
"custom/updates",
"custom/language",
"battery",
"backlight",
"pulseaudio",
"pulseaudio#microphone"
],
// Choose the order of the modules "hyprland/window": {
"format": "{}"
"modules-left":[ "custom/launcher", "wlr/taskbar"], },
"modules-center":["custom/media"], "wlr/workspaces": {
"modules-right":["backlight", "battery", "battery#bat2", "idle_inhibitor", "custom/updater", "pulseaudio", "custom/snip", "custom/wallpaper", "tray", "clock", "custom/power"], "disable-scroll": true,
// Modules configuration "all-outputs": true,
"wlr/taskbar": {
"format": "{icon}",
"icon-size": 20,
"icon-theme": "Star",
"tooltip-format": "{title}",
"on-click": "activate", "on-click": "activate",
"on-click-middle": "close", //"format": "{icon}",
"on-click-right": "minimize" "persistent_workspaces": {
}, "1": [],
"keyboard-state": { "2": [],
"numlock": true, "3": [],
"capslock": true, "4": [],
"format": " {name} {icon}", "5": [],
"format-icons": { "6": [],
"locked": "", "7": [],
"unlocked": "" "8": [],
"9": [],
"10": []
} }
}, },
"sway/language": { "custom/updates": {
"format": " {}", "format": " {}",
"interval": 7200, // every two hours
"exec": "i=$(checkupdates); echo \"$i\" |wc -l; echo \"$i\" |column -t |tr '\n' '\r'", // # of updates and tooltip details
"exec-if": "exit 0", // always run; consider advanced run conditions
"on-click": "kitty -e sudo pacman -Syu", // update system
"signal": 8
}, },
"idle_inhibitor": { "custom/weather" : {
"format": "{icon}", "tooltip" : true,
"format-icons": { "format" : "{}",
"activated": "", "interval" : 30,
"deactivated": "" "exec" : "~/.config/waybar/waybar-wttr.py",
} "return-type" : "json"
}, },
"tray": { "tray": {
"icon-size": 20, "icon-size": 13,
"spacing": 10 "spacing": 10
}, },
"clock": { "clock": {
// "timezone": "America/New_York", "format": "{: %R %d/%m}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>", "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
}, },
"backlight": { "backlight": {
// "device": "acpi_video1", "device": "intel_backlight",
"format": "{icon}", "format": "{icon} {percent}%",
"format-icons": ["", ""], "format-icons": ["", "", ""],
"on-click": "bash $HOME/.config/system_scripts/brightness up", "on-scroll-up": "brightnessctl set 1%+",
"on-click-right": "bash $HOME/.config/system_scripts/brightness down", "on-scroll-down": "brightnessctl set 1%-",
"on-scroll-up": "", "min-length": 6
"on-scroll-down": ""
}, },
"battery": { "battery": {
"states": { "states": {
// "good": 95, "good": 95,
"warning": 30, "warning": 30,
"critical": 15 "critical": 20
}, },
"format": "{icon}", "format": "{icon} {capacity}%",
"format-charging": "{capacity}% ", "format-charging": " {capacity}%",
"format-plugged": "{capacity}% ", "format-plugged": " {capacity}%",
"format-alt": "{time} {icon}", "format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module "format-icons": ["", "", "", "", "", "", "", "", "", "", ""]
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "CMB1"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "Connected ",
"tooltip-format": "{ifname} via {gwaddr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ",
"format-alt": "{ifname}: {ipaddr}/{cidr}",
"on-click-right": "bash ~/.config/rofi/wifi_menu/rofi_wifi_menu"
}, },
"pulseaudio": { "pulseaudio": {
// "scroll-step": 1, // %, can be a float "format": "{icon} {volume}%",
"format": "{icon}", "tooltip": false,
"format-bluetooth": "{volume}% {icon}", "format-muted": " Muted",
"format-bluetooth-muted": "{icon} {format_source}", "on-click": "pamixer -t",
"format-muted": "{format_source}", "on-scroll-up": "pamixer -i 5",
"format-source": "", "on-scroll-down": "pamixer -d 5",
"format-source-muted": "", "scroll-step": 5,
"format-icons": { "format-icons": {
"headphone": "", "headphone": "",
"hands-free": "", "hands-free": "",
"headset": "", "headset": "",
"phone": "", "phone": "",
"portable": "", "portable": "",
"car": "", "car": "",
"default": ["", "", ""] "default": ["", "", ""]
}, }
"on-click": "bash $HOME/.config/system_scripts/volume up",
"on-click-right": "bash $HOME/.config/system_scripts/volume down",
"on-scroll-up": "",
"on-scroll-down": ""
}, },
"custom/media": { "pulseaudio#microphone": {
"format": "{icon} {}", "format": "{format_source}",
"return-type": "json", "format-source": " {volume}%",
"max-length": 30, "format-source-muted": " Muted",
"format-icons": { "on-click": "pamixer --default-source -t",
"spotify": " ", "on-scroll-up": "pamixer --default-source -i 5",
"default": "" "on-scroll-down": "pamixer --default-source -d 5",
}, "scroll-step": 5
"escape": true,
"exec": "$HOME/.config/system_scripts/mediaplayer.py 2> /dev/null",
"on-click": "playerctl play-pause"
},
"custom/launcher":{
"format": "",
"on-click": "wofi --show drun",
"on-click-right": "killall wofi"
},
"custom/power":{
"format": " ",
"on-click": "nwg-bar",
"on-click-right": "killall nwg-bar"
},
"custom/updater":{
"format": "{} Updates",
"exec": "checkupdates | wc -l",
"exec-if": "[[ $(checkupdates | wc -l) != 0 ]]",
"interval": 15,
"on-click": "alacritty -e yay -Syu"
},
"custom/snip":{
"format": "",
"on-click": "grimshot --notify save area $HOME/Pictures/$(zenity --entry --text 'Set filename:' --entry-text '.png')"
},
"custom/wallpaper":{
"format": "",
"on-click": "bash ~/.config/system_scripts/pkill_bc"
} }
} }
''; '';
xdg.configFile."waybar/style.css".text = /* css */ '' xdg.configFile."waybar/style.css".text = /* css */ ''
* { * {
border: none; border: none;
border-radius: 0px; border-radius: 0;
/* `otf-font-awesome` is required to be installed for icons */ font-family: Cartograph CF Nerd Font, monospace;
font-family: Material, Roboto, Helvetica, Arial, sans-serif; font-weight: bold;
font-size: 13px; font-size: 14px;
min-height: 0; min-height: 0;
/*border-radius: 20px;*/
} }
window#waybar { window#waybar {
background-image: linear-gradient(to right, #000000 0%, #434343 51%, #000000 100%); background: rgba(21, 18, 27, 0);
color: #ffffff; color: #cdd6f4;
transition-property: background-color;
transition-duration: .5s;
} }
window#waybar.hidden { tooltip {
opacity: 0.2; background: #1e1e2e;
border-radius: 10px;
border-width: 2px;
border-style: solid;
border-color: #11111b;
} }
#workspaces button { #workspaces button {
background: #1f1f1f; padding: 5px;
color: #ffffff; color: #313244;
border-radius: 20px; margin-right: 5px;
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ #workspaces button.active {
#workspaces button:hover { color: #a6adc8;
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
} }
#workspaces button.focused { #workspaces button.focused {
background: #1f1f1f; color: #a6adc8;
} background: #eba0ac;
border-radius: 10px;
#workspaces button.focused:hover {
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
} }
#workspaces button.urgent { #workspaces button.urgent {
background-color: #eb4d4b; color: #11111b;
background: #a6e3a1;
border-radius: 10px;
} }
#mode { #workspaces button:hover {
background-color: #64727D; background: #11111b;
border-bottom: 3px solid #ffffff; color: #cdd6f4;
border-radius: 10px;
} }
#custom-language,
#custom-updates,
#custom-caffeine,
#custom-weather,
#window,
#clock, #clock,
#battery, #battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio, #pulseaudio,
#custom-media, #network,
#custom-launcher, #workspaces,
#custom-power,
#custom-wallpaper,
#custom-updater,
#custom-snip,
#taskbar,
#tray, #tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0px 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0px;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0px;
}
#clock {
background-color: #090909;
color: #ffffff;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
color: #ffffff;
}
#memory {
color: #ffffff;
}
#disk {
color: #ffffff;
}
#backlight { #backlight {
background-color: #90b1b1; background: #1e1e2e;
} padding: 0px 10px;
margin: 3px 0px;
#pulseaudio { margin-top: 10px;
color: #ffffff; border: 1px solid #181825;
font-size: 18px;
}
#pulseaudio.muted {
color: red;
}
#custom-media {
color: whitesmoke;
margin: 5px;
font-size: 13px;
}
#custom-media.custom-spotify {
background-color: #8EC5FC;
background-image: linear-gradient(to right, #434343 0%, #000000 51%, #434343 100%);
color: whitesmoke;
margin-right: 5px;
}
#custom-media.custom-vlc {
background-color: #8EC5FC;
background-image: linear-gradient(to right, #434343 0%, #000000 51%, #434343 100%);
color: whitesmoke;
margin-right: 5px;
}
#custom-power{
background-image: linear-gradient(to left, #000000 0%, #000000 51%, #434343 100%);
font-size: 20px;
margin-right: 5px;
}
#custom-launcher{
background-image: linear-gradient(to right, #000000 0%, #000000 51%, #434343 100%);
font-size: 20px;
margin-left: 5px;
}
#custom-wallpaper{
color: white;
font-size:18px;
}
#custom-updater {
color: white;
}
#custom-snip {
color: white;
font-size: 20px;
}
#taskbar{
color: white;
}
#temperature {
color: #ffffff;
}
#temperature.critical {
background-color: #eb4d4b;
} }
#tray { #tray {
color: #ffffff; border-radius: 10px;
margin-right: 10px;
} }
#tray > .passive { #workspaces {
-gtk-icon-effect: dim; background: #1e1e2e;
color: #ffffff; border-radius: 10px;
margin-left: 10px;
padding-right: 0px;
padding-left: 5px;
} }
#tray > .needs-attention { #custom-caffeine {
-gtk-icon-effect: highlight; color: #89dceb;
color: #ffffff; border-radius: 10px 0px 0px 10px;
border-right: 0px;
margin-left: 10px;
} }
#idle_inhibitor { #custom-language {
font-size: 18px; color: #f38ba8;
border-left: 0px;
border-right: 0px;
} }
#idle_inhibitor.activated { #custom-updates {
color: #ffffff; color: #f5c2e7;
border-radius: 10px 0px 0px 10px;
border-left: 0px;
border-right: 0px;
} }
#language { #window {
color: #ffffff; border-radius: 10px;
min-width: 16px; margin-left: 60px;
margin-right: 60px;
} }
#keyboard-state { #clock {
background: #97e1ad; color: #fab387;
color: #000000; border-radius: 10px 0px 0px 10px;
min-width: 16px; margin-left: 5px;
border-right: 0px;
} }
#keyboard-state > label { #network {
padding: 0px 5px; color: #f9e2af;
border-left: 0px;
border-right: 0px;
} }
#keyboard-state > label.locked { #pulseaudio {
background: rgba(0, 0, 0, 0.2); color: #89b4fa;
border-left: 0px;
border-right: 0px;
} }
#pulseaudio.microphone {
color: #cba6f7;
border-radius: 0px 10px 10px 0px;
border-left: 0px;
border-right: 0px;
margin-right: 5px;
}
#battery {
color: #a6e3a1;
border-radius: 0 10px 10px 0;
margin-right: 10px;
border-left: 0px;
}
#custom-weather {
border-radius: 0px 10px 10px 0px;
border-right: 0px;
margin-left: 0px;
}
'';
xdg.configFile."waybar/waybar-wttr.py".text = /* python */ ''
#!/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_C']}°</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))
''; '';
} }

6
home/xcursor.nix Normal file
View File

@ -0,0 +1,6 @@
{
home.file.".icons/default/index.theme".text = /* ini */ ''
[icon theme]
Inherits=phinger-cursors
'';
}

10
home/xresources.nix Normal file
View File

@ -0,0 +1,10 @@
{
xresources.properties = {
"Xft.hinting" = true;
"Xft.antialias" = true;
"Xft.autohint" = false;
"Xft.lcdfilter" = "lcddefault";
"Xft.hintstyle" = "hintfull";
"Xft.rgba" = "rgb";
};
}

View File

@ -1,6 +1,7 @@
{ {
imports = [ imports = [
./boot.nix ./boot.nix
./fonts.nix
./home-manager.nix ./home-manager.nix
./locale.nix ./locale.nix
./hyprland.nix ./hyprland.nix

29
modules/fonts.nix Normal file
View File

@ -0,0 +1,29 @@
{ pkgs, ... }:
{
fonts = {
enableDefaultFonts = false;
fonts = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
maple-mono
font-awesome
nerdfonts
kanji-stroke-order-font
liberation_ttf
];
fontconfig = {
defaultFonts = {
serif = [ "Noto Serif CJK JP" "Noto Serif" ];
sansSerif = [ "Noto Sans CJK JP" "Noto Sans" ];
monospace = [ "Noto Mono CJK JP" "Noto Mono" ];
};
allowBitmaps = false;
};
};
}

View File

@ -1,6 +1,7 @@
{ config, pkgs, ... }: { { config, pkgs, ... }: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
neofetch
tree tree
wget wget
]; ];

120
scripts/waybar-wttr.py Normal file
View File

@ -0,0 +1,120 @@
#!/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_C']}°</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))