出现意外的闪烁/阴影/边框?
作者: lalityalamanchili创建于 2026年7月13日更新于 2026年7月13日
local colors = require("colors")
sbar.add("item", "apple.logo", { position = "left",
icon = {
string = "",
color = colors.text,
font = {
size = 18,
},
y_offset = 2,
},
label = {
drawing = false,
},
padding_left = 8,
padding_right = 10,
})
local spaces = {} local space_names = {}
sbar.exec("aerospace list-workspaces --all", function(space_list) for name in space_list:gmatch("[^\r\n]+") do local item_name = "space." .. name
local left_spacer = sbar.add("item", "left_spacer", {
position = "left",
width = 4,
icon = {
drawing = false,
},
label = {
drawing = false,
},
background = {
drawing = false,
},
})
local space = sbar.add("item", item_name, {
position = "left",
icon = {
drawing = false,
},
label = {
drawing = false,
},
width = 12,
background = {
drawing = true,
color = colors.grey,
height = 12,
corner_radius = 999,
},
})
spaces[name] = space
table.insert(space_names, item_name)
-- Don't add a gap after workspace 6
if name ~= "6" then
local spacer_name = item_name .. ".gap"
sbar.add("item", spacer_name, {
position = "left",
width = 8,
icon = {
drawing = false,
},
label = {
drawing = false,
},
background = {
drawing = false,
},
})
table.insert(space_names, spacer_name)
else
local spacer_name = item_name .. ".gap"
sbar.add("item", spacer_name, {
position = "left",
width = 4,
icon = {
drawing = false,
},
label = {
drawing = false,
},
background = {
drawing = false,
},
})
table.insert(space_names, spacer_name)
end
space:subscribe("aerospace_workspace_changed", function(env)
local selected = env.FOCUSED_WORKSPACE == name
sbar.animate("tanh", 12, function()
space:set({
width = selected and 28 or 12,
background = {
color = selected and colors.text or colors.grey,
},
})
end)
end)
end
…
内容来源: FelixKratz/SketchyBar