Skip to content

Integrate Aersoapce tiling manager in sketchybar #599

Answered by FelixKratz
bassamsdata asked this question in Q&A
Discussion options

You must be logged in to vote

Here is a minimal snippet that shows all aerospace workspaces in lua:

local colors = require("colors")

function parse_string_to_table(s)
  local result = {}
  for line in s:gmatch("([^\n]+)") do
    table.insert(result, line)
  end
  return result
end

local file = io.popen("aerospace list-workspaces --all")
local result = file:read("*a")
file:close()

local workspaces = parse_string_to_table(result)
for i, workspace in ipairs(workspaces) do
  local space = sbar.add("item", "space." .. i, {
    icon = {
      string = workspace,
      color = colors.white,
      highlight_color = colors.red,
    },
    label = { drawing = false },
    padding_left = 1,
    padding_right = 1,
  })

  space:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bassamsdata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants