Skip to content

Commit 621bc59

Browse files
committed
feat: better alignment of text
1 parent 912d82b commit 621bc59

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

sjust/recipes/00-default.just

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,17 @@ upgrade:
239239
#!/usr/bin/env bash
240240
{{ sparkdock_path }}/bin/sparkdock.macos
241241
echo "System configuration and updates completed!"
242+
243+
# Launch the Sparkdock menu bar application.
244+
[group('sparkdock')]
245+
menubar:
246+
#!/usr/bin/env bash
247+
echo "Launching Sparkdock menu bar application..."
248+
if pgrep -f "sparkdock-manager" > /dev/null; then
249+
echo "⚠️ Sparkdock menu bar app is already running"
250+
echo "💡 If you need to restart it, quit the app first from the menu bar"
251+
else
252+
nohup {{ sparkdock_path }}/bin/sparkdock-manager > /dev/null 2>&1 &
253+
echo "✅ Sparkdock menu bar app launched successfully!"
254+
echo "💡 Look for the Sparkdock icon in your menu bar"
255+
fi

src/menubar-app/Sources/SparkdockManager/main.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,14 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
109109

110110
attachment.image = coloredCircle
111111

112+
// Center the circle with the text baseline
113+
let font = NSFont.menuFont(ofSize: 0)
114+
let fontHeight = font.capHeight
115+
let yOffset = (fontHeight - size.height) / 2
116+
attachment.bounds = CGRect(x: 0, y: yOffset, width: size.width, height: size.height)
117+
112118
let attributedString = NSMutableAttributedString(attachment: attachment)
113-
attributedString.append(NSAttributedString(string: " \(text)"))
119+
attributedString.append(NSAttributedString(string: " \(text)"))
114120

115121
return attributedString
116122
}

0 commit comments

Comments
 (0)