-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
executable file
·228 lines (203 loc) · 5.52 KB
/
Copy pathinit.lua
File metadata and controls
executable file
·228 lines (203 loc) · 5.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
local defaults = {
-- Global bar configuration
window_manager = 'macos_native',
bar_preset = 'default',
bar_presets = {
default = {
border_width = 3,
height = 32,
y_offset = 1,
margin = 5,
corner_radius = 10,
},
compact = {
border_width = 0,
height = 26,
y_offset = 0,
margin = 0,
corner_radius = 0,
},
},
-- Font configuration
fonts = {
icon = 'Maple Mono NF',
label = 'Maple Mono NF',
style_map = {
['Regular'] = 'Regular',
['Semibold'] = 'Medium',
['Bold'] = 'Bold',
['Black'] = 'ExtraBold',
},
},
-- Spacing configuration
spacing = {
item_padding = 3,
group_padding = 5,
menu_padding = 6,
workspace_padding = 10,
},
-- Module configuration
modules = {
logo = { enabled = true },
spaces = { enabled = true },
menus = { enabled = true },
front_app = { enabled = true },
calendar = { enabled = true },
brew = { enabled = true },
battery = { enabled = true, style = 'both' }, -- Options: "icon", "text", or "both"
wifi = { enabled = true, style = 'both' }, -- Options: "icon", "text", or "both"
network = { enabled = true },
volume = { enabled = true, style = 'both' }, -- Options: "icon", "text", or "both"
toggle_stats = { enabled = true },
cpu = { enabled = true },
memory = { enabled = true },
music = { enabled = true },
},
-- Module-specific settings
workspace = {
label_style = 'greek_uppercase', -- Options: "greek_uppercase", "greek_lowercase", or nil for numbers
},
music = {
title_max_length = 20,
default_artist = 'Various Artists',
default_album = 'No Album',
},
network = {
proxy_app = 'FlClash',
},
}
local function deep_merge(base, user)
for key, value in pairs(user) do
if type(value) == 'table' and type(base[key]) == 'table' then
deep_merge(base[key], value)
else
base[key] = value
end
end
end
local user_settings = {}
local loaded, result = pcall(require, 'settings')
if loaded and type(result) == 'table' then
user_settings = result
end
local config = {}
for k, v in pairs(defaults) do
config[k] = v
end
deep_merge(config, user_settings)
-- Normalize modules
if config.modules then
for name, module in pairs(config.modules) do
if type(module) == 'boolean' then
config.modules[name] = { enabled = module }
elseif type(module) == 'table' and module.enabled == nil then
module.enabled = true
end
end
end
WINDOW_MANAGER = config.window_manager
PRESET = config.bar_preset
PRESET_OPTIONS = config.bar_presets
FONT = {
label = config.fonts.label,
icon = config.fonts.icon,
style_map = config.fonts.style_map,
}
MODULES = {}
for k, v in pairs(config.modules) do
MODULES[k] = { enable = v.enabled }
if v.style then
MODULES[k].style = v.style
end
end
SPACE_LABEL = config.workspace.label_style
SPACE_ITEM_PADDING = config.spacing.workspace_padding
MUSIC = {
TITLE_MAX_CHARS = config.music.title_max_length,
DEFAULT_ARTIST = config.music.default_artist,
DEFAULT_ALBUM = config.music.default_album,
}
WIFI = { PROXY_APP = config.network.proxy_app }
PADDINGS = config.spacing.item_padding
GROUP_PADDINGS = config.spacing.group_padding
MENU_ITEM_PADDINGS = config.spacing.menu_padding
SBAR = require('sketchybar')
COLORS = require('colors')
ICONS = require('icons')
SBAR.begin_config()
local preset = PRESET_OPTIONS[PRESET] or PRESET_OPTIONS['default']
-- Global style constants
STYLE = {
-- Dimensions
CORNER_RADIUS = 8,
ITEM_HEIGHT = 24,
BORDER_WIDTH = 1,
POPUP_CORNER_RADIUS = 8,
-- Colors (using Catppuccin palette)
UNFOCUSED_BORDER_COLOR = COLORS.surface0,
FOCUSED_BORDER_COLOR = COLORS.lavender,
BACKGROUND_COLOR = COLORS.base,
POPUP_BACKGROUND = COLORS.mantle, -- Slightly darker for popups
POPUP_BORDER = COLORS.surface0,
-- Semantic colors for better theming
TEXT_PRIMARY = COLORS.text,
TEXT_SECONDARY = COLORS.subtext1,
TEXT_TERTIARY = COLORS.overlay0,
ACCENT_PRIMARY = COLORS.lavender,
ACCENT_SECONDARY = COLORS.mauve,
-- Typography
FONT_SIZE_ICON = 16.0,
FONT_SIZE_LABEL = 13.0,
FONT_SIZE_LABEL_LARGE = 15.0,
FONT_SIZE_SMALL = 9.0, -- For graph widgets and small text
}
local bar_config = {
font_smoothing = true,
color = COLORS.base,
height = preset.height,
padding_right = PADDINGS,
padding_left = PADDINGS,
y_offset = preset.y_offset,
margin = preset.margin,
corner_radius = preset.corner_radius,
}
if preset.border_width > 0 then
bar_config.border_width = preset.border_width
bar_config.border_color = STYLE.UNFOCUSED_BORDER_COLOR
end
SBAR.bar(bar_config)
SBAR.default({
padding_left = PADDINGS,
padding_right = PADDINGS,
icon = {
font = { family = FONT.icon, style = FONT.style_map['Bold'], size = STYLE.FONT_SIZE_ICON },
color = COLORS.text,
padding_left = PADDINGS,
padding_right = PADDINGS,
},
label = {
font = { family = FONT.label, style = FONT.style_map['Bold'], size = STYLE.FONT_SIZE_LABEL },
color = COLORS.text,
padding_left = PADDINGS,
padding_right = PADDINGS,
},
background = {
height = STYLE.ITEM_HEIGHT,
corner_radius = STYLE.CORNER_RADIUS,
border_width = STYLE.BORDER_WIDTH,
border_color = COLORS.surface1,
},
popup = {
align = 'center',
background = {
border_width = STYLE.BORDER_WIDTH,
corner_radius = STYLE.POPUP_CORNER_RADIUS,
border_color = STYLE.POPUP_BORDER,
color = STYLE.POPUP_BACKGROUND,
},
},
scroll_texts = true,
})
require('items')
SBAR.end_config()
SBAR.event_loop()