mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 11:04:29 +05:00
fix: install mainsail theme to correct folder (fixes #222)
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -377,16 +377,34 @@ function ms_theme_installer_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ms_theme_install() {
|
function ms_theme_install() {
|
||||||
local theme_url=${1} theme_name theme_note
|
read_kiauh_ini "${FUNCNAME[0]}"
|
||||||
theme_name=${2} theme_note=${3}
|
|
||||||
|
|
||||||
local config_folders target_folders=()
|
local theme_url
|
||||||
config_folders=$(find "${KLIPPER_CONFIG}" -mindepth 1 -maxdepth 1 -type d | sort)
|
local theme_name
|
||||||
|
local theme_note
|
||||||
|
theme_url=${1}
|
||||||
|
theme_name=${2}
|
||||||
|
theme_note=${3}
|
||||||
|
|
||||||
### build target folder array
|
local folder_arr
|
||||||
for folder in ${config_folders}; do
|
local folder_names="${multi_instance_names}"
|
||||||
target_folders+=("${folder}")
|
local target_folders=()
|
||||||
done
|
|
||||||
|
IFS=',' read -r -a folder_arr <<< "${folder_names}"
|
||||||
|
|
||||||
|
### build theme target folder array
|
||||||
|
if (( ${#folder_arr[@]} > 1 )); then
|
||||||
|
for folder in "${folder_arr[@]}"; do
|
||||||
|
### instance names/identifier of only numbers need to be prefixed with 'printer_'
|
||||||
|
if [[ ${folder} =~ ^[0-9]+$ ]]; then
|
||||||
|
target_folders+=("${KLIPPER_CONFIG}/printer_${folder}")
|
||||||
|
else
|
||||||
|
target_folders+=("${KLIPPER_CONFIG}/${folder}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
target_folders+=("${KLIPPER_CONFIG}")
|
||||||
|
fi
|
||||||
|
|
||||||
if (( ${#target_folders[@]} > 1 )); then
|
if (( ${#target_folders[@]} > 1 )); then
|
||||||
top_border
|
top_border
|
||||||
@@ -430,7 +448,10 @@ function ms_theme_delete() {
|
|||||||
target_folders+=("${folder}")
|
target_folders+=("${folder}")
|
||||||
done
|
done
|
||||||
|
|
||||||
if (( ${#target_folders[@]} > 0 )); then
|
if (( ${#target_folders[@]} == 0 )); then
|
||||||
|
status_msg "No Themes installed!\n"
|
||||||
|
return
|
||||||
|
elif (( ${#target_folders[@]} > 1 )); then
|
||||||
top_border
|
top_border
|
||||||
echo -e "| Please select the printer you want to remove the |"
|
echo -e "| Please select the printer you want to remove the |"
|
||||||
echo -e "| theme installation from. |"
|
echo -e "| theme installation from. |"
|
||||||
@@ -447,9 +468,6 @@ function ms_theme_delete() {
|
|||||||
[[ ${target} =~ ${re} && ${target} -lt ${#target_folders[@]} ]] && break
|
[[ ${target} =~ ${re} && ${target} -lt ${#target_folders[@]} ]] && break
|
||||||
error_msg "Invalid command!"
|
error_msg "Invalid command!"
|
||||||
done
|
done
|
||||||
else
|
|
||||||
status_msg "No Themes installed!\n"
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status_msg "Removing ${target_folders[${target}]} ..."
|
status_msg "Removing ${target_folders[${target}]} ..."
|
||||||
|
|||||||
Reference in New Issue
Block a user