Compare commits
4 Commits
809ce39ad3
...
5fafc9e8a3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fafc9e8a3 | ||
|
|
78fb91c311 | ||
|
|
bf67e7d396 | ||
|
|
89428b966b |
@@ -27,15 +27,15 @@
|
|||||||
},
|
},
|
||||||
"NxNORTH": {
|
"NxNORTH": {
|
||||||
"base": {
|
"base": {
|
||||||
"foreground": "#e7ccfe",
|
"foreground": "#e5e5e5",
|
||||||
"background": "#0d0019"
|
"background": "#0c0c0c"
|
||||||
},
|
},
|
||||||
"to_alter": {
|
"to_alter": {
|
||||||
"accent": "#9f35fc",
|
"accent": "#999999",
|
||||||
"secondary": "#324cff",
|
"secondary": "#dddddd",
|
||||||
"tertiary": "#4a62e7",
|
"tertiary": "#999999",
|
||||||
"special": "#91fc34",
|
"special": "#999999",
|
||||||
"weird": "#fc344f"
|
"weird": "#999999"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"NxDCS": {
|
"NxDCS": {
|
||||||
|
|||||||
@@ -7,10 +7,9 @@
|
|||||||
libraries = with pkgs.python3Packages; [ caldav ics pytz ];
|
libraries = with pkgs.python3Packages; [ caldav ics pytz ];
|
||||||
flakeIgnore = [ "E302" "E305" "E501" "E261" ];
|
flakeIgnore = [ "E302" "E305" "E501" "E261" ];
|
||||||
} /* python */ ''
|
} /* python */ ''
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
from caldav import DAVClient
|
from caldav import DAVClient
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone, timedelta
|
||||||
from ics import Calendar
|
from ics import Calendar
|
||||||
from pytz import UTC
|
from pytz import UTC
|
||||||
|
|
||||||
@@ -33,13 +32,15 @@ def datetime_parser(dct):
|
|||||||
return dct
|
return dct
|
||||||
|
|
||||||
def load_cache(cache_file):
|
def load_cache(cache_file):
|
||||||
if os.path.exists(cache_file):
|
try:
|
||||||
with open(cache_file, "r") as file:
|
with open(cache_file, "r") as file:
|
||||||
return json.load(file, object_hook=datetime_parser)
|
return json.load(file, object_hook=datetime_parser)
|
||||||
return None
|
except (json.JSONDecodeError, FileNotFoundError):
|
||||||
|
return None
|
||||||
|
|
||||||
def save_cache(cache_file, data):
|
def save_cache(cache_file, data):
|
||||||
with open(cache_file, "w") as file:
|
with open(cache_file, "w") as file:
|
||||||
|
data['last_checked'] = datetime.now(timezone.utc)
|
||||||
json.dump(data, file, default=datetime_converter, indent=4)
|
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()
|
event_end = event_dict['event_end'].timestamp()
|
||||||
return not (now <= event_end)
|
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__":
|
if __name__ == "__main__":
|
||||||
password_file = "${config.sops.secrets."nx2site/radicale/password".path}" # Path to password file
|
password_file = "${config.sops.secrets."nx2site/radicale/password".path}" # Path to password file
|
||||||
cache_file = "/tmp/caldav_event_cache.json" # Path to cache 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)
|
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)
|
event_dict = get_ongoing_or_next_event(url, username, password)
|
||||||
save_cache(cache_file, event_dict)
|
save_cache(cache_file, event_dict)
|
||||||
|
|
||||||
|
|||||||
@@ -226,10 +226,19 @@
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "markdown";
|
name = "markdown";
|
||||||
language-servers = [ "language-tool" "marksman" ];
|
language-servers = [ "marksman" ];
|
||||||
file-types = [ "md" "MD" ];
|
file-types = [ "md" "MD" ];
|
||||||
scope = "text.<name>";
|
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";
|
name = "python";
|
||||||
language-servers = [ "pyright" "ruff" ];
|
language-servers = [ "pyright" "ruff" ];
|
||||||
|
|||||||
@@ -19,15 +19,16 @@
|
|||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
xdg-desktop-portal-hyprland
|
grim
|
||||||
|
hyprcursor
|
||||||
|
hypridle
|
||||||
hyprland-protocols
|
hyprland-protocols
|
||||||
hyprlock
|
hyprlock
|
||||||
hypridle
|
|
||||||
hyprshot
|
|
||||||
hyprpicker
|
hyprpicker
|
||||||
hyprcursor
|
hyprshade
|
||||||
grim
|
hyprshot
|
||||||
slurp
|
slurp
|
||||||
|
xdg-desktop-portal-hyprland
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -290,7 +291,7 @@ in {
|
|||||||
"center, title:^(terminal-file-picker)$"
|
"center, title:^(terminal-file-picker)$"
|
||||||
"size 80% 80%, 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, B, exec, bitwarden"
|
||||||
"SUPER, N, togglesplit"
|
"SUPER, N, togglesplit"
|
||||||
# "SUPER, M, exec, /home/nx2/scripts/meme-full-screen/meme-full-screen.sh "
|
# "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, comma, exec, /home/nx2/scripts/change-language.sh"
|
||||||
"SUPER, ., exec, echo key x:Prior | dotool"
|
"SUPER, ., exec, echo key x:Prior | dotool"
|
||||||
"SUPER, -, exec, echo key x:Next | dotool"
|
"SUPER, -, exec, echo key x:Next | dotool"
|
||||||
|
|||||||
Reference in New Issue
Block a user