(deflisten workspace :initial '[]' "scripts/workspaces")

(defwidget workspace-mod []
	(module
		(eventbox
			:onscroll "echo {} | sed -e 's/up/-1/' -e 's/down/+1/' | xargs -I % hyprctl eval \"hl.dispatch(hl.dsp.focus({ workspace = '%' }))\""
			(box
				:class "module workspaces"
				:orientation "v"
				(for ws in workspace
					(button
						:class `${ws.sep ? "workspace-sep" : ""}`
						:onclick "hyprctl  eval \"hl.dispatch(hl.dsp.focus({ workspace = '${ws.target}' }))\""
						(label
							:show-truncated false
							:class `icon-text ${ws.color}`
							:text `${ws.state == "focused" ? "󰜗" : ws.state == "active" ? "󰝥" : "○"}`
						)
					)
				)
			)
		)
	)
)
