diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index 517d1efc..f78c29f7 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -314,6 +314,7 @@ Singleton { property int dankLauncherV2BorderThickness: 2 property string dankLauncherV2BorderColor: "primary" property bool dankLauncherV2ShowFooter: true + property bool dankLauncherV2UnloadOnClose: false property string _legacyWeatherLocation: "New York, NY" property string _legacyWeatherCoordinates: "40.7128,-74.0060" diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index aa347353..9feccf61 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -173,6 +173,7 @@ var SPEC = { dankLauncherV2BorderThickness: { def: 2 }, dankLauncherV2BorderColor: { def: "primary" }, dankLauncherV2ShowFooter: { def: true }, + dankLauncherV2UnloadOnClose: { def: false }, useAutoLocation: { def: false }, weatherEnabled: { def: true }, diff --git a/quickshell/DMSShell.qml b/quickshell/DMSShell.qml index 059e43ab..b0a5feb6 100644 --- a/quickshell/DMSShell.qml +++ b/quickshell/DMSShell.qml @@ -531,6 +531,11 @@ Item { PopoutService.dankLauncherV2Modal = dankLauncherV2Modal; PopoutService._onDankLauncherV2ModalLoaded(); } + + onDialogClosed: { + if (SettingsData.dankLauncherV2UnloadOnClose) + PopoutService.unloadDankLauncherV2(); + } } } diff --git a/quickshell/Modals/DankLauncherV2/Controller.qml b/quickshell/Modals/DankLauncherV2/Controller.qml index 1517612a..1caec144 100644 --- a/quickshell/Modals/DankLauncherV2/Controller.qml +++ b/quickshell/Modals/DankLauncherV2/Controller.qml @@ -47,6 +47,7 @@ Item { sections = []; flatModel = []; selectedItem = null; + _clearModeCache(); } } diff --git a/quickshell/Modals/DankLauncherV2/DankLauncherV2Modal.qml b/quickshell/Modals/DankLauncherV2/DankLauncherV2Modal.qml index 75920ac8..ad401754 100644 --- a/quickshell/Modals/DankLauncherV2/DankLauncherV2Modal.qml +++ b/quickshell/Modals/DankLauncherV2/DankLauncherV2Modal.qml @@ -4,7 +4,6 @@ import Quickshell.Wayland import Quickshell.Hyprland import qs.Common import qs.Services -import qs.Widgets Item { id: root @@ -264,7 +263,7 @@ Item { PanelWindow { id: launcherWindow - visible: root._windowEnabled + visible: root._windowEnabled && (!SettingsData.dankLauncherV2UnloadOnClose || spotlightOpen || isClosing) color: "transparent" exclusionMode: ExclusionMode.Ignore diff --git a/quickshell/Modules/Settings/LauncherTab.qml b/quickshell/Modules/Settings/LauncherTab.qml index 79fbc709..7df07911 100644 --- a/quickshell/Modules/Settings/LauncherTab.qml +++ b/quickshell/Modules/Settings/LauncherTab.qml @@ -415,6 +415,15 @@ Item { onToggled: checked => SettingsData.set("dankLauncherV2ShowFooter", checked) } + SettingsToggleRow { + settingKey: "dankLauncherV2UnloadOnClose" + tags: ["launcher", "unload", "close", "memory", "vram"] + text: I18n.tr("Unload on Close") + description: I18n.tr("Free VRAM/memory when the launcher is closed. May cause a slight delay when reopening.") + checked: SettingsData.dankLauncherV2UnloadOnClose + onToggled: checked => SettingsData.set("dankLauncherV2UnloadOnClose", checked) + } + SettingsToggleRow { settingKey: "dankLauncherV2BorderEnabled" tags: ["launcher", "border", "outline"] diff --git a/quickshell/Services/PopoutService.qml b/quickshell/Services/PopoutService.qml index 162f5545..d14522a1 100644 --- a/quickshell/Services/PopoutService.qml +++ b/quickshell/Services/PopoutService.qml @@ -454,6 +454,13 @@ Singleton { dankLauncherV2Modal?.hide(); } + function unloadDankLauncherV2() { + if (dankLauncherV2ModalLoader) { + dankLauncherV2Modal = null; + dankLauncherV2ModalLoader.active = false; + } + } + function toggleDankLauncherV2() { if (dankLauncherV2Modal) { dankLauncherV2Modal.toggle();