diff --git a/bin/omarchy-refresh-config b/bin/omarchy-refresh-config new file mode 100755 index 0000000..82641d5 --- /dev/null +++ b/bin/omarchy-refresh-config @@ -0,0 +1,30 @@ +#!/bin/bash + +# This script deploys ~/.local/share/omarchy/config/X/Y/Z -> ~/.config/X/Y/Z +config_file=$1 + +if [[ -z "$config_file" ]]; then + cat << USAGE + Usage: $0 [config_file] + + Must provide a file path from the .config directory to be refreshed. + To copy ~/.local/share/omarchy/config/hypr/hyprlock.conf to ~/.config/hypr/hyprlock.conf + + $0 hypr/hyprlock.conf +USAGE + exit 1 +fi + +# Backup the destination file (with timestamp) to avoid clobbering (Ex: hyprlock.conf.bak.1753817951) +backup_file="${HOME}/.config/${config_file}.bak.$(date +%s)" +cp -f "${HOME}/.config/${config_file}" "$backup_file" 2>/dev/null + +# Deploy the source file +cp -f "${HOME}/.local/share/omarchy/config/${config_file}" "${HOME}/.config/${config_file}" 2>/dev/null + +# Compare and delete/inform accordingly +if cmp -s "${HOME}/.config/${config_file}" "$backup_file"; then + rm $backup_file +else + echo -e "\e[31mExisting "${HOME}/.config/${config_file}" replaced with new Omarchy default, but ${backup_file} file was made.\e[0m" +fi diff --git a/bin/omarchy-refresh-hyprlock b/bin/omarchy-refresh-hyprlock index d4a3101..26c1314 100755 --- a/bin/omarchy-refresh-hyprlock +++ b/bin/omarchy-refresh-hyprlock @@ -1,11 +1,4 @@ #!/bin/bash -# 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 +# Overwrite local Hyprlock settings with the latest in Omarchy +omarchy-refresh-config hypr/hyprlock.conf \ No newline at end of file diff --git a/bin/omarchy-refresh-swayosd b/bin/omarchy-refresh-swayosd index aa63918..c2c4999 100755 --- a/bin/omarchy-refresh-swayosd +++ b/bin/omarchy-refresh-swayosd @@ -1,13 +1,7 @@ #!/bin/bash -cp -f ~/.config/swayosd/config.toml ~/.config/swayosd/config.toml.bak 2>/dev/null -cp -f ~/.local/share/omarchy/config/swayosd/config.toml ~/.config/swayosd/ 3>/dev/null - -if cmp -s ~/.config/swayosd/config.toml.bak ~/.config/swayosd/config.toml; then - rm ~/.config/swayosd//config.toml.bak -else - echo -e "\e[31mExisting .config/swayosd/config.toml replaced with new Omarchy default, but a .bak file was made.\e[0m" -fi +omarchy-refresh-config swayosd/config.toml +omarchy-refresh-config swayosd/style.css pkill swayosd-server setsid uwsm app -- swayosd-server &>/dev/null & diff --git a/bin/omarchy-refresh-walker b/bin/omarchy-refresh-walker index cd52a83..e4e3853 100755 --- a/bin/omarchy-refresh-walker +++ b/bin/omarchy-refresh-walker @@ -1,13 +1,6 @@ #!/bin/bash -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 +omarchy-refresh-config walker/config.toml pkill walker setsid uwsm app -- walker --gapplication-service & diff --git a/bin/omarchy-refresh-waybar b/bin/omarchy-refresh-waybar index e1289b4..43eec3d 100755 --- a/bin/omarchy-refresh-waybar +++ b/bin/omarchy-refresh-waybar @@ -1,25 +1,7 @@ #!/bin/bash -# 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 - -# 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 +omarchy-refresh-config waybar/config.jsonc +omarchy-refresh-config waybar/style.css # Restart waybar pkill -SIGUSR2 waybar