mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat(settings): when switching settings panel mode, close and reopen the settings to see the actual change
This commit is contained in:
@@ -38,6 +38,10 @@ FloatingWindow {
|
||||
settingsContent._pendingSubTab = subTabId;
|
||||
settingsContent.initialize();
|
||||
isInitialized = true;
|
||||
// Tab content persists in window mode; if no subtab specified and the
|
||||
// tab content is still loaded (same tab), reset to first subtab
|
||||
if (subTabId < 0 && settingsContent.activeTabContent)
|
||||
settingsContent.setSubTabIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Modules.Panels.Settings // For SettingsPanel
|
||||
import qs.Services.UI
|
||||
import qs.Widgets
|
||||
|
||||
ColumnLayout {
|
||||
@@ -67,6 +69,7 @@ ColumnLayout {
|
||||
label: I18n.tr("panels.user-interface.settings-panel-mode-label")
|
||||
description: I18n.tr("panels.user-interface.settings-panel-mode-description")
|
||||
Layout.fillWidth: true
|
||||
minimumWidth: 220 * Style.uiScaleRatio
|
||||
model: [
|
||||
{
|
||||
"key": "attached",
|
||||
@@ -83,8 +86,21 @@ ColumnLayout {
|
||||
]
|
||||
currentKey: Settings.data.ui.settingsPanelMode
|
||||
defaultValue: Settings.getDefaultValue("ui.settingsPanelMode")
|
||||
onSelected: key => Settings.data.ui.settingsPanelMode = key
|
||||
minimumWidth: 220 * Style.uiScaleRatio
|
||||
onSelected: key => {
|
||||
// Defer setup to next update so close can do its work properly
|
||||
Qt.callLater(() => {
|
||||
Settings.data.ui.settingsPanelMode = key;
|
||||
});
|
||||
if (Settings.data.ui.settingsPanelMode === "window" || key === "window") {
|
||||
// Just switched from/to window, need to close panel
|
||||
var screen = PanelService.openedPanel?.screen || SettingsPanelService.settingsWindow?.screen || PanelService.findScreenForPanels();
|
||||
SettingsPanelService.close(screen);
|
||||
|
||||
Qt.callLater(() => {
|
||||
SettingsPanelService.openToTab(SettingsPanel.Tab.UserInterface, 1, screen);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
|
||||
Reference in New Issue
Block a user