Skip to content

Commit

Permalink
feat(Hyde theme import): Added option to select wallpapers wehn impor…
Browse files Browse the repository at this point in the history
…ting a single theme
  • Loading branch information
kRHYME7 committed Sep 3, 2024
1 parent ac30e84 commit a107b98
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Hyde
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ theme() { #? Theme commands
select) #? Theme selector
"${scrDir}"/themeselect.sh
;;
patch) #! Import a theme from different repository.\nﯦ Invoking without args will launch a menu from Hyde-gallery DB
patch) #! Patch a theme from different repository.\nﯦ Invoking without args will launch a menu from Hyde-gallery DB
print_prompt -r "[warn] Command will be deprecated\n Use 'Hyde theme import' instead"
shift
navigate_clone
Expand All @@ -462,6 +462,7 @@ theme() { #? Theme commands
Manage-Themes theme_patcher
else
#! ./themepatcher.sh "${@}" #! This is from the repo,Decided to maintain a separate patcher
export SINGLE_THEME_ONLY=true
Patch-Theme "${@}"
fi
;;
Expand Down
14 changes: 14 additions & 0 deletions Scripts/Fzf-Menu
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ fzf_theme_menu() {

}

#? Wallpaper patch Menu
fzf_select_theme_wallpaper() {
fzf \
--cycle \
--preview '[ {} = "[Confirm]" ] || Fzf-Preview {}' \
-m \
--marker '' \
--pointer='' \
--prompt '[TAB] Select a theme [Esc] Exit | CTRL A : mark all | CTRL D : unmark all: ' \
--bind 'ctrl-a:select-all,ctrl-d:deselect-all' \
--preview-window 'right:60%,border-rounded'

}

#? sddm theme
fzf_sddm_list_arcs() {

Expand Down
10 changes: 9 additions & 1 deletion Scripts/Manage-Themes
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,18 @@ theme_menu() {

theme_patcher() {
generate_theme_list
themeCount="$(wc -l <<< "${patchList}")"
[ ! -f "${themepatcher_lst}" ] && return
# print_prompt -g "[themepatcher]" " Patching the following themes..."
[ "${themeCount}" == 1 ] && export SINGLE_THEME_ONLY=true
print_prompt -g "[themepatcher]" " Patching ${themeCount} theme/s..."
barLine
print_prompt "${patchList}"
barLine
ask_confirm

if [ "${SINGLE_THEME_ONLY}" = true ]; then
eval Patch-Theme "$(cat "${themepatcher_lst}")"
else
while IFS='"' read -r null1 themeName null2 themeRepo; do
themeNameQ+=("${themeName//\"/}")
themeRepoQ+=("${themeRepo//\"/}")
Expand All @@ -167,6 +174,7 @@ theme_patcher() {
print_prompt -r "[ERROR]" " $theme"
fi
done
fi
}

eval "$(declare -F | sed -e 's/-f /-fx /')"
Expand Down
11 changes: 10 additions & 1 deletion Scripts/Patch-Theme
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ Note:
HELP
}


select_theme_wallpaper() {
[ "${SINGLE_THEME_ONLY}" = true ] || return
wallpapers="$(find "${Fav_Theme_Dir}" -type f \( -iname "*.gif" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | Fzf-Menu "${FUNCNAME[0]}" )"
print_prompt -g "[wallpapers]"
awk -F "${Fav_Theme_Dir}" '{print $2}' <<< "${wallpapers}"
}

if [[ -z $1 || -z $2 ]]; then
ask_help
exit 1
Expand Down Expand Up @@ -158,8 +166,9 @@ readonly restore_list

# Get Wallpapers
wallpapers=$(find "${Fav_Theme_Dir}" -type f \( -iname "*.gif" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \))
select_theme_wallpaper
wallcount="$(echo "${wallpapers}" | wc -l)"
{ [ -z "${wallpapers}" ] && print_prompt -r "[ERROR] " "No wallpapers found" && exit_flag=true; } || { readonly wallpapers && print_prompt -g "\n[OK] " "wallpapers :: [count] ${wallcount} (.gif+.jpg+.jpeg+.png)"; }
{ [ -z "${wallpapers}" ] && print_prompt -r "[ERROR] " "No wallpapers found/selected" && exit_flag=true; } || { readonly wallpapers && print_prompt -g "\n[OK] " "wallpapers :: [count] ${wallcount} (.gif+.jpg+.jpeg+.png)"; }

# overparsing 😁
check_tars() {
Expand Down

0 comments on commit a107b98

Please sign in to comment.