* launcher: add favorite apps Favorite apps always appear above non-favorite apps Accepts regex, same logic as #920 Added the same regex logic to hidden apps Added util file may need to be relocated * addressed requested changes * fix: Renamed newly added util singleton Also added a null check to favorite icon loader in AppItem.qml * controlCenter/launcherPane: added favorite apps added icons to the app list to indicate if they are favorited/hidden marking as favorite/hidden is desabled if the other is selected * favouriteApps: renamed from favorite to favourite Also disabled favorite/hidden switch for entries added as regex * appDb: added notify and emit to favoriteApps * controlCentre/Launcher: Fixed bug with favourite switch not enabling itself when no hiddenApps exist Added a comment to explain the enabled state of the switches icon loader is now a single loader rather than two, hidden icon has priority * spelling mistakes * fixed warning * formatting fixes
20 lines
526 B
QML
20 lines
526 B
QML
pragma Singleton
|
|
|
|
import Quickshell
|
|
|
|
Singleton {
|
|
function testRegexList(filterList: list<string>, target: string): bool {
|
|
const regexChecker = /^\^.*\$$/;
|
|
for (const filter of filterList) {
|
|
// If filter is a regex
|
|
if (regexChecker.test(filter)) {
|
|
if ((new RegExp(filter)).test(target))
|
|
return true;
|
|
} else {
|
|
if (filter === target)
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|