From d5f112e4186845c8c5e63ef3acdf5a54b7c5557e Mon Sep 17 00:00:00 2001 From: Jas Singh Date: Thu, 7 Nov 2024 21:35:49 -0800 Subject: [PATCH] Made the settings menu significantly more responsive. (#454) --- widget/settings/SettingsDialog.ts | 52 +++++++-------- widget/settings/pages/config/index.ts | 66 +++++++++--------- widget/settings/pages/theme/index.ts | 96 +++++++++++++-------------- 3 files changed, 106 insertions(+), 108 deletions(-) diff --git a/widget/settings/SettingsDialog.ts b/widget/settings/SettingsDialog.ts index 8d8cc23..83c337b 100644 --- a/widget/settings/SettingsDialog.ts +++ b/widget/settings/SettingsDialog.ts @@ -39,33 +39,33 @@ const PageContainer = (): GBox => { hpack: 'fill', hexpand: true, vertical: true, - children: CurrentPage.bind('value').as((v) => { - return [ - Widget.Box({ - class_name: 'option-pages-container', - hpack: 'center', - hexpand: true, - children: pagerMap.map((page) => { - return Widget.Button({ - xalign: 0, - hpack: 'center', - class_name: `pager-button ${v === page ? 'active' : ''} category`, - label: page, - on_primary_click: () => (CurrentPage.value = page), - }); - }), + children: [ + Widget.Box({ + class_name: 'option-pages-container', + hpack: 'center', + hexpand: true, + children: pagerMap.map((page) => { + return Widget.Button({ + xalign: 0, + hpack: 'center', + class_name: CurrentPage.bind('value').as( + (v) => `pager-button ${v === page ? 'active' : ''} category`, + ), + label: page, + on_primary_click: () => (CurrentPage.value = page), + }); }), - Widget.Stack({ - vexpand: false, - class_name: 'themes-menu-stack', - children: { - Configuration: SettingsMenu(), - Theming: ThemesMenu(), - }, - shown: CurrentPage.bind('value'), - }), - ]; - }), + }), + Widget.Stack({ + vexpand: false, + class_name: 'themes-menu-stack', + children: { + Configuration: SettingsMenu(), + Theming: ThemesMenu(), + }, + shown: CurrentPage.bind('value'), + }), + ], }); }; diff --git a/widget/settings/pages/config/index.ts b/widget/settings/pages/config/index.ts index b5686a2..eb9892c 100644 --- a/widget/settings/pages/config/index.ts +++ b/widget/settings/pages/config/index.ts @@ -43,40 +43,38 @@ const pagerMap: Page[] = [ export const SettingsMenu = (): GBox => { return Widget.Box({ vertical: true, - children: CurrentPage.bind('value').as((v) => { - return [ - Widget.Box({ - class_name: 'option-pages-container', - hpack: 'center', - hexpand: true, - children: pagerMap.map((page) => { - return Widget.Button({ - hpack: 'center', - class_name: `pager-button ${v === page ? 'active' : ''}`, - label: page, - on_primary_click: () => (CurrentPage.value = page), - }); - }), + children: [ + Widget.Box({ + class_name: 'option-pages-container', + hpack: 'center', + hexpand: true, + children: pagerMap.map((page) => { + return Widget.Button({ + hpack: 'center', + class_name: CurrentPage.bind('value').as((v) => `pager-button ${v === page ? 'active' : ''}`), + label: page, + on_primary_click: () => (CurrentPage.value = page), + }); }), - Widget.Stack({ - vexpand: true, - class_name: 'themes-menu-stack', - children: { - General: BarGeneral(), - Bar: BarSettings(), - 'Media Menu': MediaMenuSettings(), - Notifications: NotificationSettings(), - OSD: OSDSettings(), - Volume: VolumeMenuSettings(), - 'Clock Menu': ClockMenuSettings(), - 'Dashboard Menu': DashboardMenuSettings(), - 'Custom Modules': CustomModuleSettings(), - 'Bluetooth Menu': BluetoothMenuSettings(), - 'Power Menu': PowerMenuSettings(), - }, - shown: CurrentPage.bind('value'), - }), - ]; - }), + }), + Widget.Stack({ + vexpand: true, + class_name: 'themes-menu-stack', + children: { + General: BarGeneral(), + Bar: BarSettings(), + 'Media Menu': MediaMenuSettings(), + Notifications: NotificationSettings(), + OSD: OSDSettings(), + Volume: VolumeMenuSettings(), + 'Clock Menu': ClockMenuSettings(), + 'Dashboard Menu': DashboardMenuSettings(), + 'Custom Modules': CustomModuleSettings(), + 'Bluetooth Menu': BluetoothMenuSettings(), + 'Power Menu': PowerMenuSettings(), + }, + shown: CurrentPage.bind('value'), + }), + ], }); }; diff --git a/widget/settings/pages/theme/index.ts b/widget/settings/pages/theme/index.ts index 0f09cc5..280419c 100644 --- a/widget/settings/pages/theme/index.ts +++ b/widget/settings/pages/theme/index.ts @@ -58,54 +58,54 @@ const pagerMap: Page[] = [ export const ThemesMenu = (): GBox => { return Widget.Box({ vertical: true, - children: CurrentPage.bind('value').as((v) => { - return [ - Widget.Box({ - class_name: 'option-pages-container', - hpack: 'center', - hexpand: true, - vertical: true, - children: [0, 1, 2].map((section) => { - return Widget.Box({ - children: pagerMap.map((page, index) => { - if (index >= section * 6 && index < section * 6 + 6) { - return Widget.Button({ - hpack: 'center', - xalign: 0, - class_name: `pager-button ${v === page ? 'active' : ''}`, - label: page, - on_primary_click: () => (CurrentPage.value = page), - }); - } - return Widget.Box(); - }), - }); - }), + children: [ + Widget.Box({ + class_name: 'option-pages-container', + hpack: 'center', + hexpand: true, + vertical: true, + children: [0, 1, 2].map((section) => { + return Widget.Box({ + children: pagerMap.map((page, index) => { + if (index >= section * 6 && index < section * 6 + 6) { + return Widget.Button({ + hpack: 'center', + xalign: 0, + class_name: CurrentPage.bind('value').as( + (v) => `pager-button ${v === page ? 'active' : ''}`, + ), + label: page, + on_primary_click: () => (CurrentPage.value = page), + }); + } + return Widget.Box(); + }), + }); }), - Widget.Stack({ - vexpand: true, - class_name: 'themes-menu-stack', - children: { - 'General Settings': MenuTheme(), - 'Matugen Settings': Matugen(), - Bar: BarTheme(), - Notifications: NotificationsTheme(), - OSD: OsdTheme(), - 'Battery Menu': BatteryMenuTheme(), - 'Bluetooth Menu': BluetoothMenuTheme(), - 'Clock Menu': ClockMenuTheme(), - 'Dashboard Menu': DashboardMenuTheme(), - 'Media Menu': MediaMenuTheme(), - 'Network Menu': NetworkMenuTheme(), - 'Notifications Menu': NotificationsMenuTheme(), - 'System Tray': SystrayMenuTheme(), - 'Volume Menu': VolumeMenuTheme(), - 'Power Menu': PowerMenuTheme(), - 'Custom Modules': CustomModuleTheme(), - }, - shown: CurrentPage.bind('value'), - }), - ]; - }), + }), + Widget.Stack({ + vexpand: true, + class_name: 'themes-menu-stack', + children: { + 'General Settings': MenuTheme(), + 'Matugen Settings': Matugen(), + Bar: BarTheme(), + Notifications: NotificationsTheme(), + OSD: OsdTheme(), + 'Battery Menu': BatteryMenuTheme(), + 'Bluetooth Menu': BluetoothMenuTheme(), + 'Clock Menu': ClockMenuTheme(), + 'Dashboard Menu': DashboardMenuTheme(), + 'Media Menu': MediaMenuTheme(), + 'Network Menu': NetworkMenuTheme(), + 'Notifications Menu': NotificationsMenuTheme(), + 'System Tray': SystrayMenuTheme(), + 'Volume Menu': VolumeMenuTheme(), + 'Power Menu': PowerMenuTheme(), + 'Custom Modules': CustomModuleTheme(), + }, + shown: CurrentPage.bind('value'), + }), + ], }); };