Add Code mode
This commit is contained in:
parent
d6ee93d907
commit
d05ef18a05
3 changed files with 12 additions and 4 deletions
|
@ -102,6 +102,12 @@ let
|
||||||
(blockServer restrictedPages)
|
(blockServer restrictedPages)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
code = makeConfig name (
|
||||||
|
all ++ orgaExtra ++ [
|
||||||
|
./roles/chat.nix
|
||||||
|
(blockServer newsPages)
|
||||||
|
]
|
||||||
|
);
|
||||||
leisure = makeConfig name (
|
leisure = makeConfig name (
|
||||||
all ++ orgaExtra ++ [
|
all ++ orgaExtra ++ [
|
||||||
./roles/games.nix
|
./roles/games.nix
|
||||||
|
|
|
@ -11,7 +11,7 @@ let
|
||||||
"System.Directory"
|
"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
|
modes = enumFrom Klausur
|
||||||
getMode = do
|
getMode = do
|
||||||
name <- Text.strip <$> readFileText "/home/maralorn/.mode" `onException` say "File /home/maralorn/.mode not found."
|
name <- Text.strip <$> readFileText "/home/maralorn/.mode" `onException` say "File /home/maralorn/.mode not found."
|
||||||
|
@ -29,13 +29,15 @@ let
|
||||||
mode <- getMode
|
mode <- getMode
|
||||||
unread <- notmuch "count" "folder:hera/Inbox" "tag:unread" |> captureTrim
|
unread <- notmuch "count" "folder:hera/Inbox" "tag:unread" |> captureTrim
|
||||||
inbox <- notmuch "count" "folder:hera/Inbox" |> captureTrim
|
inbox <- notmuch "count" "folder:hera/Inbox" |> captureTrim
|
||||||
|
codeMails <- notmuch "count" "folder:hera/Code" |> captureTrim
|
||||||
dirs <- listDirectory "/home/maralorn/git"
|
dirs <- listDirectory "/home/maralorn/git"
|
||||||
dirty <- fmap toText <$> filterM (isDirty . ("/home/maralorn/git/"<>)) dirs
|
dirty <- fmap toText <$> filterM (isDirty . ("/home/maralorn/git/"<>)) dirs
|
||||||
unpushed <- fmap toText <$> filterM (isUnpushed . ("/home/maralorn/git/"<>)) dirs
|
unpushed <- fmap toText <$> filterM (isUnpushed . ("/home/maralorn/git/"<>)) dirs
|
||||||
say . Text.intercalate " " $
|
say . Text.intercalate " " $
|
||||||
[playing, show mode] ++
|
[playing, show mode] ++
|
||||||
memptyIfFalse ((unread /= "0") && mode >= Orga) (one [i|Unread: #{unread}|]) ++
|
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 unpushed /= 0) (one [i|Unpushed: #{Text.intercalate " " unpushed}|]) ++
|
||||||
memptyIfFalse (length dirty /= 0) (one [i|Dirty: #{Text.intercalate " " dirty}|])
|
memptyIfFalse (length dirty /= 0) (one [i|Dirty: #{Text.intercalate " " dirty}|])
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -6,7 +6,7 @@ let
|
||||||
alternates = pkgs.privateValue [ ] "mail/alternates";
|
alternates = pkgs.privateValue [ ] "mail/alternates";
|
||||||
lists = pkgs.privateValue { sortLists = [ ]; stupidLists = [ ]; notifications = [ ]; } "mail/filters";
|
lists = pkgs.privateValue { sortLists = [ ]; stupidLists = [ ]; notifications = [ ]; } "mail/filters";
|
||||||
quick-sync = pkgs.writeShellScript "quick-mail-sync" ''
|
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
|
${pkgs.notmuch}/bin/notmuch new
|
||||||
'';
|
'';
|
||||||
maildir = config.accounts.email.maildirBasePath;
|
maildir = config.accounts.email.maildirBasePath;
|
||||||
|
@ -145,7 +145,7 @@ in
|
||||||
exports.username = "${account.userName}";
|
exports.username = "${account.userName}";
|
||||||
exports.password = getStdout("${toString account.passwordCommand}");
|
exports.password = getStdout("${toString account.passwordCommand}");
|
||||||
exports.onNotify = "${quick-sync}"
|
exports.onNotify = "${quick-sync}"
|
||||||
exports.boxes = [ "Inbox" ];
|
exports.boxes = [ "Inbox" "Code" ];
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue