Improve Calendar handling
This commit is contained in:
parent
433cb7f560
commit
fde1205c8b
|
@ -57,7 +57,7 @@ let
|
|||
let
|
||||
all = extra ++ on-my-machines ++ [
|
||||
(import ./roles/firefox.nix "http://localhost:7000")
|
||||
(makeAutostart "kassandra2")
|
||||
(makeAutostart "planning")
|
||||
(makeAutostart "unlock-ssh")
|
||||
./roles/beets.nix
|
||||
./roles/daily-driver-programs.nix
|
||||
|
|
|
@ -5,7 +5,7 @@ let
|
|||
statusScript = pkgs.writeHaskellScript
|
||||
{
|
||||
name = "status-script";
|
||||
bins = [ pkgs.notmuch pkgs.coreutils pkgs.git pkgs.playerctl ];
|
||||
bins = [ pkgs.notmuch pkgs.coreutils pkgs.git pkgs.playerctl pkgs.khal ];
|
||||
imports = [
|
||||
"Control.Exception"
|
||||
"System.Directory"
|
||||
|
@ -26,6 +26,7 @@ let
|
|||
|
||||
main = do
|
||||
playing <- Text.intercalate " " . fmap decodeUtf8 . filter (/= "") <$> mapM tryCmd [playerctl "status", playerctl "metadata" "title", playerctl "metadata" "artist"]
|
||||
appointments <- Text.intercalate "; ". lines . decodeUtf8 <$> (tryCmd $ khal ["list", "-a", "Standard", "-a", "Planung", "-a", "Uni", "-a", "Maltaire", "now", "2h", "-df", ""])
|
||||
mode <- getMode
|
||||
unread <- notmuch "count" "folder:hera/Inbox" "tag:unread" |> captureTrim
|
||||
inbox <- notmuch "count" "folder:hera/Inbox" |> captureTrim
|
||||
|
@ -33,8 +34,8 @@ let
|
|||
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] ++
|
||||
say . Text.intercalate " | " $
|
||||
[appointments,playing, show mode] ++
|
||||
memptyIfFalse ((unread /= "0") && mode >= Orga) (one [i|Unread: #{unread}|]) ++
|
||||
memptyIfFalse ((inbox /= "0") && mode == Leisure) (one [i|Inbox: #{inbox}|]) ++
|
||||
memptyIfFalse ((codeMails /= "0") && mode == Code) (one [i|Code: #{codeMails}|]) ++
|
||||
|
|
|
@ -5,8 +5,8 @@ in
|
|||
[
|
||||
{
|
||||
Orga = [
|
||||
{ Kassandra = fork "kassandra2"; }
|
||||
{ Kalendar = "ikhal -d Serien"; }
|
||||
{ Kassandra = fork "planning"; }
|
||||
{ Kalendar = "calendar"; }
|
||||
{ Habitica = fork "firefox https://habitica.com"; }
|
||||
{ Tasks = "tasksh"; }
|
||||
{ Meditate = "meditate"; }
|
||||
|
|
|
@ -1,10 +1,45 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
calendars = pkgs.privateValue [ ] "calendars";
|
||||
plans = pkgs.privateValue
|
||||
{
|
||||
"workDay" = "pass";
|
||||
"weekend" = "pass";
|
||||
}
|
||||
"plans";
|
||||
planning = pkgs.writeShellScriptBin "planning" ''
|
||||
create-plans; kassandra2
|
||||
'';
|
||||
ui = pkgs.writeShellScriptBin "calendar" ''
|
||||
create-plans; ikhal -d Serien
|
||||
'';
|
||||
createPlans = pkgs.writeHaskellScript
|
||||
{
|
||||
name = "create-plans";
|
||||
bins = [ pkgs.khal pkgs.vdirsyncer ];
|
||||
imports = [
|
||||
"Data.Time"
|
||||
];
|
||||
} ''
|
||||
main = do
|
||||
today <- localDay . zonedTimeToLocalTime <$> getZonedTime
|
||||
[0..7] & fmap (`addDays` today) & mapM_ \day -> do
|
||||
planned <- khal ["list", "-a", "Planung", show day, "06:00", "24h", "--notstarted"] |> captureTrim
|
||||
when (planned == "No events") $ do
|
||||
say $ "Creating events for " <> show day
|
||||
if (dayOfWeek day `elem` [Saturday, Sunday]) then do
|
||||
${plans.weekend}
|
||||
else do
|
||||
${plans.workDay}
|
||||
'';
|
||||
in
|
||||
{
|
||||
home.packages = [ pkgs.khal ];
|
||||
home.packages = [ pkgs.khal createPlans planning ui ];
|
||||
xdg.configFile."khal/config".text = ''
|
||||
[locale]
|
||||
dateformat = "%Y-%m-%d"
|
||||
datetimeformat = "%Y-%m-%d %H:%M"
|
||||
timeformat = "%H:%M"
|
||||
[default]
|
||||
default_calendar = Standard
|
||||
[calendars]
|
||||
|
|
|
@ -64,6 +64,7 @@ in
|
|||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE PartialTypeSignatures #-}
|
||||
{-# LANGUAGE BlockArguments #-}
|
||||
|
||||
import Shh
|
||||
import Relude
|
||||
|
|
2
private
2
private
|
@ -1 +1 @@
|
|||
Subproject commit 5913f4e0157f966ffd09494b9fbe72149e34e610
|
||||
Subproject commit 4d24f7ecc3d92f8cca743da3709d594fb0e84544
|
Loading…
Reference in a new issue