diff options
author | Aylur <[email protected]> | 2024-12-28 01:33:32 +0100 |
---|---|---|
committer | Aylur <[email protected]> | 2024-12-28 01:33:32 +0100 |
commit | ebcccc4ae13f690220374497f932f58ec5fd7cfd (patch) | |
tree | 50289a84174e5df734d789633b878f895ff5435b /examples/lua/simple-bar | |
parent | 661b14cc893c5be17a4fce8fa269074785f57a36 (diff) |
fix: examples without wifi
Diffstat (limited to 'examples/lua/simple-bar')
-rw-r--r-- | examples/lua/simple-bar/widget/Bar.lua | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/examples/lua/simple-bar/widget/Bar.lua b/examples/lua/simple-bar/widget/Bar.lua index e0d8b20..155b9b8 100644 --- a/examples/lua/simple-bar/widget/Bar.lua +++ b/examples/lua/simple-bar/widget/Bar.lua @@ -15,7 +15,7 @@ local function SysTray() local tray = Tray.get_default() return Widget.Box({ - class_name = "SysTray", + class_name = "SysTray", bind(tray, "items"):as(function(items) return map(items, function(item) return Widget.MenuButton({ @@ -50,12 +50,20 @@ local function FocusedClient() end local function Wifi() - local wifi = Network.get_default().wifi + local network = Network.get_default() + local wifi = bind(network, "wifi") - return Widget.Icon({ - tooltip_text = bind(wifi, "ssid"):as(tostring), - class_name = "Wifi", - icon = bind(wifi, "icon-name"), + return Widget.Box({ + visible = wifi:as(function(v) + return v ~= nil + end), + wifi:as(function(w) + return Widget.Icon({ + tooltip_text = bind(w, "ssid"):as(tostring), + class_name = "Wifi", + icon = bind(w, "icon-name"), + }) + end), }) end @@ -179,7 +187,7 @@ return function(gdkmonitor) }), Widget.Box({ halign = "END", - SysTray(), + SysTray(), Wifi(), AudioSlider(), BatteryLevel(), |