From 8be178f5a90ec87665ee048e214d2da4571535c5 Mon Sep 17 00:00:00 2001 From: Jas Singh Date: Mon, 2 Jun 2025 02:30:10 -0700 Subject: [PATCH] Feature: Added lazy loading of settings dialog (#983) * Feat: Added configurable lazy loading for the settings dialog. * Allow lazyloading to be configurable --- .../shortcuts/buttons/SettingsButton.tsx | 6 +- src/components/settings/lazyLoader.ts | 91 +++++++++++++++++++ .../settings/pages/config/general/index.tsx | 9 ++ src/configuration/modules/config/index.ts | 1 + src/core/initialization/index.ts | 8 +- .../commands/windowManagement/index.ts | 15 ++- 6 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 src/components/settings/lazyLoader.ts diff --git a/src/components/menus/dashboard/shortcuts/buttons/SettingsButton.tsx b/src/components/menus/dashboard/shortcuts/buttons/SettingsButton.tsx index ab1070b..c74d4e1 100644 --- a/src/components/menus/dashboard/shortcuts/buttons/SettingsButton.tsx +++ b/src/components/menus/dashboard/shortcuts/buttons/SettingsButton.tsx @@ -1,4 +1,5 @@ import { App, Gdk } from 'astal/gtk3'; +import { SettingsDialogLoader } from 'src/components/settings/lazyLoader'; export const SettingsButton = (): JSX.Element => { return ( @@ -6,7 +7,7 @@ export const SettingsButton = (): JSX.Element => { className={'dashboard-button'} tooltipText={'HyprPanel Configuration'} vexpand - onButtonPressEvent={(_, event) => { + onButtonPressEvent={async (_, event) => { const buttonClicked = event.get_button()[1]; if (buttonClicked !== Gdk.BUTTON_PRIMARY) { @@ -14,7 +15,8 @@ export const SettingsButton = (): JSX.Element => { } App.get_window('dashboardmenu')?.set_visible(false); - App.toggle_window('settings-dialog'); + const loader = SettingsDialogLoader.getInstance(); + await loader.toggle(); }} >