search for effects
i'll keep this and if the owner wants it i'll submit a PR. but i really did this to see if i could.
This commit is contained in:
@@ -189,6 +189,28 @@ export default class BurnMyWindowsPreferences extends ExtensionPreferences {
|
||||
});
|
||||
});
|
||||
|
||||
this._searchEntry = this._builder.get_object("search_entry")
|
||||
this._searchEntry.connect('search-changed', () => {
|
||||
const query = this._searchEntry.get_text().toLowerCase();
|
||||
|
||||
this._effectRows.forEach(er => {
|
||||
if (query === "") {
|
||||
er.show(); // Show all effects if query is empty
|
||||
} else {
|
||||
// Show or hide each effect based on query match
|
||||
const showEffect = er.name.toLowerCase().includes(query);
|
||||
showEffect ? er.show() : er.hide();
|
||||
|
||||
//TODO
|
||||
//maybe add a fuzzy search later
|
||||
/*
|
||||
const showEffect = utils.fuzzyMatch(er.name.toLowerCase(), query.toLowerCase());
|
||||
showEffect ? er.show() : er.hide();
|
||||
*/
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Then add a preferences group for the effect expander rows.
|
||||
const group = this._builder.get_object('effects-group');
|
||||
|
||||
@@ -250,6 +272,8 @@ export default class BurnMyWindowsPreferences extends ExtensionPreferences {
|
||||
row.set_title(effect.getLabel());
|
||||
}
|
||||
|
||||
row.name = effect.getLabel() + effect?.description !== undefined ? effect?.description : "" ;
|
||||
|
||||
// Un-expand any previously expanded effect row. This way we ensure that there
|
||||
// is only one expanded row at any time.
|
||||
if (hasPrefs) {
|
||||
|
||||
Reference in New Issue
Block a user