personal-gui,thinkpad-nixos: Introduce khal

This commit is contained in:
traxys 2024-03-26 18:23:11 +01:00
parent 4a27a08cee
commit 6f20e7f76a
4 changed files with 106 additions and 36 deletions

View file

@ -319,43 +319,68 @@ in {
};
};
accounts.email = {
accounts.work = rec {
address = "quentin.boyer@***REMOVED***";
imap = {
host = "localhost";
port = 1143;
tls.enable = false;
};
mbsync = {
enable = true;
create = "maildir";
subFolders = "Verbatim";
extraConfig.account = {
AuthMechs = "LOGIN";
Timeout = 60;
};
};
passwordCommand = "echo foobar";
notmuch.enable = true;
msmtp = {
enable = true;
extraConfig.auth = "plain";
};
primary = true;
realName = "Quentin Boyer";
userName = address;
smtp = {
host = "localhost";
port = 1025;
tls.enable = false;
};
services.vdirsyncer.enable = true;
programs.vdirsyncer.enable = true;
programs.khal.enable = true;
aerc = {
enable = true;
extraAccounts = {
check-mail-cmd = "notmuch new";
check-mail-timeout = "60s";
programs.zsh.shellAliases = {
"khal-today" = "khal list today today -f '{start-time}-{end-time}: {title}'";
};
accounts = {
calendar = {
basePath = ".calendar";
accounts.work = {
primary = true;
remote = {
url = "http://localhost:1080/users/${config.workAddr}/calendar/";
type = "caldav";
userName = "${config.workAddr}";
passwordCommand = ["echo" "foobar"];
};
khal.enable = true;
vdirsyncer.enable = true;
};
};
email = {
accounts.work = rec {
address = "quentin.boyer@***REMOVED***";
imap = {
host = "localhost";
port = 1143;
tls.enable = false;
};
mbsync = {
enable = true;
create = "maildir";
subFolders = "Verbatim";
extraConfig.account = {
AuthMechs = "LOGIN";
Timeout = 60;
};
};
passwordCommand = "echo foobar";
notmuch.enable = true;
msmtp = {
enable = true;
extraConfig.auth = "plain";
};
primary = true;
realName = "Quentin Boyer";
userName = address;
smtp = {
host = "localhost";
port = 1025;
tls.enable = false;
};
aerc = {
enable = true;
extraAccounts = {
check-mail-cmd = "notmuch new";
check-mail-timeout = "60s";
};
};
};
};

View file

@ -80,6 +80,16 @@ in {
is = "<span font='20' rise='-3000' line_height='0.7'>";
ie = "</span>";
in {
"custom/khal" = {
format = "{}";
tooltip = true;
interval = 300;
format-icons = {
default = "";
};
exec = "${lib.getExe pkgs.python3} ${./waybar-khal.py}";
return-type = "json";
};
"sway/workspaces" = {
persistent_workspaces = {
"" = [];

29
personal-gui/wm/waybar-khal.py Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env python
import json
import subprocess
from html import escape
data = {}
output = subprocess.check_output(
'khal list now 7days --format "{start-end-time-style} {title}"', shell=True
).decode("utf-8")
lines = output.split("\n")
new_lines = []
for line in lines:
line = escape(line)
if len(line) and line[0].isalpha():
line = "\n<b>" + line + "</b>"
new_lines.append(line)
output = "\n".join(new_lines).strip()
if "Today" in output:
data["text"] = "" + output.split("\n")[1]
else:
data["text"] = ""
data["tooltip"] = output
print(json.dumps(data))

View file

@ -139,6 +139,12 @@ label:focus {
color: #000000;
}
#custom-khal {
padding-bottom: 0;
border-bottom: 3px solid #209050;
border-top: 2px solid transparent;
}
#memory {
background-color: #9b59b6;
}