This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from goropikari/dev
increase functions and change the style of popup notification for windows
- Loading branch information
Showing
10 changed files
with
120 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Notifier | ||
[![Notifier](http://pkg.julialang.org/badges/Notifier_0.6.svg)](http://pkg.julialang.org/detail/Notifier) | ||
[![Notifier](http://pkg.julialang.org/badges/Notifier_0.7.svg)](http://pkg.julialang.org/detail/Notifier) | ||
[![Build Status](https://travis-ci.org/goropikari/Notifier.jl.svg?branch=master)](https://travis-ci.org/goropikari/Notifier.jl) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/cv0ilbo2f6d43xcp?svg=true)](https://ci.appveyor.com/project/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. | ||
|
@@ -12,36 +14,33 @@ notify("Task completed") | |
![Screenshot of a Notification](./docs/linuxpopup.png?raw=true) | ||
|
||
## Features: | ||
- Linux | ||
- Linux and macOS | ||
- desktop notification | ||
- sound notification | ||
- say notification (Read a given massage aloud) | ||
- email notification | ||
- macOS | ||
- desktop notification | ||
- sound notification | ||
- email notification | ||
- say notification (Read given massage aloud) | ||
- Windows (Experimental) | ||
- desktop notification | ||
- sound notification | ||
- say notification (Read a given massage aloud) | ||
|
||
## Installation | ||
```Julia | ||
Pkg.add("Notifier") | ||
``` | ||
|
||
# Linux OS | ||
## Setup | ||
## Setup for Linux user | ||
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 | ||
- `espeak` for reading a given massage aloud | ||
|
||
```bash | ||
$ sudo apt install libnotify-bin alsa-utils mailutils heirloom-mailx bsd-mailx | ||
$ sudo apt install libnotify-bin alsa-utils espeak mailutils heirloom-mailx bsd-mailx | ||
``` | ||
|
||
This package uses `mail` command to notify by e-mail. Thus you need some settings in advance. | ||
This package uses `mail` command to notify by e-mail. You may need some settings in advance. | ||
If following command works correctly, you don't need further setting. | ||
```bash | ||
$ echo test | mail -s foo [email protected] | ||
|
@@ -56,64 +55,23 @@ notify("Task completed") | |
# You can change the title by title option. | ||
notify("Task completed", title="foofoo") | ||
notify("Task completed", sound=true) # with sound | ||
notify("Task completed", sound="foo.wav") # specify a sound file | ||
alarm() # only sound. You can specify a sound file, alarm(sound="foo.wav") | ||
notify("Task completed", sound="foo.wav") # Specify a sound file (for Linux and Windows) | ||
``` | ||
Linux | ||
![Screenshot of a Notification](./docs/linuxpopup.png?raw=true) | ||
|
||
### e-mail notification | ||
```Julia | ||
email("message", To="[email protected]") # default subject is set by date. | ||
email("message", subject="result", To="[email protected]") | ||
``` | ||
|
||
|
||
If you use "email" function frequently, I recommend you to register your email address by "register_email" function. | ||
```Julia | ||
julia> register_email() | ||
Type your desired recipient e-mail address to receive a notification. | ||
e-mail: foo@example.com | ||
|
||
Recipient e-mail address is saved at /path/to/.julia/v0.6/Notifier/email/address.txt. | ||
If you want to change the address, modify /path/to/.julia/v0.6/Notifier/email/address.txt directly or run register_email() again | ||
``` | ||
|
||
After you registered, you don't need to specify e-mail address. | ||
```Julia | ||
email("message") | ||
``` | ||
macOS | ||
![Screenshot of a Notification](./docs/macpopup.png?raw=true) | ||
|
||
Windows | ||
![Screenshot of a Notification](./docs/winpopup.png?raw=true) | ||
|
||
# macOS | ||
## Usage | ||
### popup notification | ||
### sound and say notification | ||
```julia | ||
using Notifier | ||
notify("Task completed") | ||
notify("Change title", title="foofoo") | ||
notify("Notification with sound", sound=true) | ||
alarm() # only sound. You can specify a sound file, alarm(sound="foo.wav") | ||
say("Finish calculation!") # Read aloud | ||
``` | ||
|
||
![Screenshot of a Notification](./docs/macpopup.png?raw=true) | ||
|
||
Other supported parameters include `group` and `subtitle`. | ||
|
||
You can also remove notifications. However, this does not seem to work reliably. | ||
|
||
```julia | ||
Notifier.remove() # removes all notifications | ||
``` | ||
|
||
To remove specific notifications, you need to specify a group identifier when calling `notify`. This identifier can then be passed to `remove()`. | ||
|
||
```julia | ||
notify("Notification A", group="group1") | ||
notify("Notification B", group="group2") | ||
|
||
Notifier.remove("group1") | ||
``` | ||
|
||
### e-mail notification | ||
```Julia | ||
|
@@ -122,7 +80,7 @@ email("message", subject="result", To="[email protected]") | |
``` | ||
|
||
|
||
If you use "email" function frequently, I recommend you to register your email address by "register_email" function. | ||
If you use `email` function frequently, I recommend you to register your email address by `register_email` function. | ||
```Julia | ||
julia> register_email() | ||
Type your desired recipient e-mail address to receive a notification. | ||
|
@@ -137,16 +95,5 @@ After you registered, you don't need to specify e-mail address. | |
email("message") | ||
``` | ||
|
||
# Windows (Experimental) | ||
## Usage | ||
```Julia | ||
using Notifier | ||
notify("calculation done") | ||
# defalut title is "Julia". | ||
# You can change the title by title option. | ||
notify("calculation done", title="foofoo") | ||
notify("calculation done", sound=true) # with sound | ||
notify("calculation done", sound="foo.wav") # specify a sound file | ||
alarm() # only sound. You can specify a sound file, alarm(sound="foo.wav") | ||
``` | ||
![Screenshot of a Notification](./docs/winpopup.png?raw=true) | ||
## Acknowledgement | ||
Inspired by [OSXNotifier.jl](https://github.com/jonasrauber/OSXNotifier.jl). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
environment: | ||
matrix: | ||
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" | ||
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" | ||
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" | ||
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" | ||
|
||
## uncomment the following lines to allow failures on nightly julia | ||
## (tests will run but not make your overall status red) | ||
matrix: | ||
allow_failures: | ||
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" | ||
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" | ||
|
||
branches: | ||
only: | ||
- master | ||
- /release-.*/ | ||
|
||
notifications: | ||
- provider: Email | ||
on_build_success: false | ||
on_build_failure: false | ||
on_build_status_changed: false | ||
|
||
install: | ||
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" | ||
# If there's a newer build queued for the same PR, cancel this one | ||
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` | ||
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` | ||
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` | ||
throw "There are newer queued builds for this pull request, failing early." } | ||
# Download most recent Julia Windows binary | ||
- ps: (new-object net.webclient).DownloadFile( | ||
$env:JULIA_URL, | ||
"C:\projects\julia-binary.exe") | ||
# Run installer silently, output to C:\projects\julia | ||
- C:\projects\julia-binary.exe /S /D=C:\projects\julia | ||
|
||
build_script: | ||
# Need to convert from shallow to complete for Pkg.clone to work | ||
- IF EXIST .git\shallow (git fetch --unshallow) | ||
- C:\projects\julia\bin\julia -e "versioninfo(); | ||
Pkg.clone(pwd(), \"Notifier\"); Pkg.build(\"Notifier\")" | ||
|
||
test_script: | ||
- C:\projects\julia\bin\julia -e "Pkg.test(\"Notifier\")" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,9 @@ end | |
catch | ||
false | ||
end | ||
@test try | ||
say("Hello") | ||
true | ||
catch | ||
false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,9 @@ end | |
catch | ||
false | ||
end | ||
@test try | ||
say("Hello world") | ||
true | ||
catch | ||
false | ||
end |