Skip to content

Commit d0c9ed1

Browse files
committed
zfsbootmenu: fix fzf colors for old systems, round two
1 parent e4c1a0e commit d0c9ed1

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

zfsbootmenu/install-helpers.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,15 @@ create_zbm_conf() {
9999
has_border=1
100100
fi
101101

102+
# Check if fuzzy finder supports optional --color arguments
103+
# Added in fzf 0.52.0
104+
local has_colors
105+
if echo "abc" | fzf -f "abc" --color='current-fg:red,selected-fg:magenta' --exit-0 >/dev/null 2>&1; then
106+
has_colors=1
107+
fi
108+
102109
# Check if fuzzy finder supports --raw flag
103110
# Added in fzf 0.66.0
104-
105111
local has_raw
106112
if echo "abc" | fzf -f "abc" --raw --exit-0 >/dev/null 2>&1; then
107113
has_raw=1
@@ -140,6 +146,7 @@ create_zbm_conf() {
140146
export HAS_DISABLED="${has_disabled}"
141147
export HAS_BORDER="${has_border}"
142148
export HAS_COLUMN="${has_column}"
149+
export HAS_COLORS="${has_colors}"
143150
export HAS_RAW="${has_raw}"
144151
export ZBM_BUILDSTYLE="${ZBM_BUILDSTYLE}"
145152
export ZBM_RELEASE_BUILD="${zfsbootmenu_release_build}"

zfsbootmenu/lib/fzf-defaults.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
# shellcheck disable=SC2016
99
fuzzy_default_options=(
10-
"--ansi" "--no-clear" "--cycle"
10+
"--ansi" "--no-clear" "--cycle" "--color=16"
1111
"--layout=reverse-list" "--inline-info" "--tac"
12-
"--color='16,current-fg:red,selected-fg:magenta'"
1312
"--bind" '"alt-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} 1>/dev/null ]"'
1413
"--bind" '"ctrl-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} 1>/dev/null ]"'
1514
"--bind" '"ctrl-alt-h:execute[ /libexec/zfsbootmenu-help -L ${HELP_SECTION:-main-screen} 1>/dev/null ]"'
@@ -26,13 +25,9 @@ if [ -n "${HAS_BORDER}" ]; then
2625
)
2726
fi
2827

29-
# shellcheck disable=SC2016,SC2086
30-
if [ ${loglevel:-4} -eq 7 ] ; then
28+
if [ -n "${HAS_COLORS}" ]; then
3129
fuzzy_default_options+=(
32-
"--bind" '"alt-t:execute[ /sbin/ztrace > ${control_term} ]"'
33-
"--bind" '"ctrl-t:execute[ /sbin/ztrace > ${control_term} ]"'
34-
"--bind" '"ctrl-alt-t:execute[ /sbin/ztrace > ${control_term} ]"'
35-
"--bind" '"f12:execute[ /libexec/zfunc emergency_shell \"debugging shell\" > ${control_term} ]"'
30+
"--color='current-fg:red,selected-fg:magenta'"
3631
)
3732
fi
3833

@@ -48,6 +43,16 @@ if [ -n "${HAS_RAW}" ] && is_efi_system ; then
4843
)
4944
fi
5045

46+
# shellcheck disable=SC2016,SC2086
47+
if [ ${loglevel:-4} -eq 7 ] ; then
48+
fuzzy_default_options+=(
49+
"--bind" '"alt-t:execute[ /sbin/ztrace > ${control_term} ]"'
50+
"--bind" '"ctrl-t:execute[ /sbin/ztrace > ${control_term} ]"'
51+
"--bind" '"ctrl-alt-t:execute[ /sbin/ztrace > ${control_term} ]"'
52+
"--bind" '"f12:execute[ /libexec/zfunc emergency_shell \"debugging shell\" > ${control_term} ]"'
53+
)
54+
fi
55+
5156
export FUZZYSEL=fzf
5257
export PREVIEW_HEIGHT=2
5358
export FZF_DEFAULT_OPTS="${fuzzy_default_options[*]}"

0 commit comments

Comments
 (0)