Fix macOS menu bar spacing configuration to use activation scripts
- Replace CustomUserPreferences with system.activationScripts.postUserActivation - Use defaults -currentHost write commands that actually work - Corrected values: NSStatusItemSpacing=12, NSStatusItemSelectionPadding=6 - Commands will run during darwin-rebuild to apply host-specific preferences 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
052a8d74e6
commit
d661a80fa9
2 changed files with 23 additions and 19 deletions
|
|
@ -97,6 +97,16 @@ create_directory "$PAPER_PATH" "paper"
|
||||||
[ -n "$CONTENT_PATH" ] && [ "$CONTENT_PATH" != "null" ] && [ -d "$CONTENT_PATH" ] && zoxide add "$CONTENT_PATH" 2>/dev/null || true
|
[ -n "$CONTENT_PATH" ] && [ "$CONTENT_PATH" != "null" ] && [ -d "$CONTENT_PATH" ] && zoxide add "$CONTENT_PATH" 2>/dev/null || true
|
||||||
[ -n "$PAPER_PATH" ] && [ "$PAPER_PATH" != "null" ] && [ -d "$PAPER_PATH" ] && zoxide add "$PAPER_PATH" 2>/dev/null || true
|
[ -n "$PAPER_PATH" ] && [ "$PAPER_PATH" != "null" ] && [ -d "$PAPER_PATH" ] && zoxide add "$PAPER_PATH" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Check if session already exists and attach if it does
|
||||||
|
if is_session_running "$SESSION_NAME"; then
|
||||||
|
printf "\033[1;32mAttaching to existing session: %s\033[0m\n" "$SESSION_NAME"
|
||||||
|
tmux attach-session -t "$SESSION_NAME"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update papis cache
|
||||||
|
papis cache reset > /dev/null 2>&1
|
||||||
|
|
||||||
# Create remote directory if server connection is configured
|
# Create remote directory if server connection is configured
|
||||||
if [ -n "$SERVER" ] && [ -n "$REMOTE_DIR" ]; then
|
if [ -n "$SERVER" ] && [ -n "$REMOTE_DIR" ]; then
|
||||||
printf "\033[2mEnsuring remote directory exists: %s:%s\033[0m\n" "$SERVER" "$REMOTE_DIR"
|
printf "\033[2mEnsuring remote directory exists: %s:%s\033[0m\n" "$SERVER" "$REMOTE_DIR"
|
||||||
|
|
@ -108,16 +118,6 @@ if [ -n "$SERVER" ] && [ -n "$REMOTE_DIR" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if session already exists and attach if it does
|
|
||||||
if is_session_running "$SESSION_NAME"; then
|
|
||||||
printf "\033[1;32mAttaching to existing session: %s\033[0m\n" "$SESSION_NAME"
|
|
||||||
tmux attach-session -t "$SESSION_NAME"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update papis cache
|
|
||||||
papis cache reset > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Launch appropriate template
|
# Launch appropriate template
|
||||||
case "$TEMPLATE" in
|
case "$TEMPLATE" in
|
||||||
"basic")
|
"basic")
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
system.defaults.NSGlobalDomain = {
|
# Set primary user for system preferences
|
||||||
# Menu bar spacing configuration
|
system.primaryUser = "yanlin";
|
||||||
|
|
||||||
|
# Menu bar spacing configuration using activation scripts
|
||||||
|
# Uses -currentHost to write host-specific preferences
|
||||||
# NSStatusItemSpacing controls horizontal spacing between menu bar items
|
# NSStatusItemSpacing controls horizontal spacing between menu bar items
|
||||||
# NSStatusItemSelectionPadding controls padding inside selection overlay
|
# NSStatusItemSelectionPadding controls padding inside selection overlay
|
||||||
# Optimal ratio is 1:2 (spacing:padding)
|
system.activationScripts.postUserActivation.text = ''
|
||||||
NSStatusItemSpacing = 6;
|
echo "Setting menu bar spacing preferences..."
|
||||||
NSStatusItemSelectionPadding = 12;
|
defaults -currentHost write -globalDomain NSStatusItemSpacing -int 12
|
||||||
};
|
defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 6
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue