move $path definition from apply-color* scripts to helper script

This commit is contained in:
2025-11-15 02:00:43 +01:00
parent 163cfda11e
commit 94be67bf43
16 changed files with 14 additions and 32 deletions

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -14,11 +13,12 @@ sed -i "s|^\$border: #[0-9a-fA-F]\{6\};\$|\$border: #${colorHex};|" "$file" || {
exit 1 exit 1
} }
if pgrep -x eww >/dev/null -u "$USER"; then if pgrep -x eww -u "$USER" >/dev/null; then
eww reload || { eww reload || {
log_error "Failed to reload eww, is it running?" log_error "Failed to reload eww, is it running?"
exit 1 exit 1
} }
fi fi
log_success "eww" log_success "eww"

View File

@@ -14,4 +14,3 @@ sed -i -E "s/(set -g fetch_color\s+\"#)([0-9a-fA-F]{6})(\")/\1${colorHex}\3/" "$
} }
log_success "fastfetch" log_success "fastfetch"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -24,4 +23,3 @@ for entry in $entries; do
done done
log_success "fuzzel" log_success "fuzzel"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -27,4 +26,3 @@ if pgrep -x "hyprland" -u "$USER" >/dev/null; then
fi fi
log_success "hyprland" log_success "hyprland"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -23,4 +22,3 @@ if pgrep -x "mako" -u "$USER" >/dev/null; then
fi fi
log_success "mako" log_success "mako"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -15,4 +14,3 @@ sed -i -E "s/^(\s*active-color\s+\"#)([0-9A-Fa-f]{6})(\")/\1${colorHex}\3/" "$fi
} }
log_success "niri" log_success "niri"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -18,4 +17,3 @@ else
log_error "quickshell is not running. Cannot apply color." log_error "quickshell is not running. Cannot apply color."
exit 1 exit 1
fi fi

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -20,4 +19,3 @@ sed -i -E "s/^(\s*primary:\s*#)([0-9A-Fa-f]{6})(;)/\1${colorHex}\3/" "$file" ||
} }
log_success "rofi" log_success "rofi"

View File

@@ -48,4 +48,7 @@ function color_ansi {
function log_success { function log_success {
log_info "Applied palette \033[1;34m${palette}\033[0m with primary color $(color_ansi $colorHex)${colorName} (#${colorHex})\033[0m to \033[1;34m$1\033[0m" log_info "Applied palette \033[1;34m${palette}\033[0m with primary color $(color_ansi $colorHex)${colorName} (#${colorHex})\033[0m to \033[1;34m$1\033[0m"
} }
# relative path
path=$(dirname "$(readlink -f "$0")")

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -12,4 +11,5 @@ kvantummanager --set catppuccin-mocha-"$colorName" || {
exit 1 exit 1
} }
log_success "kvantum" log_success "kvantum"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -16,4 +15,5 @@ sed -i -E "s/^(gtk-theme=catppuccin-mocha-)[^-]+(-standard\+default)$/\1${colorN
nwg-look -a -x nwg-look -a -x
log_success "nwg-look" log_success "nwg-look"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -14,7 +13,7 @@ targetTypes=("os" "session" "status")
if ! python3 - "$file" "$colorHex" "${targetTypes[@]}"; then { if ! python3 - "$file" "$colorHex" "${targetTypes[@]}"; then {
log_error "Failed to edit ${file}" log_error "Failed to edit ${file}"
exit 1 exit 1
} fi <<EOF }; fi <<EOF
import json import json
import sys import sys
@@ -61,4 +60,5 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
log_success "oh-my-posh" log_success "oh-my-posh"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -19,4 +18,3 @@ if pgrep -x "waybar" -u "$USER" >/dev/null; then
fi fi
log_success "waybar" log_success "waybar"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -23,4 +22,3 @@ sed -i -E "s/(border-color:\s*#)([0-9A-Fa-f]{6})(;)/\1${colorHex}\3/" "$file" ||
} }
log_success "wlogout" log_success "wlogout"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -23,4 +22,3 @@ sed -i -E "s/(border-color:\s*#)([0-9A-Fa-f]{6})(;)/\1${colorHex}\3/" "$file" ||
} }
log_success "wlogout (niri version)" log_success "wlogout (niri version)"

View File

@@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
path=$(dirname "$(readlink -f "$0")")
[ -f "$HOME/.local/snippets/apply-color-helper" ] || { [ -f "$HOME/.local/snippets/apply-color-helper" ] || {
echo "Missing helper script: $HOME/.local/snippets/apply-color-helper" echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
exit 1 exit 1
@@ -13,4 +12,3 @@ cp -f "$path"/../../../../assets/yazi-themes/catppuccin-mocha-"$colorName".toml
} }
log_success "yazi" log_success "yazi"