diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-10-02 16:27:19 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-10-02 16:27:19 +0200 |
commit | 57d7964d395dfb29c2ed4305e64b6907f2de90eb (patch) | |
tree | 25583187429e3edebeea938b33144d4f7fc117a0 | |
parent | 4197878eae358faa2c0db9b6e73b703f88b4c8e7 (diff) | |
download | nixos-57d7964d395dfb29c2ed4305e64b6907f2de90eb.tar nixos-57d7964d395dfb29c2ed4305e64b6907f2de90eb.tar.gz nixos-57d7964d395dfb29c2ed4305e64b6907f2de90eb.tar.bz2 nixos-57d7964d395dfb29c2ed4305e64b6907f2de90eb.tar.xz nixos-57d7964d395dfb29c2ed4305e64b6907f2de90eb.zip |
use libnotify directly
-rw-r--r-- | custom/notify-user.nix | 12 |
1 files changed, 8 insertions, 4 deletions
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 @@ | |||
1 | { stdenv, writeTextFile | 1 | { stdenv, writeTextFile |
2 | , ghcWithPackages | 2 | , ghcWithPackages |
3 | , user ? "gkleen" | 3 | , user ? "gkleen" |
4 | , libnotify | 4 | # , libnotify |
5 | }: | 5 | }: |
6 | 6 | ||
7 | stdenv.mkDerivation { | 7 | stdenv.mkDerivation { |
@@ -19,6 +19,8 @@ stdenv.mkDerivation { | |||
19 | 19 | ||
20 | import Control.Monad (forM_, void) | 20 | import Control.Monad (forM_, void) |
21 | 21 | ||
22 | import qualified Libnotify as Notify | ||
23 | |||
22 | main = do | 24 | main = do |
23 | envFiles <- glob "/home/${user}/.dbus/session-bus/*" | 25 | envFiles <- glob "/home/${user}/.dbus/session-bus/*" |
24 | forM_ envFiles $ \envFile -> do | 26 | forM_ envFiles $ \envFile -> do |
@@ -27,15 +29,17 @@ stdenv.mkDerivation { | |||
27 | lines <- lines <$> getContents | 29 | lines <- lines <$> getContents |
28 | case lines of | 30 | case lines of |
29 | [] -> exitWith ExitSuccess | 31 | [] -> exitWith ExitSuccess |
32 | # ((trim -> summary):(trim . unlines -> contents)) -> do | ||
33 | # ph <- spawnProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs | ||
34 | # void $ waitForProcess ph | ||
30 | ((trim -> summary):(trim . unlines -> contents)) -> do | 35 | ((trim -> summary):(trim . unlines -> contents)) -> do |
31 | ph <- spawnProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs | 36 | Notify.display_ $ Notify.appName "notify-${user}" <> Notify.summary summary <> Notify.body contents |
32 | void $ waitForProcess ph | ||
33 | where | 37 | where |
34 | trim = dropWhileEnd isSpace . dropWhile isSpace | 38 | trim = dropWhileEnd isSpace . dropWhile isSpace |
35 | ''; }; | 39 | ''; }; |
36 | phases = [ "buildPhase" "installPhase" ]; | 40 | phases = [ "buildPhase" "installPhase" ]; |
37 | buildPhase = '' | 41 | buildPhase = '' |
38 | ${ghcWithPackages (p: with p; [ Glob process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} | 42 | ${ghcWithPackages (p: with p; [ Glob process libnotify ])}/bin/ghc -odir . -hidir . $src -o notify-${user} |
39 | ''; | 43 | ''; |
40 | installPhase = '' | 44 | installPhase = '' |
41 | mkdir -p $out/bin | 45 | mkdir -p $out/bin |