From 57d7964d395dfb29c2ed4305e64b6907f2de90eb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 2 Oct 2016 16:27:19 +0200 Subject: use libnotify directly --- custom/notify-user.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'custom') diff --git a/custom/notify-user.nix b/custom/notify-user.nix index 917c2b7f..623c78bf 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix @@ -1,7 +1,7 @@ { stdenv, writeTextFile , ghcWithPackages , user ? "gkleen" -, libnotify +# , libnotify }: stdenv.mkDerivation { @@ -19,6 +19,8 @@ stdenv.mkDerivation { import Control.Monad (forM_, void) + import qualified Libnotify as Notify + main = do envFiles <- glob "/home/${user}/.dbus/session-bus/*" forM_ envFiles $ \envFile -> do @@ -27,15 +29,17 @@ stdenv.mkDerivation { lines <- lines <$> getContents case lines of [] -> exitWith ExitSuccess + # ((trim -> summary):(trim . unlines -> contents)) -> do + # ph <- spawnProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs + # void $ waitForProcess ph ((trim -> summary):(trim . unlines -> contents)) -> do - ph <- spawnProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs - void $ waitForProcess ph + Notify.display_ $ Notify.appName "notify-${user}" <> Notify.summary summary <> Notify.body contents where trim = dropWhileEnd isSpace . dropWhile isSpace ''; }; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' - ${ghcWithPackages (p: with p; [ Glob process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} + ${ghcWithPackages (p: with p; [ Glob process libnotify ])}/bin/ghc -odir . -hidir . $src -o notify-${user} ''; installPhase = '' mkdir -p $out/bin -- cgit v1.2.3