From ca0028da0d3a8f53e2abda4cd32ec5accda23e05 Mon Sep 17 00:00:00 2001
From: ave <ave@ave.zone>
Date: Sat, 26 Aug 2023 16:42:03 +0200
Subject: [PATCH] QoL: Draw a lock icon next to wifi if it's not open

---
 __init__.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/__init__.py b/__init__.py
index 7778f6c..fc492e2 100644
--- a/__init__.py
+++ b/__init__.py
@@ -98,6 +98,20 @@ class WifiApp(Application):
                 ctx.font_size = 15
             ctx.move_to(0, wlan_draw_offset)
             ctx.text(ssid)
+
+            # TODO: maybe add signal indicator?
+            # https://fonts.google.com/icons?selected=Material+Icons+Outlined:network_wifi_1_bar:&icon.query=network+wifi&icon.set=Material+Icons
+
+            # draw a key next to wifi if it isn't open
+            if wlan[4] != 0:
+                ctx.save()
+                ssid_width = ctx.text_width(ssid)
+                ctx.font = "Material Icons"
+                ctx.text_align = ctx.LEFT
+                ctx.move_to((ssid_width / 2) + 5, wlan_draw_offset + 2)
+                ctx.text("\ue897")
+                ctx.restore()
+
             wlan_draw_offset += 20
 
     def set_direction_leds(self, direction, r, g, b):
-- 
GitLab