significantly more sane design

This commit is contained in:
Aidan Hahn 2019-07-15 22:37:09 -07:00
parent fbf758efe4
commit 1360406d5a
No known key found for this signature in database
GPG key ID: 327711E983899316
5 changed files with 28 additions and 23 deletions

1
.#README.md Symbolic link
View file

@ -0,0 +1 @@
ink@Magellan.6427:1563239860

View file

@ -5,20 +5,4 @@ All notable changes to this project will be documented in this file. This change
### Changed
- Add a new arity to `make-widget-async` to provide a different widget shape.
## [0.1.1] - 2019-07-06
### Changed
- Documentation on how to make the widgets.
### Removed
- `make-widget-sync` - we're all async, all the time.
### Fixed
- Fixed widget maker to keep working when daylight savings switches over.
## 0.1.0 - 2019-07-06
### Added
- Files from the new template.
- Widget maker public API - `make-widget-sync`.
[Unreleased]: https://github.com/your-name/whisper/compare/0.1.1...HEAD
[0.1.1]: https://github.com/your-name/whisper/compare/0.1.0...0.1.1
[Unreleased]: https://git.aidanis.online/aidan/whisper/compare/HEAD

View file

@ -3,13 +3,13 @@
(:use [whisper.ui]
[whisper.signald]))
;; SEESAW GUI STUFF
(def mainWindow (frame :title "Signald Version Reader"))
(defn main-loop
"updates UI with data from Signald"
[content]
(update mainWindow content)
(recur (get-next-update)))
(defn -main
"packs and shows main window with signald version string"
[& args]
(println (config! (-> mainWindow pack! show!)
:content (reduce (fn [k v]
(apply str [k v]))
(get-next-update)))))
())

View file

@ -4,12 +4,14 @@
(org.newsclub.net.unix AFUNIXSocket AFUNIXSocketAddress)
(java.io File BufferedReader InputStreamReader)))
;; Signald global state vars
(def sigdSock (AFUNIXSocket/connectTo
(AFUNIXSocketAddress. (File. "/var/run/signald/signald.sock"))))
(def sigdRead (BufferedReader. (InputStreamReader.
(. sigdSock getInputStream))))
(def sigdWrite (. sigdSock getOutputStream))
;; Signald Functions
(defn get-next-update
"Retrieves and parses next line of incoming data from signald"
[]

18
src/whisper/ui.clj Normal file
View file

@ -0,0 +1,18 @@
(ns whisper.ui
"Whisper UI Module"
(:use [seesaw.core]))
;; UI Global State
(native!)
(def mainWindow (frame :title "Signald Version Reader"
:content " Loading... "
:width 250
:height 40))
;; UI Functions
(defn update
"Updates WINDOW to display additional content: CONTENT"
[window content]
(config! window :content
(concat (:content window) content))
window)