From 142d0842f1a106b15ad9cb03f025ef44b9b76870 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Fri, 13 Sep 2024 16:19:30 +0200 Subject: [PATCH 1/2] alacritty version check --- tabs/applications-setup/alacritty-setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tabs/applications-setup/alacritty-setup.sh b/tabs/applications-setup/alacritty-setup.sh index a26b78f86..f2bc14aad 100755 --- a/tabs/applications-setup/alacritty-setup.sh +++ b/tabs/applications-setup/alacritty-setup.sh @@ -16,6 +16,14 @@ setupAlacritty() { else echo "alacritty is already installed." fi + + alacritty_version=$(alacritty --version | awk '{print $2}') + if [ "$(printf '%s\n' "$alacritty_version" "0.13.0" | sort -V | head -n1)" != "0.13.0" ]; then # Check if alacritty is >= 0.13.0 https://alacritty.org/changelog_0_13_0.html#Changed + echo + echo "Only alacritty >= 0.13.0 is supported." + exit 1 + fi + echo "Copy alacritty config files" if [ -d "${HOME}/.config/alacritty" ]; then cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak" From cdb6f3dcc8f999061e7853b36684b0900308bf27 Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Fri, 13 Sep 2024 20:15:36 +0200 Subject: [PATCH 2/2] Add migration support Auto migrate from YAML to TOML for alacritty >= 0.13.0 Co-authored-by: RazoBeckett <95993675+RazoBeckett@users.noreply.github.com> --- tabs/applications-setup/alacritty-setup.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tabs/applications-setup/alacritty-setup.sh b/tabs/applications-setup/alacritty-setup.sh index f2bc14aad..e779e420c 100755 --- a/tabs/applications-setup/alacritty-setup.sh +++ b/tabs/applications-setup/alacritty-setup.sh @@ -17,20 +17,23 @@ setupAlacritty() { echo "alacritty is already installed." fi - alacritty_version=$(alacritty --version | awk '{print $2}') - if [ "$(printf '%s\n' "$alacritty_version" "0.13.0" | sort -V | head -n1)" != "0.13.0" ]; then # Check if alacritty is >= 0.13.0 https://alacritty.org/changelog_0_13_0.html#Changed - echo - echo "Only alacritty >= 0.13.0 is supported." - exit 1 - fi - echo "Copy alacritty config files" if [ -d "${HOME}/.config/alacritty" ]; then cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak" fi mkdir -p "${HOME}/.config/alacritty/" - wget -O "${HOME}/.config/alacritty/alacritty.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.toml" - wget -O "${HOME}/.config/alacritty/nordic.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.toml" + wget -O "${HOME}/.config/alacritty/alacritty.yml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.yml" + wget -O "${HOME}/.config/alacritty/nordic.yml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.yml" + + alacritty_version=$(alacritty --version | awk '{print $2}') + if [ "$(printf '%s\n' "$alacritty_version" "0.13.0" | sort -V | head -n1)" = "0.13.0" ]; then # Check if alacritty is < 0.13.0 https://alacritty.org/changelog_0_13_0.html#Changed + echo "Alacritty version is gearter or equal to 0.13.0, migrating config files..." + if alacritty migrate; then + command rm -f "${HOME}/.config/alacritty/*.yml" # Using 'command' to avoid alias + else + echo "Failed to migrate alacritty config files." + fi + fi } checkEnv