eufon

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

modeline.fnl (1447B)


      1 (local {: bar : indicator : stylesheet  : run} (require :blinkenlicht))
      2 
      3 (local {: view} (require :fennel))
      4 
      5 (local iostream (require :blinkenlicht.iostream))
      6 ;(local modem (require :blinkenlicht.modem))
      7 
      8 ;(local uplink (require :blinkenlicht.metric.uplink))
      9 ;(local battery (require :blinkenlicht.metric.battery))
     10 (local cpustat (require :blinkenlicht.metric.cpustat))
     11 
     12 (stylesheet (.. (os.getenv "EUFON_PATH")  "/modeline.css"))
     13 
     14 (fn battery-icon-codepoint [status percent]
     15   (if (= status "Charging") 0xf0e7
     16       (> percent 90) 0xf240                ;full
     17       (> percent 60) 0xf241                ;3/4
     18       (> percent 40) 0xf242                ;1/2
     19       (> percent 15) 0xf243                ;1/4
     20       (>= percent 0)  0xf244                ;empty
     21       ; 0xf377         ; glyph not present in font-awesome free
     22       ))
     23 
     24 (fn wlan-quality-class [quality]
     25   (if (< -50 quality) "p100"
     26       (< -67 quality) "p75"
     27       (< -70 quality) "p50"
     28       (< -80 quality) "p25"
     29       "p0"))
     30 
     31 (fn spawn []
     32   true)
     33 
     34 (bar
     35  {
     36   ;; bar must be full width to set up an "exclusive zone" (moves
     37   ;; other windows out of the way), otherwise it will display on
     38   ;; to of whatever's on the screen already
     39   :anchor [:top :right :left]
     40   :orientation :horizontal
     41   :gravity :end
     42   :classes ["hey"]
     43   :indicators
     44   [
     45    (indicator {
     46                :wait-for { :interval 4000 }
     47                :refresh #{:text (os.date "%H:%M")}
     48                })
     49 
     50    ]})
     51 
     52 (run)