graphical wifi quality display

phoen
Daniel Barlow 2022-04-07 23:40:52 +01:00
parent a39a752b15
commit 1887b72d1c
6 changed files with 281 additions and 9 deletions

View File

@ -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"}
))
}))

View File

@ -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;
}

59
blinkenlicht/wifi-1.svg Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<svg
version="1.1"
x="0px"
y="0px"
viewBox="0 0 983.92981 774.53827"
enable-background="new 0 0 1000 1000"
xml:space="preserve"
id="svg16"
sodipodi:docname="wifi-1.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
width="983.92981"
height="774.53827"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs20" /><sodipodi:namedview
id="namedview18"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="0.745"
inkscape:cx="349.66443"
inkscape:cy="388.5906"
inkscape:window-width="1458"
inkscape:window-height="960"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg16"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata2"> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g
style="fill:#bebebe;fill-opacity:1"
transform="matrix(0.1,0,0,-0.1,-8.040086,286.26829)"
id="g12"><path
d="m 4601.4,2834.6 c -31.1,-3.9 -153.6,-17.5 -272.2,-29.2 C 2837.8,2657.7 1364,1872.1 327.6,670.5 94.3,398.3 61.2,314.7 135.1,159.1 c 42.8,-91.4 451.1,-515.3 523,-542.5 108.9,-40.8 178.9,1.9 357.8,219.7 1238.6,1516.7 3186.9,2212.8 5053.5,1804.5 1123.9,-243.1 2168,-890.5 2914.7,-1804.4 178.9,-217.8 248.9,-260.6 357.8,-219.7 72,27.2 480.3,451.1 523.1,542.5 73.9,155.6 40.8,239.2 -192.5,511.4 -1201.7,1394 -2926.4,2189.3 -4711.4,2171.8 -165.3,0 -326.6,-5.8 -359.7,-7.8 z"
id="path4"
style="fill:none;stroke:#bebebe;stroke-width:40;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path
d="M 4552.8,647.2 C 3520.3,530.5 2528.7,-10 1846.2,-830.6 c -254.7,-307.2 -291.7,-404.4 -210,-571.6 19.4,-42.8 140,-184.7 268.3,-315 213.9,-221.7 237.2,-239.2 303.3,-239.2 105,0 132.2,21.4 250.8,188.6 476.4,674.8 1149.2,1120 1946.4,1293.1 165.3,36.9 256.7,42.8 595,42.8 340.3,0 427.8,-5.8 593,-42.8 795.3,-176.9 1409.7,-575.5 1907.4,-1240.5 89.5,-120.6 177,-221.7 194.4,-229.4 15.6,-5.8 62.2,-11.7 99.2,-11.7 64.2,0 91.4,21.4 301.4,239.2 291.7,299.4 348,410.3 287.8,569.7 -37,93.3 -274.2,381.1 -505.5,610.5 -672.7,668.8 -1530.2,1083 -2453.8,1184.1 -217.8,25.3 -657.2,23.3 -871.1,0 z"
id="path6"
style="fill:none;stroke:#bebebe;stroke-width:40;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path
d="m 4698.6,-1520.8 c -608.6,-93.3 -1094.7,-334.4 -1512.7,-750.5 -340.3,-340.3 -336.4,-437.5 35,-814.7 252.8,-256.7 272.2,-270.3 353.9,-270.3 66.1,0 116.7,42.8 283.9,241.1 583.3,686.4 1699.4,686.4 2282.7,0 182.8,-217.8 211.9,-241.1 281.9,-241.1 83.6,0 101.1,13.6 355.8,270.3 371.4,377.2 375.3,474.4 35,814.7 -357.8,355.8 -783.6,593 -1269.7,705.8 -161.4,38.9 -701.9,66.1 -845.8,44.7 z"
id="path8"
style="fill:none;fill-opacity:1;stroke:#bebebe;stroke-width:40;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path
d="m 4865.8,-3570.2 c -114.7,-25.3 -231.4,-95.3 -330.5,-204.2 -126.4,-136.1 -163.3,-239.2 -165.3,-447.2 -1.9,-151.7 5.8,-190.5 50.6,-285.8 62.2,-136.1 186.7,-262.5 316.9,-326.7 79.7,-38.9 126.4,-48.6 262.5,-48.6 151.7,0 175,5.8 287.8,66.1 136.1,73.9 233.3,178.9 299.4,324.7 35,75.8 42.8,130.3 42.8,270.3 0,151.7 -5.8,190.5 -52.5,283.9 -62.2,126.4 -211.9,276.1 -330.5,328.6 -101.2,44.7 -268.4,60.3 -381.2,38.9 z"
id="path10" /></g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

