Source

screentime-monitor / notify.ml

open Core.Std
open Async.Std

let spawn ~title ?sound ?execute message =
  Async_shell.run
    "terminal-notifier"
    ( [ "-message" ; message ]
      @ [ "-title"; title ]
      @ (match sound with
        | None -> []
        | Some sound ->
          [ "-sound"; (match sound with `Default -> "default" | `Path x -> x) ])
      @ (match execute with
        | None -> []
        | Some command -> [ "-execute";command ])
    )