tidy the example layout
This commit is contained in:
parent
8d8c65e5b3
commit
3d5d1078c2
@ -1,4 +1,5 @@
|
|||||||
(local {: bar : indicator : stylesheet : run} (require :blinkenlicht))
|
(local {: bar : indicator : stylesheet : run} (require :blinkenlicht))
|
||||||
|
|
||||||
(local {: view} (require :fennel))
|
(local {: view} (require :fennel))
|
||||||
|
|
||||||
(local iostream (require :iostream))
|
(local iostream (require :iostream))
|
||||||
@ -65,7 +66,6 @@
|
|||||||
(indicator {
|
(indicator {
|
||||||
:wait-for {
|
:wait-for {
|
||||||
:input [input]
|
:input [input]
|
||||||
:interval (* 4 1000)
|
|
||||||
}
|
}
|
||||||
:refresh
|
:refresh
|
||||||
#(let [status (uplink:status)]
|
#(let [status (uplink:status)]
|
||||||
@ -73,60 +73,32 @@
|
|||||||
{:text (.. (or status.ssid status.name "?")
|
{:text (.. (or status.ssid status.name "?")
|
||||||
" "
|
" "
|
||||||
(if status.quality
|
(if status.quality
|
||||||
|
;; this is in dBm, allegedly.
|
||||||
|
;; typical values
|
||||||
|
;; -20 (good) -> -100 (awful)
|
||||||
(tostring (+ status.quality 100))
|
(tostring (+ status.quality 100))
|
||||||
""))}
|
""))}
|
||||||
{:text "no internet"}
|
{:text "no internet"}
|
||||||
))
|
))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
(let [f (iostream.open "/tmp/statuspipe" :r)]
|
|
||||||
(indicator {
|
|
||||||
;; this is a guide to tell blinkenlicht when it might
|
|
||||||
;; be worth calling your `content` function. Your
|
|
||||||
;; function may be called at other times too
|
|
||||||
:wait-for { :input [f] }
|
|
||||||
|
|
||||||
;; the `content` function should not block, so e.g
|
|
||||||
;; don't read from files unless you know there's data
|
|
||||||
;; available. it returns a hash
|
|
||||||
;; { :text "foo" } - render "foo" as a label
|
|
||||||
;; { :icon "face-sad" } - render icon from theme or pathname
|
|
||||||
;; { :classes ["foo" "bar"] - add CSS classes to widget
|
|
||||||
:refresh
|
|
||||||
#(let [l (f:read 1024)]
|
|
||||||
(if l
|
|
||||||
{:text l}))
|
|
||||||
}))
|
|
||||||
|
|
||||||
(indicator {
|
|
||||||
:wait-for { :interval 2000 }
|
|
||||||
:refresh
|
|
||||||
#{:icon (if (> (metric.loadavg) 2) "face-sad" "face-smile")}
|
|
||||||
})
|
|
||||||
|
|
||||||
(indicator {
|
(indicator {
|
||||||
:wait-for { :interval (* 1000 10) }
|
:wait-for { :interval (* 1000 10) }
|
||||||
:refresh
|
:refresh
|
||||||
#(let [{:power-supply-energy-full full
|
#(let [{:power-supply-capacity percent
|
||||||
:power-supply-energy-now now
|
|
||||||
:power-supply-status status} (metric.battery)
|
:power-supply-status status} (metric.battery)
|
||||||
percent (math.floor
|
icon-code (battery-icon-codepoint
|
||||||
(* 100
|
status (tonumber percent))]
|
||||||
(/ (tonumber now) (tonumber full))))
|
|
||||||
icon-code (battery-icon-codepoint status percent)]
|
|
||||||
{:text
|
{:text
|
||||||
(string.format "%s %d%%" (utf8.char icon-code) percent)
|
(string.format "%s %d%%" (utf8.char icon-code) percent)
|
||||||
:classes ["yellow"]
|
:classes ["yellow"]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
(indicator {
|
|
||||||
:wait-for { :interval 1000 }
|
|
||||||
:refresh #{:text (os.date "%H:%M:%S")}
|
|
||||||
})
|
|
||||||
(indicator {
|
(indicator {
|
||||||
:wait-for { :interval 4000 }
|
:wait-for { :interval 4000 }
|
||||||
:refresh #{:text (os.date "%H:%M:%S")}
|
:refresh #{:text (os.date "%H:%M")}
|
||||||
})
|
})
|
||||||
|
|
||||||
]})
|
]})
|
||||||
|
|
||||||
(run)
|
(run)
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
.indicator {
|
.indicator {
|
||||||
color: #eef;
|
color: #eef;
|
||||||
background-color: #000;
|
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.indicator * {
|
.indicator * {
|
||||||
margin: 5px 8px;
|
margin: 5px 0px 5px 12px;
|
||||||
padding: 5px 5px;
|
|
||||||
background-color: #225;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bar {
|
.bar {
|
||||||
background-color: #000;
|
background-color: #200;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user