58
blinkenlicht/wifi-2.svg Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<svg
version="1.1"
x="0px"
y="0px"
viewBox="0 0 983.92981 774.53827"
enable-background="new 0 0 1000 1000"
xml:space="preserve"
id="svg16"
sodipodi:docname="wifi-2.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
width="983.92981"
height="774.53827"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs20" /><sodipodi:namedview
id="namedview18"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="0.745"
inkscape:cx="-196.6443"
inkscape:cy="388.5906"
inkscape:window-width="1458"
inkscape:window-height="960"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg16"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata2"> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g
style="fill:#bebebe;fill-opacity:1"
transform="matrix(0.1,0,0,-0.1,-8.040086,286.26829)"
id="g12"><path
d="m 4601.4,2834.6 c -31.1,-3.9 -153.6,-17.5 -272.2,-29.2 C 2837.8,2657.7 1364,1872.1 327.6,670.5 94.3,398.3 61.2,314.7 135.1,159.1 c 42.8,-91.4 451.1,-515.3 523,-542.5 108.9,-40.8 178.9,1.9 357.8,219.7 1238.6,1516.7 3186.9,2212.8 5053.5,1804.5 1123.9,-243.1 2168,-890.5 2914.7,-1804.4 178.9,-217.8 248.9,-260.6 357.8,-219.7 72,27.2 480.3,451.1 523.1,542.5 73.9,155.6 40.8,239.2 -192.5,511.4 -1201.7,1394 -2926.4,2189.3 -4711.4,2171.8 -165.3,0 -326.6,-5.8 -359.7,-7.8 z"
id="path4"
style="fill:none;stroke:#bebebe;stroke-width:40;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path
d="M 4552.8,647.2 C 3520.3,530.5 2528.7,-10 1846.2,-830.6 c -254.7,-307.2 -291.7,-404.4 -210,-571.6 19.4,-42.8 140,-184.7 268.3,-315 213.9,-221.7 237.2,-239.2 303.3,-239.2 105,0 132.2,21.4 250.8,188.6 476.4,674.8 1149.2,1120 1946.4,1293.1 165.3,36.9 256.7,42.8 595,42.8 340.3,0 427.8,-5.8 593,-42.8 795.3,-176.9 1409.7,-575.5 1907.4,-1240.5 89.5,-120.6 177,-221.7 194.4,-229.4 15.6,-5.8 62.2,-11.7 99.2,-11.7 64.2,0 91.4,21.4 301.4,239.2 291.7,299.4 348,410.3 287.8,569.7 -37,93.3 -274.2,381.1 -505.5,610.5 -672.7,668.8 -1530.2,1083 -2453.8,1184.1 -217.8,25.3 -657.2,23.3 -871.1,0 z"
id="path6"
style="fill:none;stroke:#bebebe;stroke-width:40;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.74902" /><path
d="m 4698.6,-1520.8 c -608.6,-93.3 -1094.7,-334.4 -1512.7,-750.5 -340.3,-340.3 -336.4,-437.5 35,-814.7 252.8,-256.7 272.2,-270.3 353.9,-270.3 66.1,0 116.7,42.8 283.9,241.1 583.3,686.4 1699.4,686.4 2282.7,0 182.8,-217.8 211.9,-241.1 281.9,-241.1 83.6,0 101.1,13.6 355.8,270.3 371.4,377.2 375.3,474.4 35,814.7 -357.8,355.8 -783.6,593 -1269.7,705.8 -161.4,38.9 -701.9,66.1 -845.8,44.7 z"
id="path8" /><path
d="m 4865.8,-3570.2 c -114.7,-25.3 -231.4,-95.3 -330.5,-204.2 -126.4,-136.1 -163.3,-239.2 -165.3,-447.2 -1.9,-151.7 5.8,-190.5 50.6,-285.8 62.2,-136.1 186.7,-262.5 316.9,-326.7 79.7,-38.9 126.4,-48.6 262.5,-48.6 151.7,0 175,5.8 287.8,66.1 136.1,73.9 233.3,178.9 299.4,324.7 35,75.8 42.8,130.3 42.8,270.3 0,151.7 -5.8,190.5 -52.5,283.9 -62.2,126.4 -211.9,276.1 -330.5,328.6 -101.2,44.7 -268.4,60.3 -381.2,38.9 z"
id="path10" /></g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

