add icons for battery status
This commit is contained in:
parent
48ffaa7695
commit
8abdffdbec
@ -16,6 +16,17 @@
|
||||
(tset fields (: (name:gsub "_" "-") :lower) value)))
|
||||
fields))))
|
||||
|
||||
(fn battery-icon-codepoint [status percent]
|
||||
(if ; (= status "Charging") 0xf376 ; glyph not present in font-awesome free
|
||||
(> percent 90) 0xf240 ;full
|
||||
(> percent 60) 0xf241 ;3/4
|
||||
(> percent 40) 0xf242 ;1/2
|
||||
(> percent 15) 0xf243 ;1/4
|
||||
(>= percent 0) 0xf244 ;empty
|
||||
; 0xf377 ; glyph not present in font-awesome free
|
||||
))
|
||||
|
||||
|
||||
(fn spawn []
|
||||
true)
|
||||
|
||||
@ -37,15 +48,11 @@
|
||||
(indicator {
|
||||
:interval (* 10 1000)
|
||||
:text #(let [{:power-supply-energy-full full
|
||||
:power-supply-energy-now now}
|
||||
(battery-status)]
|
||||
(string.format "BAT %d%%"
|
||||
(math.floor (* 100 (/ (tonumber now) (tonumber full))))))
|
||||
})
|
||||
(indicator {
|
||||
:interval 5000
|
||||
:text #(.. (disk-free-percent "/") "%")
|
||||
:on-click #(spawn "baobab")
|
||||
:power-supply-energy-now now
|
||||
:power-supply-status status} (battery-status)
|
||||
percent (math.floor (* 100 (/ (tonumber now) (tonumber full))))
|
||||
icon-code (battery-icon-codepoint status percent)]
|
||||
(string.format "%s %d%%" (utf8.char icon-code) percent))
|
||||
})
|
||||
(indicator {
|
||||
:interval 1000
|
||||
|
Loading…
Reference in New Issue
Block a user