diff options
author | Kevin <[email protected]> | 2024-10-09 21:10:24 -0300 |
---|---|---|
committer | Kevin <[email protected]> | 2024-10-09 21:10:24 -0300 |
commit | 6589834329b2b1cf8149522b70ac603e3667a0c8 (patch) | |
tree | d611fa62d30adf2a53f5b7c817d780b55a051bf4 | |
parent | b5fc6cd12c7d62a4e89fc9c2915c61f8c19900aa (diff) |
Accurate lua example
-rw-r--r-- | examples/lua/simple-bar/widget/Bar.lua | 8 |
1 files changed, 7 insertions, 1 deletions
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), |