Skip to content

A Clojure library designed for your application to add desktop alert easily.

License

Notifications You must be signed in to change notification settings

sgr/desktop-alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

desktop-alert

A Clojure library designed for your application to add desktop alert easily.

Install

logutil is available in Clojars.org. Your leiningen project.clj:

Clojars Project

Usage

Please read API document.

Old style:

  (def frm (JFrame.))
  (def sz (Dimension. 240 60))
  (def duration 1000)
  (def content (doto (JPanel.) (.add (JLabel. "Alert!"))))
  
  (init-alert frm (.getWidth sz) (.getHeight sz) :rl-bt 1 200 (float 0.9) nil) ;; init alerter
  ;;(init-alert frm capacity (.getWidth sz) (.getHeight sz) :rl-bt 1 200 (float 0.9) nil) ;; fixed capacity queue

  (alert content duration) ;; display alert during 1000 milliseconds. content is a java.awt.Component or subclass. 

  (close-alert) ;; close alerter.

New style:

  (require '[clojure.core.async :as ca])
  (def frm (JFrame.))
  (def sz (Dimension. 240 60))
  (def duration 1000)
  (def content (doto (JPanel.) (.add (JLabel. "Alert!"))))
  
  (let [[ach ar] (init-alert frm (.getWidth sz) (.getHeight sz) :rl-bt 1 200 (float 0.9) nil)] ;; init alerter
    (ca/>!! ach {:cmd :alert :content content :duration duration})
    (ca/close! ach) ;; close the alerter control channel.
    (ca/<!! ar))    ;; wait the alerter go routine is finished.

License

Copyright (C) Shigeru Fujiwara All Rights Reserved.

Distributed under the Eclipse Public License, the same as Clojure.

About

A Clojure library designed for your application to add desktop alert easily.

Resources

License

Stars

Watchers

Forks

Packages

No packages published