Improve Calendar handling
This commit is contained in:
parent
433cb7f560
commit
fde1205c8b
|
@ -57,7 +57,7 @@ let
|
||||||
let
|
let
|
||||||
all = extra ++ on-my-machines ++ [
|
all = extra ++ on-my-machines ++ [
|
||||||
(import ./roles/firefox.nix "http://localhost:7000")
|
(import ./roles/firefox.nix "http://localhost:7000")
|
||||||
(makeAutostart "kassandra2")
|
(makeAutostart "planning")
|
||||||
(makeAutostart "unlock-ssh")
|
(makeAutostart "unlock-ssh")
|
||||||
./roles/beets.nix
|
./roles/beets.nix
|
||||||
./roles/daily-driver-programs.nix
|
./roles/daily-driver-programs.nix
|
||||||
|
|
|
@ -5,7 +5,7 @@ let
|
||||||
statusScript = pkgs.writeHaskellScript
|
statusScript = pkgs.writeHaskellScript
|
||||||
{
|
{
|
||||||
name = "status-script";
|
name = "status-script";
|
||||||
bins = [ pkgs.notmuch pkgs.coreutils pkgs.git pkgs.playerctl ];
|
bins = [ pkgs.notmuch pkgs.coreutils pkgs.git pkgs.playerctl pkgs.khal ];
|
||||||
imports = [
|
imports = [
|
||||||
"Control.Exception"
|
"Control.Exception"
|
||||||
"System.Directory"
|
"System.Directory"
|
||||||
|
@ -26,6 +26,7 @@ let
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
playing <- Text.intercalate " " . fmap decodeUtf8 . filter (/= "") <$> mapM tryCmd [playerctl "status", playerctl "metadata" "title", playerctl "metadata" "artist"]
|
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
|
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
|
||||||
|
@ -33,8 +34,8 @@ let
|
||||||
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] ++
|
[appointments,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 ((codeMails /= "0") && mode == Code) (one [i|Code: #{codeMails}|]) ++
|
||||||
|
|
|
@ -5,8 +5,8 @@ in
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
Orga = [
|
Orga = [
|
||||||
{ Kassandra = fork "kassandra2"; }
|
{ Kassandra = fork "planning"; }
|
||||||
{ Kalendar = "ikhal -d Serien"; }
|
{ Kalendar = "calendar"; }
|
||||||
{ Habitica = fork "firefox https://habitica.com"; }
|
{ Habitica = fork "firefox https://habitica.com"; }
|
||||||
{ Tasks = "tasksh"; }
|
{ Tasks = "tasksh"; }
|
||||||
{ Meditate = "meditate"; }
|
{ Meditate = "meditate"; }
|
||||||
|
|
|
@ -1,10 +1,45 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
calendars = pkgs.privateValue [ ] "calendars";
|
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
|
in
|
||||||
{
|
{
|
||||||
home.packages = [ pkgs.khal ];
|
home.packages = [ pkgs.khal createPlans planning ui ];
|
||||||
xdg.configFile."khal/config".text = ''
|
xdg.configFile."khal/config".text = ''
|
||||||
|
[locale]
|
||||||
|
dateformat = "%Y-%m-%d"
|
||||||
|
datetimeformat = "%Y-%m-%d %H:%M"
|
||||||
|
timeformat = "%H:%M"
|
||||||
[default]
|
[default]
|
||||||
default_calendar = Standard
|
default_calendar = Standard
|
||||||
[calendars]
|
[calendars]
|
||||||
|
|
|
@ -64,6 +64,7 @@ in
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
{-# LANGUAGE NoImplicitPrelude #-}
|
||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
{-# LANGUAGE PartialTypeSignatures #-}
|
||||||
|
{-# LANGUAGE BlockArguments #-}
|
||||||
|
|
||||||
import Shh
|
import Shh
|
||||||
import Relude
|
import Relude
|
||||||
|
|
2
private
2
private
|
@ -1 +1 @@
|
||||||
Subproject commit 5913f4e0157f966ffd09494b9fbe72149e34e610
|
Subproject commit 4d24f7ecc3d92f8cca743da3709d594fb0e84544
|
Loading…
Reference in a new issue