Compare commits
4 Commits
809ce39ad3
...
5fafc9e8a3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fafc9e8a3 | ||
|
|
78fb91c311 | ||
|
|
bf67e7d396 | ||
|
|
89428b966b |
@@ -27,15 +27,15 @@
|
||||
},
|
||||
"NxNORTH": {
|
||||
"base": {
|
||||
"foreground": "#e7ccfe",
|
||||
"background": "#0d0019"
|
||||
"foreground": "#e5e5e5",
|
||||
"background": "#0c0c0c"
|
||||
},
|
||||
"to_alter": {
|
||||
"accent": "#9f35fc",
|
||||
"secondary": "#324cff",
|
||||
"tertiary": "#4a62e7",
|
||||
"special": "#91fc34",
|
||||
"weird": "#fc344f"
|
||||
"accent": "#999999",
|
||||
"secondary": "#dddddd",
|
||||
"tertiary": "#999999",
|
||||
"special": "#999999",
|
||||
"weird": "#999999"
|
||||
}
|
||||
},
|
||||
"NxDCS": {
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
libraries = with pkgs.python3Packages; [ caldav ics pytz ];
|
||||
flakeIgnore = [ "E302" "E305" "E501" "E261" ];
|
||||
} /* python */ ''
|
||||
import os
|
||||
import json
|
||||
from caldav import DAVClient
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from ics import Calendar
|
||||
from pytz import UTC
|
||||
|
||||
@@ -33,13 +32,15 @@ def datetime_parser(dct):
|
||||
return dct
|
||||
|
||||
def load_cache(cache_file):
|
||||
if os.path.exists(cache_file):
|
||||
try:
|
||||
with open(cache_file, "r") as file:
|
||||
return json.load(file, object_hook=datetime_parser)
|
||||
except (json.JSONDecodeError, FileNotFoundError):
|
||||
return None
|
||||
|
||||
def save_cache(cache_file, data):
|
||||
with open(cache_file, "w") as file:
|
||||
data['last_checked'] = datetime.now(timezone.utc)
|
||||
json.dump(data, file, default=datetime_converter, indent=4)
|
||||
|
||||
|
||||
@@ -83,6 +84,11 @@ def is_expired(event_dict: dict):
|
||||
event_end = event_dict['event_end'].timestamp()
|
||||
return not (now <= event_end)
|
||||
|
||||
def is_too_old(event_dict: dict) -> bool:
|
||||
last_checked = event_dict['last_checked']
|
||||
now = datetime.now(timezone.utc)
|
||||
return now - last_checked >= timedelta(minutes=10)
|
||||
|
||||
if __name__ == "__main__":
|
||||
password_file = "${config.sops.secrets."nx2site/radicale/password".path}" # Path to password file
|
||||
cache_file = "/tmp/caldav_event_cache.json" # Path to cache file
|
||||
@@ -93,7 +99,7 @@ if __name__ == "__main__":
|
||||
|
||||
event_dict = load_cache(cache_file)
|
||||
|
||||
if (event_dict is None) or (is_expired(event_dict)):
|
||||
if (event_dict is None) or is_expired(event_dict) or is_too_old(event_dict):
|
||||
event_dict = get_ongoing_or_next_event(url, username, password)
|
||||
save_cache(cache_file, event_dict)
|
||||
|
||||
|
||||
@@ -226,10 +226,19 @@
|
||||
}
|
||||
{
|
||||
name = "markdown";
|
||||
language-servers = [ "language-tool" "marksman" ];
|
||||
language-servers = [ "marksman" ];
|
||||
file-types = [ "md" "MD" ];
|
||||
scope = "text.<name>";
|
||||
}
|
||||
{
|
||||
name = "markdown-with-language-tool";
|
||||
language-servers = [ "language-tool" "marksman" ];
|
||||
scope = "text.<name>";
|
||||
injection-regex = "";
|
||||
file-types = [""];
|
||||
# blcok-comment-tokens = { start = "<!--"; end = "-->"; };
|
||||
indent = { tab-width = 2; unit = " "; };
|
||||
}
|
||||
{
|
||||
name = "python";
|
||||
language-servers = [ "pyright" "ruff" ];
|
||||
|
||||
@@ -19,15 +19,16 @@
|
||||
};
|
||||
in {
|
||||
home.packages = with pkgs; [
|
||||
xdg-desktop-portal-hyprland
|
||||
grim
|
||||
hyprcursor
|
||||
hypridle
|
||||
hyprland-protocols
|
||||
hyprlock
|
||||
hypridle
|
||||
hyprshot
|
||||
hyprpicker
|
||||
hyprcursor
|
||||
grim
|
||||
hyprshade
|
||||
hyprshot
|
||||
slurp
|
||||
xdg-desktop-portal-hyprland
|
||||
];
|
||||
|
||||
|
||||
@@ -290,7 +291,7 @@ in {
|
||||
"center, title:^(terminal-file-picker)$"
|
||||
"size 80% 80%, title:^(terminal-file-picker)$"
|
||||
|
||||
"size 30% 30%, initialTitle:^(Select Calendar)$"
|
||||
# "size 30% 30%, initialTitle:^(Select Calendar)$"
|
||||
];
|
||||
|
||||
|
||||
@@ -425,6 +426,8 @@ in {
|
||||
# "SUPER, B, exec, bitwarden"
|
||||
"SUPER, N, togglesplit"
|
||||
# "SUPER, M, exec, /home/nx2/scripts/meme-full-screen/meme-full-screen.sh "
|
||||
''SUPER, M, exec, sh -c "hyprshade on $(find ${hyper.home}/.config/hypr/shaders -type f | sed -E 's-.*shaders/(.+)\.glsl-\1-g' | rofi -dmenu)"''
|
||||
"SUPER Shift, M, exec, hyprshade off"
|
||||
# "SUPER, comma, exec, /home/nx2/scripts/change-language.sh"
|
||||
"SUPER, ., exec, echo key x:Prior | dotool"
|
||||
"SUPER, -, exec, echo key x:Next | dotool"
|
||||
|
||||
Reference in New Issue
Block a user