diff --git a/blinkenlicht/bl.fnl b/blinkenlicht/bl.fnl
index 40190c7..c055fd3 100644
--- a/blinkenlicht/bl.fnl
+++ b/blinkenlicht/bl.fnl
@@ -21,6 +21,13 @@
; 0xf377 ; glyph not present in font-awesome free
))
+(fn wlan-quality-class [quality]
+ (if (< -50 quality) "p100"
+ (< -67 quality) "p75"
+ (< -70 quality) "p50"
+ (< -80 quality) "p25"
+ "p0"))
+
(fn spawn []
true)
@@ -71,16 +78,15 @@
:input [input]
}
:refresh
- #(let [status (uplink:read)]
+ #(let [status (uplink:read)
+ devtype status.devtype]
(if status
{:text (.. (or status.ssid status.name "?")
- " "
- (if status.quality
- ;; this is in dBm, allegedly.
- ;; typical values
- ;; -20 (good) -> -100 (awful)
- (tostring (+ status.quality 100))
- ""))}
+ " ")
+ :classes [devtype
+ (and (= devtype "wlan")
+ (wlan-quality-class status.quality))]
+ }
{:text "no internet"}
))
}))
diff --git a/blinkenlicht/licht.css b/blinkenlicht/licht.css
index 5652ffe..c97c37f 100644
--- a/blinkenlicht/licht.css
+++ b/blinkenlicht/licht.css
@@ -11,7 +11,35 @@
background-color: #e00;
}
+
+.wlan {
+ color: white;
+ background-size: 16px;
+ background-repeat: no-repeat;
+ background-position: 0 50%;
+}
+.wlan label {
+ /* leave a gap for the image */
+ margin-left: 19px;
+}
+
+.wlan.p100 {
+ background-image: -gtk-recolor(url("wifi.svg"), foreground white);
+}
+
+.wlan.p75 {
+ background-image: -gtk-recolor(url("wifi-3.svg"), foreground white);
+}
+
+.wlan.p50 {
+ background-image: -gtk-recolor(url("wifi-2.svg"), foreground white);
+}
+
+.wlan.p25,.wlan.p0 {
+ background-image: -gtk-recolor(url("wifi-1.svg"), foreground white);
+}
+
.bar {
- background-color: #200;
+ background-color: #20f;
padding-right: 1em;
}
diff --git a/blinkenlicht/wifi-1.svg b/blinkenlicht/wifi-1.svg
new file mode 100644
index 0000000..06bdacc
--- /dev/null
+++ b/blinkenlicht/wifi-1.svg
@@ -0,0 +1,59 @@
+
+
+
+
diff --git a/blinkenlicht/wifi-2.svg b/blinkenlicht/wifi-2.svg
new file mode 100644
index 0000000..5bd716f
--- /dev/null
+++ b/blinkenlicht/wifi-2.svg
@@ -0,0 +1,58 @@
+
+
+
+
diff --git a/blinkenlicht/wifi-3.svg b/blinkenlicht/wifi-3.svg
new file mode 100644
index 0000000..ea54fa9
--- /dev/null
+++ b/blinkenlicht/wifi-3.svg
@@ -0,0 +1,57 @@
+
+
+
+
diff --git a/blinkenlicht/wifi.svg b/blinkenlicht/wifi.svg
new file mode 100644
index 0000000..85b2629
--- /dev/null
+++ b/blinkenlicht/wifi.svg
@@ -0,0 +1,64 @@
+
+
+
+