possibly fix weather check
This commit is contained in:
parent
bb1819c726
commit
75162c6f61
17
flake.lock
generated
17
flake.lock
generated
@ -128,22 +128,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"done": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1633849654,
|
||||
"narHash": "sha256-6oeyN9ngXWvps1c5QAUjlyPDQwRWAoxBiVTNmZ4sG8E=",
|
||||
"owner": "franciscolourenco",
|
||||
"repo": "done",
|
||||
"rev": "d6abb267bb3fb7e987a9352bc43dcdb67bac9f06",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "franciscolourenco",
|
||||
"repo": "done",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"firenvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@ -311,7 +295,6 @@
|
||||
"base16-vscode": "base16-vscode",
|
||||
"bemoji": "bemoji",
|
||||
"bwmenu": "bwmenu",
|
||||
"done": "done",
|
||||
"firenvim": "firenvim",
|
||||
"mudl": "mudl",
|
||||
"nixpkgs": "nixpkgs",
|
||||
|
@ -373,13 +373,12 @@ in {
|
||||
};
|
||||
|
||||
settings.mainbar = let
|
||||
weatherCommand = f: "${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=${f}' || echo 'ERR'";
|
||||
weatherIf = "(${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=%t' || echo 'ERR') | grep -c 'ERR|Unknown'";
|
||||
weatherCommand = f: "(${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=${f}' || echo 'ERR') | ${pkgs.gnused}/bin/sed 's/^Unknown.*/ERR/'";
|
||||
in {
|
||||
position = lib.mkDefault "left";
|
||||
height = lib.mkDefault null;
|
||||
|
||||
modules-left = ["sway/workspaces" "custom/weather-spacer" "custom/weather-temp" "custom/weather-precip" "custom/weather-wind"];
|
||||
modules-left = ["sway/workspaces" "custom/spacer" "custom/weather-temp" "custom/weather-precip" "custom/weather-wind"];
|
||||
modules-center = ["clock#1" "clock#2" "custom/spacer" "custom/media" "custom/spacer" "clock#3" "custom/spacer" "clock#4"];
|
||||
modules-right = ["pulseaudio" "custom/spacer" "memory" "custom/spacer" "cpu"] ++ lib.optionals cfg.battery ["custom/spacer" "battery"] ++ ["custom/spacer" "tray"];
|
||||
|
||||
@ -389,30 +388,20 @@ in {
|
||||
tooltip = lib.mkDefault false;
|
||||
};
|
||||
|
||||
"custom/weather-spacer" = {
|
||||
exec-if = weatherIf;
|
||||
format = lib.mkDefault "〜";
|
||||
rotate = lib.mkDefault 90;
|
||||
tooltip = lib.mkDefault false;
|
||||
};
|
||||
|
||||
"custom/weather-temp" = {
|
||||
exec = lib.mkDefault (weatherCommand "%t+%c");
|
||||
exec-if = weatherIf;
|
||||
exec = lib.mkDefault (weatherCommand "%c%t");
|
||||
on-click = lib.mkDefault "${pkgs.xdg-utils}/bin/xdg-open 'https://weather.com/weather/today/l/85625'";
|
||||
on-click-right = lib.mkDefault "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = lib.mkDefault 900;
|
||||
};
|
||||
"custom/weather-precip" = {
|
||||
exec = lib.mkDefault (weatherCommand "🌧️+%p");
|
||||
exec-if = weatherIf;
|
||||
on-click = lib.mkDefault "${pkgs.xdg-utils}/bin/xdg-open 'https://www.lightningmaps.org/'";
|
||||
on-click-right = "lib.mkDefault ${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = lib.mkDefault 900;
|
||||
};
|
||||
"custom/weather-wind" = {
|
||||
exec = lib.mkDefault (weatherCommand "🌬️+%w");
|
||||
exec-if = weatherIf;
|
||||
on-click = lib.mkDefault "${pkgs.xdg-utils}/bin/xdg-open 'https://www.ventusky.com/";
|
||||
on-click-right = lib.mkDefault "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = lib.mkDefault 900;
|
||||
|
Loading…
Reference in New Issue
Block a user