mirror of
https://github.com/archlinux/aur.git
synced 2026-01-27 20:28:31 +01:00
86 lines
3.3 KiB
Text
86 lines
3.3 KiB
Text
post_install() {
|
|
local config_dir="$HOME/.config/hamr"
|
|
local state_dir="$HOME/.local/state/quickshell/hamr"
|
|
mkdir -p "$config_dir"
|
|
mkdir -p "$state_dir"
|
|
|
|
if [ ! -f "$config_dir/colors.json" ]; then
|
|
cp /etc/xdg/quickshell/hamr/defaults/colors.json "$config_dir/colors.json"
|
|
fi
|
|
|
|
echo ""
|
|
echo "==> Hamr has been installed to /etc/xdg/quickshell/hamr"
|
|
echo ""
|
|
echo "==> To start hamr, run:"
|
|
echo " hamr"
|
|
echo ""
|
|
echo "==> User config and plugins: ~/.config/hamr/"
|
|
echo "==> Persistent state: ~/.local/state/quickshell/hamr/"
|
|
echo ""
|
|
echo "==> Color theme:"
|
|
echo " Edit ~/.config/hamr/colors.json directly, or"
|
|
echo " configure matugen/wallust to output to this path, or"
|
|
echo " symlink to your existing colors (e.g. for end-4/dots-hyprland):"
|
|
echo " ln -sf ~/.local/state/quickshell/user/generated/colors.json ~/.config/hamr/colors.json"
|
|
echo ""
|
|
echo "==> For Hyprland, add to ~/.config/hypr/hyprland.conf:"
|
|
echo " exec-once = hamr"
|
|
echo " bind = Ctrl, Space, exec, hamr toggle"
|
|
echo ""
|
|
echo "==> For Niri, enable the systemd service and add keybind:"
|
|
echo " systemctl --user enable hamr.service"
|
|
echo " systemctl --user add-wants niri.service hamr.service"
|
|
echo " systemctl --user start hamr.service"
|
|
echo ""
|
|
echo " # Add to ~/.config/niri/config.kdl binds section:"
|
|
echo " Ctrl+Space { spawn \"hamr\" \"toggle\"; }"
|
|
echo ""
|
|
echo "==> Troubleshooting:"
|
|
echo " View logs: journalctl --user -u hamr -f"
|
|
echo " Qt mismatch crash? Rebuild: paru -S quickshell --rebuild"
|
|
echo ""
|
|
}
|
|
|
|
post_upgrade() {
|
|
local config_file="$HOME/.config/hamr/hamr.json"
|
|
|
|
# Migrate: remove old prefix config if it matches system defaults
|
|
if [ -f "$config_file" ]; then
|
|
local default_prefix='{"action":"/","app":">","clipboard":";","emojis":":","file":"~","math":"=","shellCommand":"$","shellHistory":"!","webSearch":"?"}'
|
|
local current_prefix
|
|
current_prefix=$(jq -c '.search.prefix // empty' "$config_file" 2>/dev/null)
|
|
|
|
if [ -n "$current_prefix" ]; then
|
|
# Normalize both for comparison (sort keys)
|
|
local current_sorted
|
|
local default_sorted
|
|
current_sorted=$(echo "$current_prefix" | jq -cS '.' 2>/dev/null)
|
|
default_sorted=$(echo "$default_prefix" | jq -cS '.' 2>/dev/null)
|
|
|
|
if [ "$current_sorted" = "$default_sorted" ]; then
|
|
# Remove the old prefix config since it's the default
|
|
jq 'del(.search.prefix)' "$config_file" >"$config_file.tmp" && mv "$config_file.tmp" "$config_file"
|
|
echo "==> Migrated: removed default prefix config (now using actionBarHints)"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo "==> Hamr has been upgraded."
|
|
echo "==> Restart quickshell to apply changes."
|
|
echo ""
|
|
echo "==> If hamr crashes after a Qt update, rebuild quickshell:"
|
|
echo " paru -S quickshell --rebuild"
|
|
echo ""
|
|
}
|
|
|
|
post_remove() {
|
|
# Disable systemd service if enabled
|
|
systemctl --user disable hamr.service 2>/dev/null || true
|
|
|
|
echo ""
|
|
echo "==> User data has been preserved. Remove manually if no longer needed:"
|
|
echo " rm -rf ~/.config/hamr"
|
|
echo " rm -rf ~/.local/state/quickshell/hamr"
|
|
echo ""
|
|
}
|