summaryrefslogtreecommitdiff
path: root/examples/lua/simple-bar
diff options
context:
space:
mode:
Diffstat (limited to 'examples/lua/simple-bar')
-rw-r--r--examples/lua/simple-bar/widget/Bar.lua8
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),