57
blinkenlicht/wifi-3.svg Normal file
View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<svg
version="1.1"
x="0px"
y="0px"
viewBox="0 0 983.92981 774.53827"
enable-background="new 0 0 1000 1000"
xml:space="preserve"
id="svg16"
sodipodi:docname="wifi-3.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
width="983.92981"
height="774.53827"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs20" /><sodipodi:namedview
id="namedview18"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="0.745"
inkscape:cx="-196.6443"
inkscape:cy="388.5906"
inkscape:window-width="1458"
inkscape:window-height="960"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg16"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata2"> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g
style="fill:#bebebe;fill-opacity:1"
transform="matrix(0.1,0,0,-0.1,-8.040086,286.26829)"
id="g12"><path
d="m 4601.4,2834.6 c -31.1,-3.9 -153.6,-17.5 -272.2,-29.2 C 2837.8,2657.7 1364,1872.1 327.6,670.5 94.3,398.3 61.2,314.7 135.1,159.1 c 42.8,-91.4 451.1,-515.3 523,-542.5 108.9,-40.8 178.9,1.9 357.8,219.7 1238.6,1516.7 3186.9,2212.8 5053.5,1804.5 1123.9,-243.1 2168,-890.5 2914.7,-1804.4 178.9,-217.8 248.9,-260.6 357.8,-219.7 72,27.2 480.3,451.1 523.1,542.5 73.9,155.6 40.8,239.2 -192.5,511.4 -1201.7,1394 -2926.4,2189.3 -4711.4,2171.8 -165.3,0 -326.6,-5.8 -359.7,-7.8 z"
id="path4"
style="fill:none;stroke:#bebebe;stroke-width:40;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path
d="M 4552.8,647.2 C 3520.3,530.5 2528.7,-10 1846.2,-830.6 c -254.7,-307.2 -291.7,-404.4 -210,-571.6 19.4,-42.8 140,-184.7 268.3,-315 213.9,-221.7 237.2,-239.2 303.3,-239.2 105,0 132.2,21.4 250.8,188.6 476.4,674.8 1149.2,1120 1946.4,1293.1 165.3,36.9 256.7,42.8 595,42.8 340.3,0 427.8,-5.8 593,-42.8 795.3,-176.9 1409.7,-575.5 1907.4,-1240.5 89.5,-120.6 177,-221.7 194.4,-229.4 15.6,-5.8 62.2,-11.7 99.2,-11.7 64.2,0 91.4,21.4 301.4,239.2 291.7,299.4 348,410.3 287.8,569.7 -37,93.3 -274.2,381.1 -505.5,610.5 -672.7,668.8 -1530.2,1083 -2453.8,1184.1 -217.8,25.3 -657.2,23.3 -871.1,0 z"
id="path6" /><path
d="m 4698.6,-1520.8 c -608.6,-93.3 -1094.7,-334.4 -1512.7,-750.5 -340.3,-340.3 -336.4,-437.5 35,-814.7 252.8,-256.7 272.2,-270.3 353.9,-270.3 66.1,0 116.7,42.8 283.9,241.1 583.3,686.4 1699.4,686.4 2282.7,0 182.8,-217.8 211.9,-241.1 281.9,-241.1 83.6,0 101.1,13.6 355.8,270.3 371.4,377.2 375.3,474.4 35,814.7 -357.8,355.8 -783.6,593 -1269.7,705.8 -161.4,38.9 -701.9,66.1 -845.8,44.7 z"
id="path8" /><path
d="m 4865.8,-3570.2 c -114.7,-25.3 -231.4,-95.3 -330.5,-204.2 -126.4,-136.1 -163.3,-239.2 -165.3,-447.2 -1.9,-151.7 5.8,-190.5 50.6,-285.8 62.2,-136.1 186.7,-262.5 316.9,-326.7 79.7,-38.9 126.4,-48.6 262.5,-48.6 151.7,0 175,5.8 287.8,66.1 136.1,73.9 233.3,178.9 299.4,324.7 35,75.8 42.8,130.3 42.8,270.3 0,151.7 -5.8,190.5 -52.5,283.9 -62.2,126.4 -211.9,276.1 -330.5,328.6 -101.2,44.7 -268.4,60.3 -381.2,38.9 z"
id="path10" /></g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

