Files
Panama/setup/scripts/link-dotfiles
T
Gabriel Brown 8c4dee0ca8 Give Settings its own icon and the first dock slot
Panama Settings shipped with Icon=preferences-system-symbolic, a
monochrome glyph drawn for 16px toolbar use. Beside full-colour
application icons in a 48px dock it reads as a missing icon rather than
a quiet one. It now has its own: a gear, because a settings icon has to
be recognisable before it is clever, rendered in the Prism gradient on
the dark tile so it belongs to this desktop.

An earlier attempt drew the gear as a ring with radial strokes; at dock
size the strokes merged into the ring and it read as an X. The shipped
version is a real toothed outline, checked at 48px rather than only at
128.

The dock also pinned GNOME Settings first. Panama now covers what GNOME
Settings did for this desktop and delegates the remainder to it by name,
so pinning the thing it delegates TO put the fallback in front of the
real one. GNOME Settings stays installed and searchable.

link-dotfiles installs icons alongside desktop entries, so this survives
a fresh setup rather than being a file that happens to exist here.

The new contract asserts every pinned application resolves to an
installed desktop entry. DockBody drops an unresolvable pin rather than
drawing a broken icon, which is right at runtime and invisible to debug:
a typo or a renamed desktop id just removes an icon with nothing logged.
It also cost me a false negative while writing it -- DesktopEntries
populates asynchronously, and asking too early reports every pin as
missing.

Also makes tests/quickshell/osd-ui-contract.sh executable. It was
committed mode 644, the only test in the suite that was, so the runner
could not invoke it. It passes.

Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
2026-08-18 06:54:43 -04:00

