fix(rofi): normal sorter for fuzzy search + power-profile icons
All checks were successful
Check / eval (push) Successful in 3m8s

Two rofi fixes:

- Search (item 31): rofi 2.0.0's fzf sorter mis-ranks fuzzy matches —
  typing "steam" left ghostty selected instead of Steam. Bernardo's live
  A/B confirmed `-sorting-method normal` and `-matching normal` both fix
  it while `-no-sort` does not. Switch sorting-method fzf → normal, keep
  matching=fuzzy + case-sensitive=false.

- Power profile menu (item 39): list profiles with per-profile icons from
  Papirus' colored battery-profile-{performance,balanced,powersave} family
  (the -symbolic variants are #444 grey, invisible on dark). Row text
  stays the bare profile name so `powerprofilesctl set` is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 21:51:07 +01:00
parent cd5d3b51e2
commit 926be22fd4
4 changed files with 53 additions and 28 deletions

View File

@@ -227,8 +227,22 @@ let
exit 0
fi
cur=$(powerprofilesctl get 2>/dev/null)
choice=$( { powerprofilesctl list 2>/dev/null | sed -nE 's/^[* ] ([a-z-]+):$/\1/p'; printf '%s\n' "$BACK"; } \
| rofi -dmenu -p "profile (now: $cur)") || exit 0
# Each profile gets its themed icon from Papirus' colored
# battery-profile-* family (the -symbolic variants are #444 grey and
# vanish on dark themes). The selected row's returned text is still
# the bare profile name, so `powerprofilesctl set` is unaffected.
choice=$( {
powerprofilesctl list 2>/dev/null | sed -nE 's/^[* ] ([a-z-]+):$/\1/p' \
| while IFS= read -r p; do
case "$p" in
performance) row "$p" battery-profile-performance ;;
balanced) row "$p" battery-profile-balanced ;;
power-saver) row "$p" battery-profile-powersave ;;
*) row "$p" preferences-system-power ;;
esac
done
back
} | rofi -dmenu -show-icons -p "profile (now: $cur)") || exit 0
[ "$choice" = "$BACK" ] && exec "$0" system
[ -n "$choice" ] && powerprofilesctl set "$choice" ;;
@@ -899,13 +913,20 @@ in
# while the app launcher still fills + scrolls past `lines`.
fixed-num-lines = false;
# Search: case-insensitive fuzzy across every menu + the launcher, so
# "system" finds "System" and "fzr" finds "Firefox". fzf sorting ranks
# the closest match to the top (the per-keystroke modules — calc/emoji
# — opt out per-invocation with -no-sort).
# "system" finds "System" and "fzr" finds "Firefox". `normal` sorting
# ranks by match distance so the closest match lands on top (the
# per-keystroke modules — calc/emoji — opt out per-invocation with
# -no-sort).
#
# NOT `fzf`: rofi 2.0.0's fzf sorter mis-ranks with fuzzy matching —
# typing "steam" left ghostty selected on top instead of Steam
# (confirmed on hardware: `-sorting-method normal` and `-matching
# normal` both fixed it, `-no-sort` did not). Keep fuzzy matching for
# forgiveness; use the normal sorter to rank it (item 31).
matching = "fuzzy";
case-sensitive = false;
sort = true;
sorting-method = "fzf";
sorting-method = "normal";
};
# Whole-swap themes bring their own rofi.rasi; otherwise the theme