diff --git a/bin/omarchy-refresh-hyprlock b/bin/omarchy-refresh-hyprlock index 0c1167c..d4a3101 100755 --- a/bin/omarchy-refresh-hyprlock +++ b/bin/omarchy-refresh-hyprlock @@ -1,5 +1,11 @@ #!/bin/bash -# Overwrite local Hyprlock settings with the latest in Omarchy, but create a backup +# Overwrite local Hyprlock settings with the latest in Omarchy, but create a backup if it differs cp -f ~/.config/hypr/hyprlock.conf ~/.config/hypr/hyprlock.conf.bak 2>/dev/null cp -f ~/.local/share/omarchy/config/hypr/hyprlock.conf ~/.config/hypr/ 2>/dev/null + +if cmp -s ~/.config/hypr/hyprlock.conf.bak ~/.config/hypr/hyprlock.conf; then + rm ~/.config/hypr/hyprlock.conf.bak +else + echo -e "\e[31mExisting .config/hypr/hyprlock.conf replaced with new Omarchy default, but a .bak file was made.\e[0m" +fi diff --git a/bin/omarchy-refresh-walker b/bin/omarchy-refresh-walker index 734c6b7..700dd09 100755 --- a/bin/omarchy-refresh-walker +++ b/bin/omarchy-refresh-walker @@ -1,5 +1,10 @@ #!/bin/bash -if [[ "$1" == "-y" ]] || gum confirm "Refresh Walker config? This will replace your current settings with Omarchy defaults."; then - cp -f ~/.local/share/omarchy/config/walker/config.toml ~/.config/walker/ 2>/dev/null +cp -f ~/.config/walker/config.toml ~/.config/walker/config.toml.bak 2>/dev/null +cp -f ~/.local/share/omarchy/config/walker/config.toml ~/.config/walker/ 2>/dev/null + +if cmp -s ~/.config/walker/config.toml.bak ~/.config/walker/config.toml; then + rm ~/.config/walker/config.toml.bak +else + echo -e "\e[31mExisting .config/walker/config.toml replaced with new Omarchy default, but a .bak file was made.\e[0m" fi diff --git a/bin/omarchy-refresh-waybar b/bin/omarchy-refresh-waybar index a0033e4..e1289b4 100755 --- a/bin/omarchy-refresh-waybar +++ b/bin/omarchy-refresh-waybar @@ -1,10 +1,25 @@ #!/bin/bash -if gum confirm "Refresh Waybar config? This will replace your current settings with Omarchy defaults."; then - # Overwrite local waybar settings with the latest in Omarchy - cp -f ~/.local/share/omarchy/config/waybar/config.jsonc ~/.config/waybar/ 2>/dev/null - cp -f ~/.local/share/omarchy/config/waybar/style.css ~/.config/waybar/ 2>/dev/null +# Backup existing settings +cp -f ~/.config/waybar/config.jsonc ~/.config/waybar/config.jsonc.bak 2>/dev/null +cp -f ~/.config/waybar/style.css ~/.config/waybar/style.css.bak 2>/dev/null - # Restart waybar - pkill -SIGUSR2 waybar +# Overwrite local waybar settings with the latest in Omarchy +cp -f ~/.local/share/omarchy/config/waybar/config.jsonc ~/.config/waybar/ 2>/dev/null +cp -f ~/.local/share/omarchy/config/waybar/style.css ~/.config/waybar/ 2>/dev/null + +# Remove identical backup files +if cmp -s ~/.config/waybar/config.jsonc.bak ~/.config/waybar/config.jsonc; then + rm ~/.config/waybar/config.jsonc.bak +else + echo -e "\e[31mExisting .config/waybar/config.jsonc replaced with new Omarchy default, but a .bak file was made.\e[0m" fi + +if cmp -s ~/.config/waybar/style.css.bak ~/.config/waybar/style.css; then + rm ~/.config/waybar/style.css.bak +else + echo -e "\e[31mExisting .config/waybar/style.css replaced with new Omarchy default, but a .bak file was made.\e[0m" +fi + +# Restart waybar +pkill -SIGUSR2 waybar