From 8b41b1d913863ef50da90aa61a20967aeb71662d Mon Sep 17 00:00:00 2001 From: newbieQQ Date: Fri, 1 May 2026 20:38:46 +0800 Subject: [PATCH] update: add support for installing fastfetch via flatpak or package manager Co-authored-by: Copilot --- config/init.zsh | 9 +++++++++ lib/omz.sh | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/config/init.zsh b/config/init.zsh index b3c9f7b..53db1dc 100644 --- a/config/init.zsh +++ b/config/init.zsh @@ -22,6 +22,15 @@ _omz_run_install_steps() { _omz_install_fd || failed=1 _omz_install_fzf || failed=1 + # fastfetch is a useful dependency (preview/status); try to install + if _omz_has_cmd fastfetch; then :; else + # prefer flatpak when available + if _omz_should_prefer_flatpak && _omz_has_cmd flatpak; then + _omz_install_with_flatpak fastfetch || _omz_install_with_pkg_manager fastfetch || true + else + _omz_install_with_pkg_manager fastfetch || true + fi + fi _omz_install_lua || failed=1 _omz_install_conda || failed=1 diff --git a/lib/omz.sh b/lib/omz.sh index d4fffaa..64a9d88 100644 --- a/lib/omz.sh +++ b/lib/omz.sh @@ -74,6 +74,9 @@ _omz_get_flatpak_app_id() { lua|lua5.4) echo "${_OMZ_FLATPAK_APP_LUA:-org.lua.Lua}" ;; + fastfetch) + echo "${_OMZ_FLATPAK_APP_FASTFETCH:-com.github.dylanaraps.fastfetch}" + ;; *) echo "" ;; @@ -84,6 +87,10 @@ _omz_install_with_flatpak() { local pkg="$1" local app_id + if ! _omz_has_cmd flatpak; then + # try to install flatpak runtime via package manager + _omz_install_with_pkg_manager "flatpak" || return 1 + fi _omz_has_cmd flatpak || return 1 app_id="$(_omz_get_flatpak_app_id "$pkg")" [[ -n "$app_id" ]] || return 1