1
0
Fork 0

Add Code mode

This commit is contained in:
Malte Brandy 2021-11-18 15:38:40 +01:00
parent d6ee93d907
commit d05ef18a05
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
3 changed files with 12 additions and 4 deletions

View file

@ -102,6 +102,12 @@ let
(blockServer restrictedPages)
]
);
code = makeConfig name (
all ++ orgaExtra ++ [
./roles/chat.nix
(blockServer newsPages)
]
);
leisure = makeConfig name (
all ++ orgaExtra ++ [
./roles/games.nix

View file

@ -11,7 +11,7 @@ let
"System.Directory"
];
} ''
data Mode = Klausur | Orga | Communication | Leisure | Unrestricted deriving (Eq, Ord, Show, Enum, Bounded)
data Mode = Klausur | Orga | Communication | Code | Leisure | Unrestricted deriving (Eq, Ord, Show, Enum, Bounded)
modes = enumFrom Klausur
getMode = do
name <- Text.strip <$> readFileText "/home/maralorn/.mode" `onException` say "File /home/maralorn/.mode not found."
@ -29,13 +29,15 @@ let
mode <- getMode
unread <- notmuch "count" "folder:hera/Inbox" "tag:unread" |> captureTrim
inbox <- notmuch "count" "folder:hera/Inbox" |> captureTrim
codeMails <- notmuch "count" "folder:hera/Code" |> captureTrim
dirs <- listDirectory "/home/maralorn/git"
dirty <- fmap toText <$> filterM (isDirty . ("/home/maralorn/git/"<>)) dirs
unpushed <- fmap toText <$> filterM (isUnpushed . ("/home/maralorn/git/"<>)) dirs
say . Text.intercalate " " $
[playing, show mode] ++
memptyIfFalse ((unread /= "0") && mode >= Orga) (one [i|Unread: #{unread}|]) ++
memptyIfFalse ((inbox /= "0") && mode >= Leisure) (one [i|Inbox: #{inbox}|]) ++
memptyIfFalse ((inbox /= "0") && mode == Leisure) (one [i|Inbox: #{inbox}|]) ++
memptyIfFalse ((codeMails /= "0") && mode == Code) (one [i|Code: #{codeMails}|]) ++
memptyIfFalse (length unpushed /= 0) (one [i|Unpushed: #{Text.intercalate " " unpushed}|]) ++
memptyIfFalse (length dirty /= 0) (one [i|Dirty: #{Text.intercalate " " dirty}|])
'';

View file

@ -6,7 +6,7 @@ let
alternates = pkgs.privateValue [ ] "mail/alternates";
lists = pkgs.privateValue { sortLists = [ ]; stupidLists = [ ]; notifications = [ ]; } "mail/filters";
quick-sync = pkgs.writeShellScript "quick-mail-sync" ''
${pkgs.isync}/bin/mbsync hera:INBOX
${pkgs.isync}/bin/mbsync hera:INBOX,Code
${pkgs.notmuch}/bin/notmuch new
'';
maildir = config.accounts.email.maildirBasePath;
@ -145,7 +145,7 @@ in
exports.username = "${account.userName}";
exports.password = getStdout("${toString account.passwordCommand}");
exports.onNotify = "${quick-sync}"
exports.boxes = [ "Inbox" ];
exports.boxes = [ "Inbox" "Code" ];
'';
in
{