Packages

Notify_ex is just a simple wrapper around 'notify-send' for Unix systems.

Current section

Files

Jump to
notify_ex lib notify notification.ex
Raw

lib/notify/notification.ex

defmodule Notify.Notification do
@moduledoc false
def send(name, urgency, time, icon, message) do
System.cmd(notify(), ["--app-name=Notify_ex",
"--icon=#{get_icon(icon)}",
name,
"--expire-time=#{time}",
"--urgency=#{urgency}",
message])
end
defp notify do
System.find_executable("notify-send")
end
defp get_icon(status) do
case status do
"" ->
Application.app_dir(:notify_ex, "priv/bell.png")
_ ->
Path.absname(status)
end
end
end
# Notify.send("Test", "Desc", "low", 3000, "icon.png")