From 6589834329b2b1cf8149522b70ac603e3667a0c8 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 9 Oct 2024 21:10:24 -0300 Subject: Accurate lua example --- examples/lua/simple-bar/widget/Bar.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'examples/lua') diff --git a/examples/lua/simple-bar/widget/Bar.lua b/examples/lua/simple-bar/widget/Bar.lua index d44db2d..d340cba 100644 --- a/examples/lua/simple-bar/widget/Bar.lua +++ b/examples/lua/simple-bar/widget/Bar.lua @@ -134,6 +134,10 @@ local function Workspaces() return Widget.Box({ class_name = "Workspaces", bind(hypr, "workspaces"):as(function(wss) + table.sort(wss, function(a, b) + return a.id < b.id + end) + return map(wss, function(ws) return Widget.Button({ class_name = bind(hypr, "focused-workspace"):as(function(fw) @@ -142,7 +146,9 @@ local function Workspaces() on_clicked = function() ws:focus() end, - label = bind(ws, "id"):as(tostring), + label = bind(ws, "id"):as(function(v) + return type(v) == "number" and string.format("%.0f", v) or v + end), }) end) end), -- cgit v1.2.3