summaryrefslogtreecommitdiff
path: root/pkgs/astal/src/widget/bar/wifi.lua
blob: ff53109a636e2b8cbc30443f19aaaef57e0f6b1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local astal = require("astal")
local Widget = require("astal.gtk3.widget")
local Network = astal.require("AstalNetwork")
local bind = astal.bind

return function()
	local network = Network.get_default()
	local wifi = bind(network, "wifi")

	return Widget.Box({
		class_name = "wifi",
		visible = wifi:as(function(v)
			return v ~= nil
		end),
		wifi:as(function(w)
			return Widget.Box({
				Widget.Icon({
					icon = bind(w, "icon-name"),
				}),
				Widget.Label({
					label = bind(w, "ssid"):as(tostring),
				}),
			})
		end),
	})
end