Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
trivial change
Browse files Browse the repository at this point in the history
  • Loading branch information
goropikari committed Feb 25, 2018
1 parent 428d0c5 commit 2842531
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Notifier
[![Build Status](https://travis-ci.org/goropikari/Notifier.jl.svg?branch=master)](https://travis-ci.org/goropikari/Notifier.jl)
[![codecov.io](http://codecov.io/github/goropikari/Notifier.jl/coverage.svg?branch=master)](http://codecov.io/github/goropikari/Notifier.jl?branch=master)

This package is notification tools for Julialang.

Expand All @@ -11,15 +12,15 @@ Pkg.clone("git://github.com/goropikari/Notifier.jl.git")
# Linux OS
## Setup
Before using Notifier.jl, you need to install following softwares in your Linux system.
- "libnotify" for a desktop notification
- "mail" for an e-mail notification
- "aplay" (Advanced Linux Sound Architecture) for a sound notification
- `libnotify` for a desktop notification
- `mail` for an e-mail notification
- `aplay` (Advanced Linux Sound Architecture) for a sound notification

```bash
sudo apt install libnotify-bin alsa-utils mailutils heirloom-mailx bsd-mailx
$ sudo apt install libnotify-bin alsa-utils mailutils heirloom-mailx bsd-mailx
```

This package uses "mail" linux command to notify by e-mail. Thus you need some settings in advance.
This package uses `mail` linux command to notify by e-mail. Thus you need some settings in advance.
If following command works correctly, you don't need further setting.
```bash
$ echo test | mail -s foo [email protected]
Expand Down
29 changes: 16 additions & 13 deletions src/linux.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Base.notify
export notify, register_email, email, alarm
export notify, alarm, register_email, email

@doc """
---
notify(message::AbstractString; title::AbstractString, sound, time)
Notifier.notify(message::AbstractString; title::AbstractString, sound, time)
defalut parameter\n
title = "Julia"\n
sound = false\n
time = 4 # display time (seconds)
""" notify
function notify(message::AbstractString;
title="Julia",
sound::Union{Bool, AbstractString}=false,
time::Real=4)
title="Julia",
sound::Union{Bool, AbstractString}=false,
time::Real=4)
if sound == true || typeof(sound) <: AbstractString
if sound == true
@async run(`aplay -q $(joinpath(@__DIR__, "default.wav"))`)
Expand All @@ -26,6 +26,17 @@ function notify(message::AbstractString;
return
end

@doc """
alarm(;sound::AbstractString)
notify by sound
if you choose a specific sound WAV file, you can use it instead of the defalut sound.
""" alarm
function alarm(;sound::AbstractString=joinpath(@__DIR__, "default.wav"))
@async run(`aplay -q $sound`)
return nothing
end

@doc """
register_email()
Expand Down Expand Up @@ -56,14 +67,6 @@ function register_email()
println("If you want to change the address, modify $(abspath((joinpath(emaildir, "address.txt")))) directly or run register_email() again.")
end

@doc """
alarm(;sound::AbstractString)
notify by sound
if you choose a specific sound WAV file, you can use it instead of the defalut sound.
""" alarm
alarm(;sound::AbstractString=joinpath(@__DIR__, "default.wav")) = @async run(`aplay -q $sound`)

@doc """
email(message; subject, To)
Expand Down

0 comments on commit 2842531

Please sign in to comment.