64
blinkenlicht/wifi.svg Normal file
View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<svg
version="1.1"
x="0px"
y="0px"
viewBox="0 0 980.01263 772.53827"
enable-background="new 0 0 1000 1000"
xml:space="preserve"
id="svg16"
sodipodi:docname="wifi.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
width="980.01263"
height="772.53827"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs20" /><sodipodi:namedview
id="namedview18"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="0.745"
inkscape:cx="281.20805"
inkscape:cy="385.90604"
inkscape:window-width="1458"
inkscape:window-height="960"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg16"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata2"> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g
id="g14"
style="fill:#bebebe;fill-opacity:1"
transform="translate(-9.9986845,-113.73171)"><g
transform="matrix(0.1,0,0,-0.1,0,398)"
id="g12"
style="fill:#bebebe;fill-opacity:1">
<path
d="m 4601.4,2834.6 c -31.1,-3.9 -153.6,-17.5 -272.2,-29.2 C 2837.8,2657.7 1364,1872.1 327.6,670.5 94.3,398.3 61.2,314.7 135.1,159.1 c 42.8,-91.4 451.1,-515.3 523,-542.5 108.9,-40.8 178.9,1.9 357.8,219.7 1238.6,1516.7 3186.9,2212.8 5053.5,1804.5 1123.9,-243.1 2168,-890.5 2914.7,-1804.4 178.9,-217.8 248.9,-260.6 357.8,-219.7 72,27.2 480.3,451.1 523.1,542.5 73.9,155.6 40.8,239.2 -192.5,511.4 -1201.7,1394 -2926.4,2189.3 -4711.4,2171.8 -165.3,0 -326.6,-5.8 -359.7,-7.8 z"
id="path4"
style="fill:#bebebe;fill-opacity:1" /><path
d="M 4552.8,647.2 C 3520.3,530.5 2528.7,-10 1846.2,-830.6 c -254.7,-307.2 -291.7,-404.4 -210,-571.6 19.4,-42.8 140,-184.7 268.3,-315 213.9,-221.7 237.2,-239.2 303.3,-239.2 105,0 132.2,21.4 250.8,188.6 476.4,674.8 1149.2,1120 1946.4,1293.1 165.3,36.9 256.7,42.8 595,42.8 340.3,0 427.8,-5.8 593,-42.8 795.3,-176.9 1409.7,-575.5 1907.4,-1240.5 89.5,-120.6 177,-221.7 194.4,-229.4 15.6,-5.8 62.2,-11.7 99.2,-11.7 64.2,0 91.4,21.4 301.4,239.2 291.7,299.4 348,410.3 287.8,569.7 -37,93.3 -274.2,381.1 -505.5,610.5 -672.7,668.8 -1530.2,1083 -2453.8,1184.1 -217.8,25.3 -657.2,23.3 -871.1,0 z"
id="path6"
style="fill:#bebebe;fill-opacity:1" /><path
d="m 4698.6,-1520.8 c -608.6,-93.3 -1094.7,-334.4 -1512.7,-750.5 -340.3,-340.3 -336.4,-437.5 35,-814.7 252.8,-256.7 272.2,-270.3 353.9,-270.3 66.1,0 116.7,42.8 283.9,241.1 583.3,686.4 1699.4,686.4 2282.7,0 182.8,-217.8 211.9,-241.1 281.9,-241.1 83.6,0 101.1,13.6 355.8,270.3 371.4,377.2 375.3,474.4 35,814.7 -357.8,355.8 -783.6,593 -1269.7,705.8 -161.4,38.9 -701.9,66.1 -845.8,44.7 z"
id="path8"
style="fill:#bebebe;fill-opacity:1" /><path
d="m 4865.8,-3570.2 c -114.7,-25.3 -231.4,-95.3 -330.5,-204.2 -126.4,-136.1 -163.3,-239.2 -165.3,-447.2 -1.9,-151.7 5.8,-190.5 50.6,-285.8 62.2,-136.1 186.7,-262.5 316.9,-326.7 79.7,-38.9 126.4,-48.6 262.5,-48.6 151.7,0 175,5.8 287.8,66.1 136.1,73.9 233.3,178.9 299.4,324.7 35,75.8 42.8,130.3 42.8,270.3 0,151.7 -5.8,190.5 -52.5,283.9 -62.2,126.4 -211.9,276.1 -330.5,328.6 -101.2,44.7 -268.4,60.3 -381.2,38.9 z"
id="path10"
style="fill:#bebebe;fill-opacity:1" /></g></g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB