From d2d8b4e25afad36434fa22d17ef30bb212b56bc4 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Mon, 28 Oct 2024 18:30:38 -0400 Subject: [PATCH] feat(agsV2): use async fzf --- nixosModules/ags/v2/widgets/misc/sorted-list.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/nixosModules/ags/v2/widgets/misc/sorted-list.tsx b/nixosModules/ags/v2/widgets/misc/sorted-list.tsx index d46397fa..fd207ebe 100644 --- a/nixosModules/ags/v2/widgets/misc/sorted-list.tsx +++ b/nixosModules/ags/v2/widgets/misc/sorted-list.tsx @@ -4,7 +4,7 @@ import { Astal, Gtk, Widget } from 'astal/gtk3'; import { idle } from 'astal'; -import { Fzf, FzfOptions, FzfResultItem } from 'fzf'; +import { AsyncFzf, FzfOptions, FzfResultItem } from 'fzf'; import PopupWindow, { PopupWindow as PopupWindowClass } from '../misc/popup-window'; import { centerCursor } from '../../lib'; @@ -71,12 +71,16 @@ export class SortedList { const on_text_change = (text: string) => { // @ts-expect-error this should be okay - this.fzf_results = (new Fzf(this.item_list, this.fzf_options)).find(text); - list.invalidate_sort(); + (new AsyncFzf(this.item_list, this.fzf_options)).find(text) + .then((out) => { + this.fzf_results = out; + list.invalidate_sort(); - const visibleApplications = list.get_children().filter((row) => row.visible).length; + const visibleApplications = list.get_children().filter((row) => row.visible).length; - placeholder.reveal_child = visibleApplications <= 0; + placeholder.reveal_child = visibleApplications <= 0; + }) + .catch(() => { /**/ }); }; const entry = (