diff --git a/fastanime/assets/scripts/fzf/preview.template.sh b/fastanime/assets/scripts/fzf/preview.template.sh index 240bc38..58d18c5 100755 --- a/fastanime/assets/scripts/fzf/preview.template.sh +++ b/fastanime/assets/scripts/fzf/preview.template.sh @@ -44,19 +44,19 @@ fzf_preview() { if [ "$IMAGE_RENDERER" = "icat" ] && [ -z "$GHOSTTY_BIN_DIR" ]; then if command -v kitten >/dev/null 2>&1; then - kitten icat --clear --transfer-mode=memory --unicode-placeholder --scale-up --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" + kitten icat --clear --transfer-mode=memory --unicode-placeholder{SCALE_UP} --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" elif command -v icat >/dev/null 2>&1; then - icat --clear --transfer-mode=memory --unicode-placeholder --scale-up --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" + icat --clear --transfer-mode=memory --unicode-placeholder{SCALE_UP} --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" else - kitty icat --clear --transfer-mode=memory --unicode-placeholder --scale-up --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" + kitty icat --clear --transfer-mode=memory --unicode-placeholder{SCALE_UP} --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" fi elif [ -n "$GHOSTTY_BIN_DIR" ]; then dim=$((FZF_PREVIEW_COLUMNS - 1))x${FZF_PREVIEW_LINES} if command -v kitten >/dev/null 2>&1; then - kitten icat --clear --transfer-mode=memory --unicode-placeholder --scale-up --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" + kitten icat --clear --transfer-mode=memory --unicode-placeholder{SCALE_UP} --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" elif command -v icat >/dev/null 2>&1; then - icat --clear --transfer-mode=memory --unicode-placeholder --scale-up --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" + icat --clear --transfer-mode=memory --unicode-placeholder{SCALE_UP} --stdin=no --place="$dim@0x0" "$file" | sed "\$d" | sed "$(printf "\$s/\$/\033[m/")" else chafa -s "$dim" "$file" fi diff --git a/fastanime/cli/utils/preview.py b/fastanime/cli/utils/preview.py index 4304631..e97af6a 100644 --- a/fastanime/cli/utils/preview.py +++ b/fastanime/cli/utils/preview.py @@ -213,6 +213,7 @@ def get_anime_preview( "C_RULE": ansi.get_true_fg(SEPARATOR_COLOR, bold=True), "RESET": ansi.RESET, "PREFIX": "", + "SCALE_UP": " --scale-up" if config.general.preview_scale_up else "", } for key, value in replacements.items(): @@ -270,6 +271,7 @@ def get_episode_preview( "C_RULE": ansi.get_true_fg(SEPARATOR_COLOR, bold=True), "RESET": ansi.RESET, "PREFIX": f"{media_item.title.english}_Episode_", + "SCALE_UP": " --scale-up" if config.general.preview_scale_up else "", } for key, value in replacements.items(): @@ -323,6 +325,7 @@ def get_dynamic_anime_preview(config: AppConfig) -> str: "C_VALUE": ansi.get_true_fg(HEADER_COLOR, bold=True), "C_RULE": ansi.get_true_fg(SEPARATOR_COLOR, bold=True), "RESET": ansi.RESET, + "SCALE_UP": " --scale-up" if config.general.preview_scale_up else "", } for key, value in replacements.items(): diff --git a/fastanime/core/config/defaults.py b/fastanime/core/config/defaults.py index 29910d7..e90822f 100644 --- a/fastanime/core/config/defaults.py +++ b/fastanime/core/config/defaults.py @@ -11,6 +11,7 @@ GENERAL_SELECTOR = lambda: "fzf" if detect.has_fzf() else "default" GENERAL_AUTO_SELECT_ANIME_RESULT = True GENERAL_ICONS = True GENERAL_PREVIEW = lambda: "full" if detect.is_running_kitty_terminal() else "none" +GENERAL_SCALE_PREVIEW = True GENERAL_IMAGE_RENDERER = ( lambda: "icat" if detect.is_running_kitty_terminal() else "chafa" ) diff --git a/fastanime/core/config/descriptions.py b/fastanime/core/config/descriptions.py index 795d684..47ef94d 100644 --- a/fastanime/core/config/descriptions.py +++ b/fastanime/core/config/descriptions.py @@ -14,6 +14,11 @@ GENERAL_AUTO_SELECT_ANIME_RESULT = ( ) GENERAL_ICONS = "Display emoji icons in the user interface." GENERAL_PREVIEW = "Type of preview to display in selectors." +GENERAL_SCALE_PREVIEW = ( + "Whether to scale up images rendered with icat to fill the preview area. " + "When using the 'full' preview type in a landscape window, enabling this may reduce " + "the amount of text information displayed." +) GENERAL_IMAGE_RENDERER = ( "The command-line tool to use for rendering images in the terminal." ) diff --git a/fastanime/core/config/model.py b/fastanime/core/config/model.py index 0a86030..70156f8 100644 --- a/fastanime/core/config/model.py +++ b/fastanime/core/config/model.py @@ -119,6 +119,11 @@ class GeneralConfig(BaseModel): default_factory=defaults.GENERAL_PREVIEW, description=desc.GENERAL_PREVIEW, ) + preview_scale_up: bool = Field( + default=defaults.GENERAL_SCALE_PREVIEW, + description=desc.GENERAL_SCALE_PREVIEW, + ) + image_renderer: Literal["icat", "chafa", "imgcat"] = Field( default_factory=defaults.GENERAL_IMAGE_RENDERER, description=desc.GENERAL_IMAGE_RENDERER,