diff options
-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 | ''; }; |