129 lines
4.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# --- Helper functions ---
log() { echo -e "\033[1;34m[INFO]\033[0m $*"; }
# Define paths as they have not been defined by new bashrc yet!
PANAMA_PATH="${PANAMA_PATH:-$HOME/.local/share/Panama}"
PANAMA_BASH="${PANAMA_BASH:-$PANAMA_PATH/config/bash}"
PANAMA_DOT="$PANAMA_PATH/config/dot"
PANAMA_OLD="$PANAMA_PATH/config/old"
CONFIG="$HOME/.config"
# Make backup folder if it doesn't exist
mkdir -p "$PANAMA_OLD"
# --- Bashrc ---
echo -e "\n--- Replacing .bashrc ---"
# Backup existing .bashrc if it's a regular file
if [ -f "$HOME/.bashrc" ] && [ ! -L "$HOME/.bashrc" ]; then
log "Backing up existing .bashrc"
mv "$HOME/.bashrc" "$PANAMA_OLD/.bashrc"
fi
# Remove old symlink if it exists and points somewhere else
if [ -L "$HOME/.bashrc" ]; then
log "Removing old .bashrc symlink"
rm "$HOME/.bashrc"
fi
# Symlink Panama .bashrc file to ~/.bashrc
log "Symlinking Panama .bashrc file to ~/.bashrc"
ln -s "$PANAMA_BASH/.bashrc" "$HOME/.bashrc"
# Each entry is symlinked as ~/.config/<name> -> $PANAMA_DOT/<name>.
# "forge" is the GNOME tiling extension; "hypr"/"quickshell"/"wofi" are the
# Hyprland desktop. They coexist deliberately — the GNOME session keeps working
# while Hyprland is being used, so you can log back into either.
dirs=("espanso" "forge" "ghostty" "gtk-3.0" "gtk-4.0" "hypr" "kitty" "nvim" \
"quickshell" "tmux" "uwsm" "vicinae" "wofi" "xdg-desktop-portal")
# --- Vim vimrc ---
echo -e "\n--- Setting up vim ---"
mkdir -p "$HOME/.vim"
if [ -L "$HOME/.vim/vimrc" ]; then
rm "$HOME/.vim/vimrc"
log "Removed old symlink at ~/.vim/vimrc"
fi
if [ -f "$HOME/.vim/vimrc" ]; then
mv "$HOME/.vim/vimrc" "$PANAMA_OLD/vimrc"
log "Moved existing ~/.vim/vimrc to $PANAMA_OLD/vimrc"
fi
ln -s "$PANAMA_DOT/vim/vimrc" "$HOME/.vim/vimrc"
log "Linked $PANAMA_DOT/vim/vimrc → ~/.vim/vimrc"
for dir in "${dirs[@]}"; do
echo -e "\n--- Setting up $dir ---"
# Remove old symlink if it exists
if [ -L "$CONFIG/$dir" ]; then
rm "$CONFIG/$dir"
log "Removed old symlink at $CONFIG/$dir"
fi
# Backup existing directory if it exists
if [ -d "$CONFIG/$dir" ]; then
mv "$CONFIG/$dir" "$PANAMA_OLD/$dir"
log "Moved existing $dir config to $PANAMA_OLD/$dir"
fi
# Create symlink
ln -s "$PANAMA_DOT/$dir" "$CONFIG/$dir"
log "Linked $PANAMA_DOT/$dir$CONFIG/$dir"
done
# Vicinae 0.26 discovers user themes from its XDG data directory rather than
# from ~/.config/vicinae. Keep the authored theme in Panama with the rest of
# the launcher config and expose only that file at Vicinae's runtime path.
VICINAE_THEME_DIR="$HOME/.local/share/vicinae/themes"
VICINAE_THEME="$VICINAE_THEME_DIR/tokyonight-moon.toml"
mkdir -p "$VICINAE_THEME_DIR"
if [ -L "$VICINAE_THEME" ]; then
rm "$VICINAE_THEME"
fi
if [ -e "$VICINAE_THEME" ]; then
log "Keeping existing Vicinae theme at $VICINAE_THEME"
else
ln -s "$PANAMA_DOT/vicinae/themes/tokyonight-moon.toml" "$VICINAE_THEME"
log "Linked Tokyo Night Moon theme → $VICINAE_THEME"
fi
# Panama-native applications live in the user data directory so launchers can
# discover them alongside system desktop entries. Keep each authored file in
# the repository and expose it with a narrow per-file symlink.
# Panama ships its own application icons. Without these the desktop entries fall
# back to a generic symbolic glyph, which is drawn for 16px toolbar use and
# looks wrong beside full-colour application icons in the dock.
PANAMA_ICON_DIR="$PANAMA_PATH/config/local/share/icons/hicolor/scalable/apps"
USER_ICON_DIR="$HOME/.local/share/icons/hicolor/scalable/apps"
mkdir -p "$USER_ICON_DIR"
for icon_file in "$PANAMA_ICON_DIR"/*.svg; do
[[ -e "$icon_file" ]] || continue
icon_name="$(basename "$icon_file")"
icon_target="$USER_ICON_DIR/$icon_name"
if [[ -L "$icon_target" ]]; then
rm "$icon_target"
elif [[ -e "$icon_target" ]]; then
mv "$icon_target" "$icon_target.bak"
fi
ln -s "$icon_file" "$icon_target"
done
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" 2>/dev/null || true
PANAMA_APPLICATION_DIR="$PANAMA_PATH/config/local/share/applications"
USER_APPLICATION_DIR="$HOME/.local/share/applications"
mkdir -p "$USER_APPLICATION_DIR"
for desktop_file in "$PANAMA_APPLICATION_DIR"/*.desktop; do
[[ -e "$desktop_file" ]] || continue
desktop_name="$(basename "$desktop_file")"
desktop_target="$USER_APPLICATION_DIR/$desktop_name"
if [[ -L "$desktop_target" ]]; then
rm "$desktop_target"
elif [[ -e "$desktop_target" ]]; then
log "Keeping existing desktop entry at $desktop_target"
continue
fi
ln -s "$desktop_file" "$desktop_target"
log "Linked $desktop_name$desktop_target"
done