summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/notify-user.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/custom/notify-user.nix b/custom/notify-user.nix
index 58beebf7..ddf78db0 100644
--- a/custom/notify-user.nix
+++ b/custom/notify-user.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
14 import System.Process (spawnProcess, waitForProcess) 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, init)
18 import Data.Char (isSpace) 18 import Data.Char (isSpace)
19 19
20 import Control.Monad (forM_, void) 20 import Control.Monad (forM_, void)
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
25 main = do 25 main = do
26 envFiles <- glob "/home/${user}/.dbus/session-bus/*" 26 envFiles <- glob "/home/${user}/.dbus/session-bus/*"
27 forM_ envFiles $ \envFile -> do 27 forM_ envFiles $ \envFile -> do
28 sessionAddr <- tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile 28 sessionAddr <- unQuote . tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile
29 setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr 29 setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr
30 lines <- lines <$> getContents 30 lines <- lines <$> getContents
31 case lines of 31 case lines of
@@ -34,6 +34,9 @@ stdenv.mkDerivation {
34 Notify.display_ $ Notify.appName "notify-${user}" <> Notify.summary summary <> Notify.body contents 34 Notify.display_ $ Notify.appName "notify-${user}" <> Notify.summary summary <> Notify.body contents
35 where 35 where
36 trim = dropWhileEnd isSpace . dropWhile isSpace 36 trim = dropWhileEnd isSpace . dropWhile isSpace
37 unQuote ('\'':xs) = init xs
38 unQuote ('"':xs) = init xs
39 unQuote xs = xs
37 ''; }; 40 ''; };
38 phases = [ "buildPhase" "installPhase" ]; 41 phases = [ "buildPhase" "installPhase" ];
39 buildPhase = '' 42 buildPhase = ''