summaryrefslogtreecommitdiff
path: root/src/hooks
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-11 12:58:16 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-11 12:58:16 -0400
commit4d14bc1086a1ba05acd01d7466749ff3cffba75f (patch)
tree3a4e29c48f2e64bf94a5c52fd51dddcb9687cec0 /src/hooks
parentc7ca9c7ec2660d279f5e6957ef882390a8783667 (diff)
downloaddecky-lsfg-vk-4d14bc1086a1ba05acd01d7466749ff3cffba75f.tar.gz
decky-lsfg-vk-4d14bc1086a1ba05acd01d7466749ff3cffba75f.zip
enable all and disable all for flatpak
Diffstat (limited to 'src/hooks')
-rw-r--r--src/hooks/useFlatpakConfiguration.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/hooks/useFlatpakConfiguration.ts b/src/hooks/useFlatpakConfiguration.ts
index 6ff7a79..f936271 100644
--- a/src/hooks/useFlatpakConfiguration.ts
+++ b/src/hooks/useFlatpakConfiguration.ts
@@ -95,6 +95,27 @@ export function useFlatpakConfiguration(enabled: boolean) {
const removeApp = useCallback(async (appId: string) => (
await operate(appId, () => removeFlatpakApp(appId))
).success, [operate]);
+ const enableAll = useCallback(async (): Promise<void> => {
+ if (busyAppId) return;
+ const available = apps.filter((app) => (
+ !app.enabled && !(app.prepared && !app.owned) && !app.error
+ ));
+ for (const app of available) {
+ const result = await operate(app.app_id, () => enableFlatpakApp(app.app_id), false);
+ if (!result.success) break;
+ }
+ await reload();
+ await pollRunning();
+ }, [apps, busyAppId, operate, pollRunning, reload]);
+ const removeAll = useCallback(async (): Promise<void> => {
+ if (busyAppId) return;
+ for (const app of apps.filter((item) => item.enabled)) {
+ const result = await operate(app.app_id, () => removeFlatpakApp(app.app_id), false);
+ if (!result.success) break;
+ }
+ await reload();
+ await pollRunning();
+ }, [apps, busyAppId, operate, pollRunning, reload]);
const updateConfig = useCallback(
async (appId: string, config: LsfgConfig) => {
const result = await operate(appId, () => updateFlatpakConfig(appId, config), false);
@@ -130,7 +151,9 @@ export function useFlatpakConfiguration(enabled: boolean) {
busyAppId,
reload,
enableApp,
+ enableAll,
removeApp,
+ removeAll,
updateConfig,
updateWorkarounds,
};