More formatting changes
This commit is contained in:
parent
5a65bbd4bc
commit
78ee5c087f
2 changed files with 20 additions and 6 deletions
|
@ -202,12 +202,26 @@
|
|||
on-click = "makotoggle";
|
||||
};
|
||||
weatherModule = {
|
||||
exec = pkgs.writeScript "weatherScript" ''
|
||||
exec = let
|
||||
weatherConf = pkgs.writeText "weather.jsonc" ''
|
||||
{
|
||||
"logo": {
|
||||
"source": "none"
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "weather",
|
||||
"outputFormat": "%0A%t%0A%C%0A%l"
|
||||
}
|
||||
]
|
||||
}
|
||||
'';
|
||||
in pkgs.writeScript "weatherScript" ''
|
||||
# Fetch weather data
|
||||
fetch=$(fastfetch -c all -s weather -l none | sed -E 's/Weather: ([^ ]+) - ([^ ]+ [^ ]+) (\(.*\))/\1\n\2\n\3/' | sed 's/^\+//')
|
||||
temp=$(echo "$fetch" | sed -n '1p')
|
||||
condition=$(echo "$fetch" | sed -n '2p')
|
||||
location=$(echo "$fetch" | sed -n '3p' | sed 's/[()]//g')
|
||||
fetch=$(fastfetch -c ${weatherConf})
|
||||
temp=$(echo "$fetch" | sed -n '2s/^\+//p')
|
||||
condition=$(echo "$fetch" | sed -n '3p')
|
||||
location=$(echo "$fetch" | sed -n '4p')
|
||||
|
||||
# Map weather conditions to emojis
|
||||
case "$condition" in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue