summaryrefslogtreecommitdiff
path: root/pkgs/astal/src/widget/bar/wifi.lua
blob: 7a293a0e28754318f35142722dbef27a873f17ae (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
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,
		wifi:as(function(wifi)
			return Widget.Box({
				Widget.Icon({
					icon = bind(wifi, "icon-name"),
				}),
				Widget.Label({
					label = bind(wifi, "ssid"),
				}),
			})
		end),
	})
end