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 9 replies

Comment options

You must be logged in to vote
9 replies
@ArquitetoMovel
Comment options

@B-urb
Comment options

@xbunax
Comment options

@jackplus-xyz
Comment options

@xbunax
Comment options

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
7 participants