Skip to content

Commit b76d0ce

Browse files
committed
settings: fix child windows on newer quickshell-git
1 parent fa66d33 commit b76d0ce

9 files changed

Lines changed: 235 additions & 124 deletions

File tree

quickshell/DMSShellIPC.qml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,9 @@ Item {
797797
const modal = PopoutService.settingsModal;
798798
if (modal) {
799799
if (type === "wallpaper") {
800-
modal.wallpaperBrowser.allowStacking = false;
801-
modal.wallpaperBrowser.open();
800+
modal.openWallpaperBrowser(false);
802801
} else if (type === "profile") {
803-
modal.profileBrowser.allowStacking = false;
804-
modal.profileBrowser.open();
802+
modal.openProfileBrowser(false);
805803
}
806804
} else {
807805
PopoutService.openSettings();

quickshell/Modals/Changelog/ChangelogModal.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ FloatingWindow {
128128
iconName: "open_in_new"
129129
backgroundColor: Theme.surfaceContainerHighest
130130
textColor: Theme.surfaceText
131-
onClicked: Qt.openUrlExternally("https://danklinux.com/blog/v1.2-release")
131+
onClicked: Qt.openUrlExternally("https://danklinux.com/blog/v1-2-release")
132132
}
133133

134134
DankButton {

quickshell/Modals/Settings/ProfileSection.qml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ Rectangle {
7474
if (root.parentModal) {
7575
root.parentModal.allowFocusOverride = true;
7676
root.parentModal.shouldHaveFocus = false;
77-
if (root.parentModal.profileBrowser) {
78-
root.parentModal.profileBrowser.open();
79-
}
77+
root.parentModal.openProfileBrowser();
8078
}
8179
}
8280
}

quickshell/Modals/Settings/SettingsModal.qml

Lines changed: 62 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,26 @@ import qs.Widgets
88
FloatingWindow {
99
id: settingsModal
1010

11-
property alias profileBrowser: profileBrowser
12-
property alias wallpaperBrowser: wallpaperBrowser
11+
property var profileBrowser: profileBrowserLoader.item
12+
property var wallpaperBrowser: wallpaperBrowserLoader.item
13+
14+
function openProfileBrowser(allowStacking) {
15+
profileBrowserLoader.active = true;
16+
if (!profileBrowserLoader.item)
17+
return;
18+
if (allowStacking !== undefined)
19+
profileBrowserLoader.item.allowStacking = allowStacking;
20+
profileBrowserLoader.item.open();
21+
}
22+
23+
function openWallpaperBrowser(allowStacking) {
24+
wallpaperBrowserLoader.active = true;
25+
if (!wallpaperBrowserLoader.item)
26+
return;
27+
if (allowStacking !== undefined)
28+
wallpaperBrowserLoader.item.allowStacking = allowStacking;
29+
wallpaperBrowserLoader.item.open();
30+
}
1331
property alias sidebar: sidebar
1432
property int currentTabIndex: 0
1533
property bool shouldHaveFocus: visible
@@ -96,41 +114,51 @@ FloatingWindow {
96114
}
97115
}
98116

99-
FileBrowserModal {
100-
id: profileBrowser
101-
102-
allowStacking: true
103-
parentModal: settingsModal
104-
browserTitle: I18n.tr("Select Profile Image", "profile image file browser title")
105-
browserIcon: "person"
106-
browserType: "profile"
107-
showHiddenFiles: true
108-
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
109-
onFileSelected: path => {
110-
PortalService.setProfileImage(path);
111-
close();
112-
}
113-
onDialogClosed: () => {
114-
allowStacking = true;
117+
LazyLoader {
118+
id: profileBrowserLoader
119+
active: false
120+
121+
FileBrowserModal {
122+
id: profileBrowserItem
123+
124+
allowStacking: true
125+
parentModal: settingsModal
126+
browserTitle: I18n.tr("Select Profile Image", "profile image file browser title")
127+
browserIcon: "person"
128+
browserType: "profile"
129+
showHiddenFiles: true
130+
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
131+
onFileSelected: path => {
132+
PortalService.setProfileImage(path);
133+
close();
134+
}
135+
onDialogClosed: () => {
136+
allowStacking = true;
137+
}
115138
}
116139
}
117140

118-
FileBrowserModal {
119-
id: wallpaperBrowser
120-
121-
allowStacking: true
122-
parentModal: settingsModal
123-
browserTitle: I18n.tr("Select Wallpaper", "wallpaper file browser title")
124-
browserIcon: "wallpaper"
125-
browserType: "wallpaper"
126-
showHiddenFiles: true
127-
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
128-
onFileSelected: path => {
129-
SessionData.setWallpaper(path);
130-
close();
131-
}
132-
onDialogClosed: () => {
133-
allowStacking = true;
141+
LazyLoader {
142+
id: wallpaperBrowserLoader
143+
active: false
144+
145+
FileBrowserModal {
146+
id: wallpaperBrowserItem
147+
148+
allowStacking: true
149+
parentModal: settingsModal
150+
browserTitle: I18n.tr("Select Wallpaper", "wallpaper file browser title")
151+
browserIcon: "wallpaper"
152+
browserType: "wallpaper"
153+
showHiddenFiles: true
154+
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
155+
onFileSelected: path => {
156+
SessionData.setWallpaper(path);
157+
close();
158+
}
159+
onDialogClosed: () => {
160+
allowStacking = true;
161+
}
134162
}
135163
}
136164

quickshell/Modules/Settings/DesktopWidgetsTab.qml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,38 @@ Item {
2222
readonly property var allInstances: SettingsData.desktopWidgetInstances || []
2323
readonly property var allGroups: SettingsData.desktopWidgetGroups || []
2424

25-
DesktopWidgetBrowser {
26-
id: widgetBrowser
27-
parentModal: root.parentModal
28-
onWidgetAdded: widgetType => {
29-
ToastService.showInfo(I18n.tr("Widget added"));
25+
function showWidgetBrowser() {
26+
widgetBrowserLoader.active = true;
27+
if (widgetBrowserLoader.item)
28+
widgetBrowserLoader.item.show();
29+
}
30+
31+
function showDesktopPluginBrowser() {
32+
desktopPluginBrowserLoader.active = true;
33+
if (desktopPluginBrowserLoader.item)
34+
desktopPluginBrowserLoader.item.show();
35+
}
36+
37+
LazyLoader {
38+
id: widgetBrowserLoader
39+
active: false
40+
41+
DesktopWidgetBrowser {
42+
parentModal: root.parentModal
43+
onWidgetAdded: widgetType => {
44+
ToastService.showInfo(I18n.tr("Widget added"));
45+
}
3046
}
3147
}
3248

33-
PluginBrowser {
34-
id: desktopPluginBrowser
35-
parentModal: root.parentModal
36-
typeFilter: "desktop-widget"
49+
LazyLoader {
50+
id: desktopPluginBrowserLoader
51+
active: false
52+
53+
PluginBrowser {
54+
parentModal: root.parentModal
55+
typeFilter: "desktop-widget"
56+
}
3757
}
3858

3959
DankFlickable {
@@ -74,13 +94,13 @@ Item {
7494
DankButton {
7595
text: I18n.tr("Add Widget")
7696
iconName: "add"
77-
onClicked: widgetBrowser.show()
97+
onClicked: root.showWidgetBrowser()
7898
}
7999

80100
DankButton {
81101
text: I18n.tr("Browse Plugins")
82102
iconName: "store"
83-
onClicked: desktopPluginBrowser.show()
103+
onClicked: root.showDesktopPluginBrowser()
84104
}
85105
}
86106
}

quickshell/Modules/Settings/PluginsTab.qml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import QtQuick
2+
import Quickshell
23
import qs.Common
34
import qs.Services
45
import qs.Widgets
@@ -209,7 +210,7 @@ FocusScope {
209210
iconName: "store"
210211
enabled: DMSService.dmsAvailable
211212
onClicked: {
212-
pluginBrowser.show();
213+
showPluginBrowser();
213214
}
214215
}
215216

@@ -382,9 +383,11 @@ FocusScope {
382383
Connections {
383384
target: DMSService
384385
function onPluginsListReceived(plugins) {
385-
pluginBrowser.isLoading = false;
386-
pluginBrowser.allPlugins = plugins;
387-
pluginBrowser.updateFilteredPlugins();
386+
if (!pluginBrowserLoader.item)
387+
return;
388+
pluginBrowserLoader.item.isLoading = false;
389+
pluginBrowserLoader.item.allPlugins = plugins;
390+
pluginBrowserLoader.item.updateFilteredPlugins();
388391
}
389392
function onInstalledPluginsReceived(plugins) {
390393
var pluginMap = {};
@@ -410,22 +413,36 @@ FocusScope {
410413
}
411414

412415
Component.onCompleted: {
413-
pluginBrowser.parentModal = pluginsTab.parentModal;
414416
if (DMSService.dmsAvailable && DMSService.apiVersion >= 8)
415417
DMSService.listInstalled();
416418
if (PopoutService.pendingPluginInstall)
417-
Qt.callLater(() => pluginBrowser.show());
419+
Qt.callLater(showPluginBrowser);
418420
}
419421

420422
Connections {
421423
target: PopoutService
422424
function onPendingPluginInstallChanged() {
423425
if (PopoutService.pendingPluginInstall)
424-
pluginBrowser.show();
426+
showPluginBrowser();
427+
}
428+
}
429+
430+
LazyLoader {
431+
id: pluginBrowserLoader
432+
active: false
433+
434+
PluginBrowser {
435+
id: pluginBrowserItem
436+
437+
Component.onCompleted: {
438+
pluginBrowserItem.parentModal = pluginsTab.parentModal;
439+
}
425440
}
426441
}
427442

428-
PluginBrowser {
429-
id: pluginBrowser
443+
function showPluginBrowser() {
444+
pluginBrowserLoader.active = true;
445+
if (pluginBrowserLoader.item)
446+
pluginBrowserLoader.item.show();
430447
}
431448
}

quickshell/Modules/Settings/ThemeColorsTab.qml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Item {
131131
if (DMSService.dmsAvailable)
132132
DMSService.listInstalledThemes();
133133
if (PopoutService.pendingThemeInstall)
134-
Qt.callLater(() => themeBrowser.show());
134+
Qt.callLater(() => showThemeBrowser());
135135
templateCheckProcess.running = true;
136136
if (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl)
137137
checkCursorIncludeStatus();
@@ -169,7 +169,7 @@ Item {
169169
target: PopoutService
170170
function onPendingThemeInstallChanged() {
171171
if (PopoutService.pendingThemeInstall)
172-
themeBrowser.show();
172+
showThemeBrowser();
173173
}
174174
}
175175

@@ -939,7 +939,7 @@ Item {
939939
text: I18n.tr("Browse Themes", "browse themes button")
940940
iconName: "store"
941941
anchors.horizontalCenter: parent.horizontalCenter
942-
onClicked: themeBrowser.show()
942+
onClicked: showThemeBrowser()
943943
}
944944
}
945945
}
@@ -2041,7 +2041,18 @@ Item {
20412041
}
20422042
}
20432043

2044-
ThemeBrowser {
2045-
id: themeBrowser
2044+
LazyLoader {
2045+
id: themeBrowserLoader
2046+
active: false
2047+
2048+
ThemeBrowser {
2049+
id: themeBrowserItem
2050+
}
2051+
}
2052+
2053+
function showThemeBrowser() {
2054+
themeBrowserLoader.active = true;
2055+
if (themeBrowserLoader.item)
2056+
themeBrowserLoader.item.show();
20462057
}
20472058
}

0 commit comments

Comments
 (0)