diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-02-01 00:44:20 -0500 |
|---|---|---|
| committer | Don Williams <don.e.williams@gmail.com> | 2026-02-01 00:44:20 -0500 |
| commit | d78c3b985bd8e643e57af933d8f95f7dac4cef7f (patch) | |
| tree | 36fecfa14658a9b32f2e5645f80b293b7ef0a6b4 /copy.sh | |
| parent | 6fcc20ff0437e5f59c9a8f943f7c2f326fa04e73 (diff) | |
Fixed copy.sh to set default waybar links and check for broken links
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: copy.sh
Diffstat (limited to 'copy.sh')
| -rwxr-xr-x | copy.sh | 38 |
1 files changed, 32 insertions, 6 deletions
@@ -589,9 +589,22 @@ else config_remove="" fi -# Check if ~/.config/waybar/config does not exist or is a symlink -if [ ! -e "$HOME/.config/waybar/config" ] || [ -L "$HOME/.config/waybar/config" ]; then - ln -sf "$config_file" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" +# Ensure waybar config uses the normalized default. +# - If the current path is not a symlink (regular file), convert it to a symlink. +# - If the symlink points somewhere else (or is broken), reset it to the new default. +WAYBAR_CONFIG_LINK="$HOME/.config/waybar/config" +WAYBAR_CONFIG_TARGET="$config_file" +if [ -e "$WAYBAR_CONFIG_TARGET" ]; then + if [ -L "$WAYBAR_CONFIG_LINK" ]; then + current_target=$(readlink "$WAYBAR_CONFIG_LINK" || true) + if [ "$current_target" != "$WAYBAR_CONFIG_TARGET" ] || [ ! -e "$WAYBAR_CONFIG_LINK" ]; then + ln -sf "$WAYBAR_CONFIG_TARGET" "$WAYBAR_CONFIG_LINK" 2>&1 | tee -a "$LOG" + fi + else + ln -sf "$WAYBAR_CONFIG_TARGET" "$WAYBAR_CONFIG_LINK" 2>&1 | tee -a "$LOG" + fi +else + echo "${WARN} Waybar default config target not found at $WAYBAR_CONFIG_TARGET; leaving $WAYBAR_CONFIG_LINK as-is." 2>&1 | tee -a "$LOG" fi # Remove inappropriate waybar configs @@ -665,9 +678,22 @@ else cleanup_backups prompt "$LOG" fi -# Check if ~/.config/waybar/style.css does not exist or is a symlink -if [ ! -e "$HOME/.config/waybar/style.css" ] || [ -L "$HOME/.config/waybar/style.css" ]; then - ln -sf "$waybar_style" "$HOME/.config/waybar/style.css" 2>&1 | tee -a "$LOG" +# Ensure waybar style uses the normalized default. +# - If the current path is not a symlink (regular file), convert it to a symlink. +# - If the symlink points somewhere else (or is broken), reset it to the new default. +WAYBAR_STYLE_LINK="$HOME/.config/waybar/style.css" +WAYBAR_STYLE_TARGET="$waybar_style" +if [ -e "$WAYBAR_STYLE_TARGET" ]; then + if [ -L "$WAYBAR_STYLE_LINK" ]; then + current_target=$(readlink "$WAYBAR_STYLE_LINK" || true) + if [ "$current_target" != "$WAYBAR_STYLE_TARGET" ] || [ ! -e "$WAYBAR_STYLE_LINK" ]; then + ln -sf "$WAYBAR_STYLE_TARGET" "$WAYBAR_STYLE_LINK" 2>&1 | tee -a "$LOG" + fi + else + ln -sf "$WAYBAR_STYLE_TARGET" "$WAYBAR_STYLE_LINK" 2>&1 | tee -a "$LOG" + fi +else + echo "${WARN} Waybar default style target not found at $WAYBAR_STYLE_TARGET; leaving $WAYBAR_STYLE_LINK as-is." 2>&1 | tee -a "$LOG" fi printf "\n%.0s" {1..1} |
