diff options
| author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-22 14:18:25 +0200 |
|---|---|---|
| committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-22 14:18:25 +0200 |
| commit | a8d3dc60312400f2fc238d1d14224e3408b553b0 (patch) | |
| tree | 547eb23df79219ccaa2efa670305a35953dd728d | |
| parent | 9c06d7b02d202508158c1490ed54b9957dd2a826 (diff) | |
| download | nixos-a8d3dc60312400f2fc238d1d14224e3408b553b0.tar nixos-a8d3dc60312400f2fc238d1d14224e3408b553b0.tar.gz nixos-a8d3dc60312400f2fc238d1d14224e3408b553b0.tar.bz2 nixos-a8d3dc60312400f2fc238d1d14224e3408b553b0.tar.xz nixos-a8d3dc60312400f2fc238d1d14224e3408b553b0.zip | |
drop exit status
| -rw-r--r-- | custom/notify-user.nix | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/custom/notify-user.nix b/custom/notify-user.nix index 6bfd8593..917c2b7f 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix | |||
| @@ -11,13 +11,13 @@ stdenv.mkDerivation { | |||
| 11 | 11 | ||
| 12 | import System.FilePath.Glob (glob) | 12 | import System.FilePath.Glob (glob) |
| 13 | import System.Environment (setEnv, getArgs) | 13 | import System.Environment (setEnv, getArgs) |
| 14 | import System.Process (callProcess) | 14 | import System.Process (spawnProcess, waitForProcess) |
| 15 | import System.Exit (exitWith, ExitCode(..)) | 15 | import System.Exit (exitWith, ExitCode(..)) |
| 16 | 16 | ||
| 17 | import Data.List (isPrefixOf, dropWhile, dropWhileEnd) | 17 | import Data.List (isPrefixOf, dropWhile, dropWhileEnd) |
| 18 | import Data.Char (isSpace) | 18 | import Data.Char (isSpace) |
| 19 | 19 | ||
| 20 | import Control.Monad (forM_) | 20 | import Control.Monad (forM_, void) |
| 21 | 21 | ||
| 22 | main = do | 22 | main = do |
| 23 | envFiles <- glob "/home/${user}/.dbus/session-bus/*" | 23 | envFiles <- glob "/home/${user}/.dbus/session-bus/*" |
| @@ -27,7 +27,9 @@ stdenv.mkDerivation { | |||
| 27 | lines <- lines <$> getContents | 27 | lines <- lines <$> getContents |
| 28 | case lines of | 28 | case lines of |
| 29 | [] -> exitWith ExitSuccess | 29 | [] -> exitWith ExitSuccess |
| 30 | ((trim -> summary):(trim . unlines -> contents)) -> callProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs | 30 | ((trim -> summary):(trim . unlines -> contents)) -> do |
| 31 | ph <- spawnProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs | ||
| 32 | void $ waitForProcess ph | ||
| 31 | where | 33 | where |
| 32 | trim = dropWhileEnd isSpace . dropWhile isSpace | 34 | trim = dropWhileEnd isSpace . dropWhile isSpace |
| 33 | ''; }; | 35 | ''; }; |
