forked from Shinonome/dots-hyprland
Merge branch 'end-4:main' into keybinds-settings
This commit is contained in:
@@ -18,11 +18,11 @@ input_path = '~/.config/matugen/templates/fuzzel/fuzzel_theme.ini'
|
|||||||
output_path = '~/.config/fuzzel/fuzzel_theme.ini'
|
output_path = '~/.config/fuzzel/fuzzel_theme.ini'
|
||||||
|
|
||||||
[templates.gtk3]
|
[templates.gtk3]
|
||||||
input_path = '~/.config/matugen/templates/gtk/gtk-colors.css'
|
input_path = '~/.config/matugen/templates/gtk-3.0/gtk.css'
|
||||||
output_path = '~/.config/gtk-3.0/gtk.css'
|
output_path = '~/.config/gtk-3.0/gtk.css'
|
||||||
|
|
||||||
[templates.gtk4]
|
[templates.gtk4]
|
||||||
input_path = '~/.config/matugen/templates/gtk/gtk-colors.css'
|
input_path = '~/.config/matugen/templates/gtk-4.0/gtk.css'
|
||||||
output_path = '~/.config/gtk-4.0/gtk.css'
|
output_path = '~/.config/gtk-4.0/gtk.css'
|
||||||
|
|
||||||
[templates.kde_colors]
|
[templates.kde_colors]
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* GTK Colors
|
||||||
|
* Generated with Matugen
|
||||||
|
*/
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
@define-color accent_color {{colors.primary.light.hex}};
|
||||||
|
@define-color accent_fg_color {{colors.on_primary.light.hex}};
|
||||||
|
@define-color accent_bg_color {{colors.primary.light.hex}};
|
||||||
|
@define-color window_bg_color {{colors.background.light.hex}};
|
||||||
|
@define-color window_fg_color {{colors.on_background.light.hex}};
|
||||||
|
@define-color headerbar_bg_color {{colors.surface_dim.light.hex}};
|
||||||
|
@define-color headerbar_fg_color {{colors.on_surface.light.hex}};
|
||||||
|
@define-color popover_bg_color {{colors.surface_dim.light.hex}};
|
||||||
|
@define-color popover_fg_color {{colors.on_surface.light.hex}};
|
||||||
|
@define-color view_bg_color {{colors.surface.light.hex}};
|
||||||
|
@define-color view_fg_color {{colors.on_surface.light.hex}};
|
||||||
|
@define-color card_bg_color {{colors.surface.light.hex}};
|
||||||
|
@define-color card_fg_color {{colors.on_surface.light.hex}};
|
||||||
|
@define-color sidebar_bg_color @window_bg_color;
|
||||||
|
@define-color sidebar_fg_color @window_fg_color;
|
||||||
|
@define-color sidebar_border_color @window_bg_color;
|
||||||
|
@define-color sidebar_backdrop_color @window_bg_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
@define-color accent_color {{colors.primary.dark.hex}};
|
||||||
|
@define-color accent_fg_color {{colors.on_primary.dark.hex}};
|
||||||
|
@define-color accent_bg_color {{colors.primary.dark.hex}};
|
||||||
|
@define-color window_bg_color {{colors.background.dark.hex}};
|
||||||
|
@define-color window_fg_color {{colors.on_background.dark.hex}};
|
||||||
|
@define-color headerbar_bg_color {{colors.surface_dim.dark.hex}};
|
||||||
|
@define-color headerbar_fg_color {{colors.on_surface.dark.hex}};
|
||||||
|
@define-color popover_bg_color {{colors.surface_dim.dark.hex}};
|
||||||
|
@define-color popover_fg_color {{colors.on_surface.dark.hex}};
|
||||||
|
@define-color view_bg_color {{colors.surface.dark.hex}};
|
||||||
|
@define-color view_fg_color {{colors.on_surface.dark.hex}};
|
||||||
|
@define-color card_bg_color {{colors.surface.dark.hex}};
|
||||||
|
@define-color card_fg_color {{colors.on_surface.dark.hex}};
|
||||||
|
@define-color sidebar_bg_color @window_bg_color;
|
||||||
|
@define-color sidebar_fg_color @window_fg_color;
|
||||||
|
@define-color sidebar_border_color @window_bg_color;
|
||||||
|
@define-color sidebar_backdrop_color @window_bg_color;
|
||||||
|
}
|
||||||
@@ -53,6 +53,8 @@
|
|||||||
##### Not work, to be solved #####
|
##### Not work, to be solved #####
|
||||||
# swaylock pamtester
|
# swaylock pamtester
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: migrate all packages from dist-arch. Note that for each package, must know why it's needed and how it's used specifically, cuz things may be need tweak to properly use the package installed by Nix, especially those have hardcoded path /usr/* .
|
||||||
### illogical-impulse-audio
|
### illogical-impulse-audio
|
||||||
libcava #cava
|
libcava #cava
|
||||||
lxqt.pavucontrol-qt #pavucontrol-qt
|
lxqt.pavucontrol-qt #pavucontrol-qt
|
||||||
|
|||||||
+3
-18
@@ -292,24 +292,9 @@ function check_disk_space() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function auto_get_git_submodule(){
|
function auto_update_git_submodule(){
|
||||||
local git_submodules_list=()
|
if git submodule status --recursive | grep -E '^[+-U]';then
|
||||||
|
# Note: `git pull --recurse-submodules` cannot substitute `git submodule update --init --recursive` cuz it does not init a submodule when needed.
|
||||||
while IFS= read -r path; do
|
|
||||||
[ -z "$path" ] && continue
|
|
||||||
git_submodules_list+=("$path")
|
|
||||||
done < <(git submodule status --recursive 2>/dev/null | awk '{print $2}')
|
|
||||||
|
|
||||||
local missing=0
|
|
||||||
|
|
||||||
for p in "${git_submodules_list[@]}"; do
|
|
||||||
if [ ! -d "$p" ] || [ -z "$(ls -A "$p" 2>/dev/null)" ]; then
|
|
||||||
missing=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$missing" -eq 1 ]; then
|
|
||||||
x git submodule update --init --recursive
|
x git submodule update --init --recursive
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,11 @@
|
|||||||
pkglistfile=$(mktemp)
|
pkglistfile=$(mktemp)
|
||||||
pkglistfile_orig=${LIST_FILE_PATH}
|
pkglistfile_orig=${LIST_FILE_PATH}
|
||||||
pkglistfile_orig_s=${REPO_ROOT}/cache/dependencies_stripped.conf
|
pkglistfile_orig_s=${REPO_ROOT}/cache/dependencies_stripped.conf
|
||||||
#if ! "$(command -v curl)";then
|
for cmd in curl gzip pacman;do
|
||||||
# echo "Please install curl first.";exit 1
|
if ! command -v $cmd;then
|
||||||
#fi
|
echo "Please install $cmd first.";exit 1
|
||||||
#if ! "$(command -v gzip)";then
|
fi
|
||||||
# echo "Please install gzip first.";exit 1
|
done
|
||||||
#fi
|
|
||||||
#if ! "$(command -v pacman)";then
|
|
||||||
# echo "pacman not found, aborting...";exit 1
|
|
||||||
#fi
|
|
||||||
remove_bashcomments_emptylines $pkglistfile_orig $pkglistfile_orig_s
|
remove_bashcomments_emptylines $pkglistfile_orig $pkglistfile_orig_s
|
||||||
|
|
||||||
cat $pkglistfile_orig_s | sed "s_\ _\n_g" > $pkglistfile
|
cat $pkglistfile_orig_s | sed "s_\ _\n_g" > $pkglistfile
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ printf "${STY_CYAN}[$0]: 1. Install dependencies\n${STY_RST}"
|
|||||||
|
|
||||||
function outdate_detect(){
|
function outdate_detect(){
|
||||||
# Shallow clone prevent latest_commit_timestamp() from working.
|
# Shallow clone prevent latest_commit_timestamp() from working.
|
||||||
x git_auto_unshallow
|
x git_auto_unshallow 2>&1>/dev/null
|
||||||
|
|
||||||
local source_path="$1"
|
local source_path="$1"
|
||||||
local target_path="$2"
|
local target_path="$2"
|
||||||
@@ -119,12 +119,17 @@ elif [[ -f "./sdata/dist-${OS_DISTRO_ID}/install-deps.sh" ]]; then
|
|||||||
if [[ "${tmp_update_status}" =~ ^(OUTDATED|EMPTY_TARGET|EMPTY_SOURCE|FORCE_OUTDATED|WIP)$ ]]; then
|
if [[ "${tmp_update_status}" =~ ^(OUTDATED|EMPTY_TARGET|EMPTY_SOURCE|FORCE_OUTDATED|WIP)$ ]]; then
|
||||||
printf "${STY_RED}${STY_BOLD}===URGENT===${STY_RST}\n"
|
printf "${STY_RED}${STY_BOLD}===URGENT===${STY_RST}\n"
|
||||||
printf "${STY_RED}"
|
printf "${STY_RED}"
|
||||||
printf "The community provided ./sdata/dist-${TARGET_ID}/ is not updated (update status: ${tmp_update_status}),\n"
|
printf "The community provided ./sdata/dist-${TARGET_ID}/ is outdated (status: ${tmp_update_status}),\n"
|
||||||
printf "which means it does not fully reflect the latest changes of ./sdata/dist-arch/ .\n"
|
printf "which means it probably does not reflect all latest changes of ./sdata/dist-arch/ .\n"
|
||||||
printf "You are highly recommended to abort this script, until someone (maybe you?) has updated the ./sdata/dist-${TARGET_ID}/ to fully reflect the latest changes in ./sdata/dist-arch/ .\n"
|
printf "\n"
|
||||||
printf "PR is welcomed. Please see discussion#2140 for details.\n"
|
printf "According to the actual changes, it may still works, but it can also work unexpectedly.\n"
|
||||||
|
printf "It's highly recommended to check the following links before continue:${STY_RST}\n"
|
||||||
printf "${STY_UNDERLINE}https://github.com/end-4/dots-hyprland/discussions/2140${STY_RST}\n"
|
printf "${STY_UNDERLINE}https://github.com/end-4/dots-hyprland/discussions/2140${STY_RST}\n"
|
||||||
printf "${STY_RED}${STY_INVERT}If you are proceeding anyway, illogical-impulse will very likely not work as expected.${STY_RST}\n"
|
printf "${STY_UNDERLINE}https://github.com/end-4/dots-hyprland/commits/main/sdata/dist-arch${STY_RST}\n"
|
||||||
|
printf "${STY_UNDERLINE}https://github.com/end-4/dots-hyprland/commits/main/sdata/dist-${TARGET_ID}${STY_RST}\n"
|
||||||
|
printf "\n"
|
||||||
|
printf "${STY_PURPLE}${STY_INVERT}PR on ./sdata/dist-${TARGET_ID}/ to properly reflect the latest changes of ./sdata/dist-arch is welcomed.${STY_RST}\n"
|
||||||
|
printf "\n"
|
||||||
if [ "$ask" = "false" ]; then
|
if [ "$ask" = "false" ]; then
|
||||||
echo "Urgent problem encountered, aborting...";exit 1
|
echo "Urgent problem encountered, aborting...";exit 1
|
||||||
fi
|
fi
|
||||||
@@ -163,7 +168,7 @@ else
|
|||||||
printf "./sdata/dist-${OS_DISTRO_ID}/install-deps.sh not found.\n"
|
printf "./sdata/dist-${OS_DISTRO_ID}/install-deps.sh not found.\n"
|
||||||
printf "./sdata/dist-${TARGET_ID}/install-deps.sh will be used.\n"
|
printf "./sdata/dist-${TARGET_ID}/install-deps.sh will be used.\n"
|
||||||
printf "1. It may disrupt your system and will likely fail without your manual intervention.\n"
|
printf "1. It may disrupt your system and will likely fail without your manual intervention.\n"
|
||||||
printf "2. It's WIP and only contains small number of dependencies far from enough.\n"
|
printf "2. It is WIP and only contains small number of dependencies far from enough.\n"
|
||||||
printf "Proceed only at your own risk.\n"
|
printf "Proceed only at your own risk.\n"
|
||||||
printf "${STY_RST}"
|
printf "${STY_RST}"
|
||||||
pause
|
pause
|
||||||
|
|||||||
+160
-146
@@ -1,14 +1,30 @@
|
|||||||
# This script is meant to be sourced.
|
# This script is meant to be sourced.
|
||||||
# It's not for directly running.
|
# It's not for directly running.
|
||||||
|
|
||||||
# TODO: https://github.com/end-4/dots-hyprland/issues/2137
|
# See https://github.com/end-4/dots-hyprland/issues/2137
|
||||||
|
#
|
||||||
|
# Stage 1 todos:
|
||||||
|
# TODO: Properly handle hyprland config, ~/.config/hypr/hyprland.conf should be overwritten only when firstrun
|
||||||
|
# TODO: add --exp-files-path <path> Use <path> instead of the default yaml config
|
||||||
|
# TODO: add --exp-files-regen Force copy the default config to ${EXP_FILE_PATH} (auto do this when not existed)
|
||||||
|
# TODO: Implement versioning, i.e. when user-defined yaml config file has version number mismatch with the default one, produce error. If only minor version number is not the same, the error can be ommitted via --exp-file-no-strict .
|
||||||
|
# TODO: add --exp-files-no-strict Ignore error when minor version number is not the same
|
||||||
|
#
|
||||||
|
# Stage 2 todos:
|
||||||
|
# TODO: Implement bool key symlink (both read-write and read-only), when the value of `symlink` is true, then instead using `rsync` or `cp`, use `ln`.
|
||||||
|
# TODO: add --exp-file-reset-symlink Try to remove all symlink in .config and .local, which point to the local repo
|
||||||
|
# TODO: Update help and doc about `--exp-files` and the yaml config, including the possible values of mode.
|
||||||
|
#
|
||||||
|
# Stage 3 todos:
|
||||||
|
# TODO: Implement user-define yaml with merging (override) ability for user who only wants little customization and is satisfied with most of the defaults. User can use `./install-files.yaml` as custom config. When `./install-files.yaml` exists and have correct major version number, merge it together with `sdata/step/3.install-files.yaml` to generate a `cache/install-files.final.yaml` to determine how to copy files. About how to merge two yaml files, I know some software such as rime input method and docker supports a override yaml config, which we may reference from. See also https://github.com/mikefarah/yq/discussions/1437
|
||||||
|
# TODO: Implement variants like keybindings, terminals, etc under user_preferences.
|
||||||
|
|
||||||
# Configuration file
|
# Configuration file
|
||||||
CONFIG_FILE="sdata/subcmd-install/3.files.yaml"
|
CONFIG_FILE="sdata/subcmd-install/3.files-exp.yaml"
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
wizard_update_preferences() {
|
wizard_update_preferences() {
|
||||||
echo -e "${STY_CYAN}=== Dotfiles Customization ===${STY_RESET}"
|
echo -e "${STY_CYAN}=== Dotfiles Customization ===${STY_RESET}"
|
||||||
|
|
||||||
# Get current preferences
|
# Get current preferences
|
||||||
current_shell=$(yq '.user_preferences.shell // "fish"' "$CONFIG_FILE")
|
current_shell=$(yq '.user_preferences.shell // "fish"' "$CONFIG_FILE")
|
||||||
@@ -28,9 +44,9 @@ wizard_update_preferences() {
|
|||||||
read -p "Enter choice [1-2]: " shell_choice
|
read -p "Enter choice [1-2]: " shell_choice
|
||||||
|
|
||||||
case "$shell_choice" in
|
case "$shell_choice" in
|
||||||
1|"") shell="fish" ;;
|
1|"") shell="fish" ;;
|
||||||
2) shell="zsh" ;;
|
2) shell="zsh" ;;
|
||||||
*) echo "Invalid choice, using fish"; shell="fish" ;;
|
*) echo "Invalid choice, using fish"; shell="fish" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Terminal selection
|
# Terminal selection
|
||||||
@@ -41,9 +57,9 @@ wizard_update_preferences() {
|
|||||||
read -p "Enter choice [1-2]: " terminal_choice
|
read -p "Enter choice [1-2]: " terminal_choice
|
||||||
|
|
||||||
case "$terminal_choice" in
|
case "$terminal_choice" in
|
||||||
1|"") terminal="kitty" ;;
|
1|"") terminal="kitty" ;;
|
||||||
2) terminal="foot" ;;
|
2) terminal="foot" ;;
|
||||||
*) echo "Invalid choice, using kitty"; terminal="kitty" ;;
|
*) echo "Invalid choice, using kitty"; terminal="kitty" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Keybindings selection
|
# Keybindings selection
|
||||||
@@ -54,9 +70,9 @@ wizard_update_preferences() {
|
|||||||
read -p "Enter choice [1-2]: " keybind_choice
|
read -p "Enter choice [1-2]: " keybind_choice
|
||||||
|
|
||||||
case "$keybind_choice" in
|
case "$keybind_choice" in
|
||||||
1|"") keybindings="default" ;;
|
1|"") keybindings="default" ;;
|
||||||
2) keybindings="vim" ;;
|
2) keybindings="vim" ;;
|
||||||
*) echo "Invalid choice, using default"; keybindings="default" ;;
|
*) echo "Invalid choice, using default"; keybindings="default" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Update YAML in-place
|
# Update YAML in-place
|
||||||
@@ -66,17 +82,17 @@ wizard_update_preferences() {
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Preferences updated!"
|
echo "Preferences updated!"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get user preference
|
# Get user preference
|
||||||
get_pref() {
|
get_pref() {
|
||||||
yq -r ".user_preferences.$1" "$CONFIG_FILE"
|
yq -r ".user_preferences.$1" "$CONFIG_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if pattern should be processed based on user preferences
|
# Check if pattern should be processed based on user preferences
|
||||||
should_process_pattern() {
|
should_process_pattern() {
|
||||||
local pattern="$1"
|
local pattern="$1"
|
||||||
local condition=$(echo "$pattern" | yq '.condition // "true"')
|
local condition=$(echo "$pattern" | yq '.condition // "true"')
|
||||||
|
|
||||||
# If no condition or condition is "true", always process
|
# If no condition or condition is "true", always process
|
||||||
if [[ "$condition" == "true" ]]; then
|
if [[ "$condition" == "true" ]]; then
|
||||||
@@ -89,46 +105,46 @@ should_process_pattern() {
|
|||||||
|
|
||||||
[[ "$(get_pref "$type")" == "$value" ]]
|
[[ "$(get_pref "$type")" == "$value" ]]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compare hashes of files/directories, return true if they are the same, false otherwise
|
# Compare hashes of files/directories, return true if they are the same, false otherwise
|
||||||
files_are_same() {
|
files_are_same() {
|
||||||
local path1="$1"
|
local path1="$1"
|
||||||
local path2="$2"
|
local path2="$2"
|
||||||
|
|
||||||
# Check if paths exist
|
# Check if paths exist
|
||||||
if [[ ! -e "$path1" || ! -e "$path2" ]]; then
|
if [[ ! -e "$path1" || ! -e "$path2" ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For directories, use find + md5sum to compare recursively
|
# For directories, use find + md5sum to compare recursively
|
||||||
# For files, use md5sum directly
|
# For files, use md5sum directly
|
||||||
if [[ -d "$path1" && -d "$path2" ]]; then
|
if [[ -d "$path1" && -d "$path2" ]]; then
|
||||||
# Compare directory contents using find and md5sum
|
# Compare directory contents using find and md5sum
|
||||||
local hash1=$(find "$path1" -type f -exec md5sum {} \; | sort -k 2 | md5sum | awk '{print $1}')
|
local hash1=$(find "$path1" -type f -exec md5sum {} \; | sort -k 2 | md5sum | awk '{print $1}')
|
||||||
local hash2=$(find "$path2" -type f -exec md5sum {} \; | sort -k 2 | md5sum | awk '{print $1}')
|
local hash2=$(find "$path2" -type f -exec md5sum {} \; | sort -k 2 | md5sum | awk '{print $1}')
|
||||||
[[ "$hash1" == "$hash2" ]]
|
[[ "$hash1" == "$hash2" ]]
|
||||||
elif [[ -f "$path1" && -f "$path2" ]]; then
|
elif [[ -f "$path1" && -f "$path2" ]]; then
|
||||||
# Compare file hashes
|
# Compare file hashes
|
||||||
local hash1=$(md5sum "$path1" | awk '{print $1}')
|
local hash1=$(md5sum "$path1" | awk '{print $1}')
|
||||||
local hash2=$(md5sum "$path2" | awk '{print $1}')
|
local hash2=$(md5sum "$path2" | awk '{print $1}')
|
||||||
[[ "$hash1" == "$hash2" ]]
|
[[ "$hash1" == "$hash2" ]]
|
||||||
else
|
else
|
||||||
# One is a file, one is a directory - different types
|
# One is a file, one is a directory - different types
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find next backup number
|
# Find next backup number
|
||||||
get_next_backup_number() {
|
get_next_backup_number() {
|
||||||
local base_path="$1"
|
local base_path="$1"
|
||||||
local counter=1
|
local counter=1
|
||||||
|
|
||||||
while [[ -e "${base_path}.old.${counter}" ]]; do
|
while [[ -e "${base_path}.old.${counter}" ]]; do
|
||||||
((counter++))
|
((counter++))
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $counter
|
echo $counter
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -146,118 +162,116 @@ readarray patterns < <(yq -o=j -I=0 '.patterns[]' "$CONFIG_FILE")
|
|||||||
|
|
||||||
# Process each pattern
|
# Process each pattern
|
||||||
for pattern in "${patterns[@]}"; do
|
for pattern in "${patterns[@]}"; do
|
||||||
from=$(echo "$pattern" | yq '.from' - | envsubst)
|
from=$(echo "$pattern" | yq '.from' - | envsubst)
|
||||||
to=$(echo "$pattern" | yq '.to' - | envsubst)
|
to=$(echo "$pattern" | yq '.to' - | envsubst)
|
||||||
mode=$(echo "$pattern" | yq '.mode' - | envsubst)
|
mode=$(echo "$pattern" | yq '.mode' - | envsubst)
|
||||||
condition=$(echo "$pattern" | yq '.condition // "true"')
|
condition=$(echo "$pattern" | yq '.condition // "true"')
|
||||||
|
|
||||||
# Handle fontconfig fontset override
|
# Handle fontconfig fontset override
|
||||||
# If FONTSET_DIR_NAME is set and this is the fontconfig pattern, use the fontset instead
|
# If FONTSET_DIR_NAME is set and this is the fontconfig pattern, use the fontset instead
|
||||||
if [[ "$from" == "dots/.config/fontconfig" ]] && [[ -n "${FONTSET_DIR_NAME:-}" ]]; then
|
if [[ "$from" == "dots/.config/fontconfig" ]] && [[ -n "${FONTSET_DIR_NAME:-}" ]]; then
|
||||||
from="dots-extra/fontsets/${FONTSET_DIR_NAME}"
|
from="dots-extra/fontsets/${FONTSET_DIR_NAME}"
|
||||||
echo "Using fontset \"${FONTSET_DIR_NAME}\" for fontconfig"
|
echo "Using fontset \"${FONTSET_DIR_NAME}\" for fontconfig"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if pattern should be processed
|
||||||
|
if ! should_process_pattern "$pattern"; then
|
||||||
|
# Format condition message nicely
|
||||||
|
if [[ "$condition" != "true" ]]; then
|
||||||
|
cond_type=$(echo "$condition" | yq -r '.type // ""')
|
||||||
|
cond_value=$(echo "$condition" | yq -r '.value // ""')
|
||||||
|
if [[ -n "$cond_type" && -n "$cond_value" ]]; then
|
||||||
|
echo "Skipping $from -> $to (condition not met: $cond_type == '$cond_value')"
|
||||||
|
else
|
||||||
|
echo "Skipping $from -> $to (condition not met)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Skipping $from -> $to (condition not met)"
|
||||||
fi
|
fi
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if pattern should be processed
|
echo "Processing: $from -> $to (mode: $mode)"
|
||||||
if ! should_process_pattern "$pattern"; then
|
|
||||||
# Format condition message nicely
|
# Build exclude arguments for rsync
|
||||||
if [[ "$condition" != "true" ]]; then
|
excludes=()
|
||||||
cond_type=$(echo "$condition" | yq -r '.type // ""')
|
if echo "$pattern" | yq -e '.excludes' >/dev/null 2>&1; then
|
||||||
cond_value=$(echo "$condition" | yq -r '.value // ""')
|
while IFS= read -r exclude; do
|
||||||
if [[ -n "$cond_type" && -n "$cond_value" ]]; then
|
excludes+=(--exclude "$exclude")
|
||||||
echo "Skipping $from -> $to (condition not met: $cond_type == '$cond_value')"
|
done < <(echo "$pattern" | yq -r '.excludes[]')
|
||||||
else
|
fi
|
||||||
echo "Skipping $from -> $to (condition not met)"
|
|
||||||
fi
|
# Check if source exists
|
||||||
|
if [[ ! -e "$from" ]]; then
|
||||||
|
echo "Warning: Source does not exist: $from (skipping)"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure destination directory exists for files
|
||||||
|
if [[ -f "$from" ]]; then
|
||||||
|
v mkdir -p "$(dirname "$to")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Execute based on mode
|
||||||
|
case $mode in
|
||||||
|
"sync")
|
||||||
|
if [[ -d "$from" ]]; then
|
||||||
|
warning_rsync_delete
|
||||||
|
v rsync -av --delete "${excludes[@]}" "$from/" "$to/"
|
||||||
|
else
|
||||||
|
warning_rsync_normal
|
||||||
|
# For files, don't use trailing slash and don't use --delete
|
||||||
|
v rsync -av "${excludes[@]}" "$from" "$to"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"soft")
|
||||||
|
warning_rsync_normal
|
||||||
|
if [[ -d "$from" ]]; then
|
||||||
|
v rsync -av "${excludes[@]}" "$from/" "$to/"
|
||||||
|
else
|
||||||
|
# For files, don't use trailing slash
|
||||||
|
v rsync -av "${excludes[@]}" "$from" "$to"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"hard")
|
||||||
|
v cp -r "$from" "$to"
|
||||||
|
;;
|
||||||
|
"hard-backup")
|
||||||
|
if [[ -e "$to" ]]; then
|
||||||
|
if files_are_same "$from" "$to"; then
|
||||||
|
echo "Files are identical, skipping backup"
|
||||||
else
|
else
|
||||||
echo "Skipping $from -> $to (condition not met)"
|
backup_number=$(get_next_backup_number "$to")
|
||||||
|
v mv "$to" "$to.old.$backup_number"
|
||||||
|
v cp -r "$from" "$to"
|
||||||
fi
|
fi
|
||||||
continue
|
else
|
||||||
fi
|
v cp -r "$from" "$to"
|
||||||
|
fi
|
||||||
echo "Processing: $from -> $to (mode: $mode)"
|
;;
|
||||||
|
"soft-backup")
|
||||||
# Build exclude arguments for rsync
|
if [[ -e "$to" ]]; then
|
||||||
excludes=()
|
if files_are_same "$from" "$to"; then
|
||||||
if echo "$pattern" | yq -e '.excludes' >/dev/null 2>&1; then
|
echo "Files are identical, skipping backup"
|
||||||
while IFS= read -r exclude; do
|
else
|
||||||
excludes+=(--exclude "$exclude")
|
v cp -r "$from" "$to.new"
|
||||||
done < <(echo "$pattern" | yq -r '.excludes[]')
|
fi
|
||||||
fi
|
else
|
||||||
|
v cp -r "$from" "$to"
|
||||||
# Check if source exists
|
fi
|
||||||
if [[ ! -e "$from" ]]; then
|
;;
|
||||||
echo "Warning: Source does not exist: $from (skipping)"
|
"skip")
|
||||||
continue
|
echo "Skipping $from"
|
||||||
fi
|
;;
|
||||||
|
"skip-if-exists")
|
||||||
# Ensure destination directory exists for files
|
if [[ -e "$to" ]]; then
|
||||||
if [[ -f "$from" ]]; then
|
echo "Skipping $from (destination exists)"
|
||||||
v mkdir -p "$(dirname "$to")"
|
else
|
||||||
fi
|
v cp -r "$from" "$to"
|
||||||
|
fi
|
||||||
# Execute based on mode
|
;;
|
||||||
case $mode in
|
*)
|
||||||
"sync")
|
echo "Unknown mode: $mode"
|
||||||
if [[ -d "$from" ]]; then
|
;;
|
||||||
warning_rsync_delete
|
esac
|
||||||
v rsync -av --delete "${excludes[@]}" "$from/" "$to/"
|
|
||||||
else
|
|
||||||
warning_rsync_normal
|
|
||||||
# For files, don't use trailing slash and don't use --delete
|
|
||||||
v rsync -av "${excludes[@]}" "$from" "$to"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"soft")
|
|
||||||
warning_rsync_normal
|
|
||||||
if [[ -d "$from" ]]; then
|
|
||||||
v rsync -av "${excludes[@]}" "$from/" "$to/"
|
|
||||||
else
|
|
||||||
# For files, don't use trailing slash
|
|
||||||
v rsync -av "${excludes[@]}" "$from" "$to"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"hard")
|
|
||||||
v cp -r "$from" "$to"
|
|
||||||
;;
|
|
||||||
"hard-backup")
|
|
||||||
if [[ -e "$to" ]]; then
|
|
||||||
if files_are_same "$from" "$to"; then
|
|
||||||
echo "Files are identical, skipping backup"
|
|
||||||
else
|
|
||||||
backup_number=$(get_next_backup_number "$to")
|
|
||||||
v mv "$to" "$to.old.$backup_number"
|
|
||||||
v cp -r "$from" "$to"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
v cp -r "$from" "$to"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"soft-backup")
|
|
||||||
if [[ -e "$to" ]]; then
|
|
||||||
if files_are_same "$from" "$to"; then
|
|
||||||
echo "Files are identical, skipping backup"
|
|
||||||
else
|
|
||||||
v cp -r "$from" "$to.new"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
v cp -r "$from" "$to"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"skip")
|
|
||||||
echo "Skipping $from"
|
|
||||||
;;
|
|
||||||
"skip-if-exists")
|
|
||||||
if [[ -e "$to" ]]; then
|
|
||||||
echo "Skipping $from (destination exists)"
|
|
||||||
else
|
|
||||||
v cp -r "$from" "$to"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown mode: $mode"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
|
|
||||||
#####################################################################################
|
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
# The possible values of `mode`: (by default `sync`)
|
||||||
|
# - `sync`: Make the destination completely the same as the source.
|
||||||
|
# - `soft`: Skip existing files when copying
|
||||||
|
# - `hard`: Overwrite existing files when copying
|
||||||
|
# - `soft-backup`: If target file exists, copy source file to `*.new`. Do not create `*.new` but skip coyping when source and target HASH values are exactly the same.
|
||||||
|
# - `hard-backup`: If target file exists, create backup by renaming it to `*.old.<n>` where `<n>` is a number increment from 1 to prevent backup gets overwritten when running twice. (Keep in mind that this script must be idempotent.) Also must compare the actual file content by using MD5 HASH value to prevent generating lots of `*.old.<n>`s when runnng multiple times. Do not create backup but skip coyping when source and target HASH values are exactly the same.
|
||||||
|
# - `skip`: Skip this step
|
||||||
|
# - `skip-if-exists`: Skip this step if target exists
|
||||||
version: "1.0"
|
version: "1.0"
|
||||||
user_preferences:
|
user_preferences:
|
||||||
shell: "fish" # fish | zsh
|
shell: "fish" # fish | zsh
|
||||||
@@ -22,7 +22,7 @@ function auto_backup_configs(){
|
|||||||
false) if [[ ! -d "$BACKUP_DIR" ]]; then local backup=true;fi;;
|
false) if [[ ! -d "$BACKUP_DIR" ]]; then local backup=true;fi;;
|
||||||
*)
|
*)
|
||||||
printf "${STY_RED}"
|
printf "${STY_RED}"
|
||||||
printf "Would you like to backup clashing dirs/files to \"$BACKUP_DIR\"?"
|
printf "Would you like to backup clashing dirs/files to \"$BACKUP_DIR\"?\n"
|
||||||
printf "${STY_RST}"
|
printf "${STY_RST}"
|
||||||
while true;do
|
while true;do
|
||||||
echo " y = Yes, backup"
|
echo " y = Yes, backup"
|
||||||
@@ -33,7 +33,7 @@ function auto_backup_configs(){
|
|||||||
local backup=true;break ;;
|
local backup=true;break ;;
|
||||||
[nNsS]) echo -e "${STY_BLUE}Alright, skipping...${STY_RST}"
|
[nNsS]) echo -e "${STY_BLUE}Alright, skipping...${STY_RST}"
|
||||||
local backup=false;break ;;
|
local backup=false;break ;;
|
||||||
*) echo -e "${STY_RED}Please enter [y/n].${STY_RST}";;
|
*) echo -e "${STY_RED}Please enter [y/n/s].${STY_RST}";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
@@ -46,8 +46,8 @@ function auto_backup_configs(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
showfun auto_get_git_submodule
|
showfun auto_update_git_submodule
|
||||||
v auto_get_git_submodule
|
v auto_update_git_submodule
|
||||||
|
|
||||||
# Backup
|
# Backup
|
||||||
if [[ ! "${SKIP_BACKUP}" == true ]]; then auto_backup_configs; fi
|
if [[ ! "${SKIP_BACKUP}" == true ]]; then auto_backup_configs; fi
|
||||||
|
|||||||
@@ -27,12 +27,13 @@ Options for install:
|
|||||||
Possible values of <set>: $(ls -A ${REPO_ROOT}/dots-extra/fontsets)
|
Possible values of <set>: $(ls -A ${REPO_ROOT}/dots-extra/fontsets)
|
||||||
${STY_CYAN}
|
${STY_CYAN}
|
||||||
New features (experimental):
|
New features (experimental):
|
||||||
--exp-files Use yaml-based config for the third step copying files.
|
--exp-files Use yaml-based config for the third step copying files.
|
||||||
This feature is ${STY_YELLOW}still on early stage${STY_CYAN}, feedback and contribution welcomed,
|
This feature is ${STY_YELLOW}still on early stage${STY_CYAN},
|
||||||
see https://github.com/end-4/dots-hyprland/issues/2137 for details.
|
feedback and contribution welcomed,
|
||||||
--via-nix Use Nix and Home-manager to install dependencies.
|
see https://github.com/end-4/dots-hyprland/issues/2137 for details.
|
||||||
This feature is ${STY_RED}working in progress${STY_CYAN}. Contribution is welcomed,
|
--via-nix Use Nix and Home-manager to install dependencies.
|
||||||
see https://github.com/end-4/dots-hyprland/issues/1061 for details.
|
This feature is ${STY_RED}working in progress${STY_CYAN}. Contribution is welcomed,
|
||||||
|
see https://github.com/end-4/dots-hyprland/issues/1061 for details.
|
||||||
${STY_RST}"
|
${STY_RST}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Syntax:
|
|||||||
|
|
||||||
Subcommands:
|
Subcommands:
|
||||||
install (Re)Install/Update illogical-impulse.
|
install (Re)Install/Update illogical-impulse.
|
||||||
|
Note: To update to the latest, manually run \"git pull\" first.
|
||||||
install-deps Run the install step \"1. Install dependencies\"
|
install-deps Run the install step \"1. Install dependencies\"
|
||||||
install-setups Run the install step \"2. Setup for permissions/services etc\"
|
install-setups Run the install step \"2. Setup for permissions/services etc\"
|
||||||
install-files Run the install step \"3. Copying config files\"
|
install-files Run the install step \"3. Copying config files\"
|
||||||
@@ -36,6 +37,8 @@ Subcommands:
|
|||||||
|
|
||||||
For each <subcommand>, use -h for details:
|
For each <subcommand>, use -h for details:
|
||||||
$0 <subcommand> -h
|
$0 <subcommand> -h
|
||||||
|
|
||||||
|
${STY_BOLD}${STY_CYAN}Access ${STY_UNDERLINE}https://ii.clsty.link${STY_RST} ${STY_BOLD}${STY_CYAN}for documentation about illogical-impulse.${STY_RST}
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|||||||
Reference in New Issue
Block a user