mirror of
https://github.com/basecamp/omarchy.git
synced 2025-08-01 14:29:26 +00:00
Added backup timestamps to various omarchy-refresh-* files to prevent clobbering (#402)
* Added backup timestamps to omarchy-refresh-[hyprlock|swayosd|walker|waybar] scripts to prevent data loss if ran multiple times * Added new script (omarchy-refresh-config) for refreshing various config files with automated backup creation
This commit is contained in:
30
bin/omarchy-refresh-config
Executable file
30
bin/omarchy-refresh-config
Executable file
@ -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
|
@ -1,11 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Overwrite local Hyprlock settings with the latest in Omarchy, but create a backup if it differs
|
# Overwrite local Hyprlock settings with the latest in Omarchy
|
||||||
cp -f ~/.config/hypr/hyprlock.conf ~/.config/hypr/hyprlock.conf.bak 2>/dev/null
|
omarchy-refresh-config hypr/hyprlock.conf
|
||||||
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
|
|
@ -1,13 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp -f ~/.config/swayosd/config.toml ~/.config/swayosd/config.toml.bak 2>/dev/null
|
omarchy-refresh-config swayosd/config.toml
|
||||||
cp -f ~/.local/share/omarchy/config/swayosd/config.toml ~/.config/swayosd/ 3>/dev/null
|
omarchy-refresh-config swayosd/style.css
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
pkill swayosd-server
|
pkill swayosd-server
|
||||||
setsid uwsm app -- swayosd-server &>/dev/null &
|
setsid uwsm app -- swayosd-server &>/dev/null &
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp -f ~/.config/walker/config.toml ~/.config/walker/config.toml.bak 2>/dev/null
|
omarchy-refresh-config walker/config.toml
|
||||||
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
|
|
||||||
|
|
||||||
pkill walker
|
pkill walker
|
||||||
setsid uwsm app -- walker --gapplication-service &
|
setsid uwsm app -- walker --gapplication-service &
|
||||||
|
@ -1,25 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Backup existing settings
|
omarchy-refresh-config waybar/config.jsonc
|
||||||
cp -f ~/.config/waybar/config.jsonc ~/.config/waybar/config.jsonc.bak 2>/dev/null
|
omarchy-refresh-config waybar/style.css
|
||||||
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
|
|
||||||
|
|
||||||
# Restart waybar
|
# Restart waybar
|
||||||
pkill -SIGUSR2 waybar
|
pkill -SIGUSR2 waybar
|
||||||
|
Reference in New Issue
Block a user