1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

settings: fix child windows on newer quickshell-git

This commit is contained in:
bbedward
2026-01-13 16:57:23 -05:00
parent fa66d330cf
commit b76d0ce97d
9 changed files with 233 additions and 122 deletions

View File

@@ -797,11 +797,9 @@ Item {
const modal = PopoutService.settingsModal; const modal = PopoutService.settingsModal;
if (modal) { if (modal) {
if (type === "wallpaper") { if (type === "wallpaper") {
modal.wallpaperBrowser.allowStacking = false; modal.openWallpaperBrowser(false);
modal.wallpaperBrowser.open();
} else if (type === "profile") { } else if (type === "profile") {
modal.profileBrowser.allowStacking = false; modal.openProfileBrowser(false);
modal.profileBrowser.open();
} }
} else { } else {
PopoutService.openSettings(); PopoutService.openSettings();

View File

@@ -128,7 +128,7 @@ FloatingWindow {
iconName: "open_in_new" iconName: "open_in_new"
backgroundColor: Theme.surfaceContainerHighest backgroundColor: Theme.surfaceContainerHighest
textColor: Theme.surfaceText textColor: Theme.surfaceText
onClicked: Qt.openUrlExternally("https://danklinux.com/blog/v1.2-release") onClicked: Qt.openUrlExternally("https://danklinux.com/blog/v1-2-release")
} }
DankButton { DankButton {

View File

@@ -74,9 +74,7 @@ Rectangle {
if (root.parentModal) { if (root.parentModal) {
root.parentModal.allowFocusOverride = true; root.parentModal.allowFocusOverride = true;
root.parentModal.shouldHaveFocus = false; root.parentModal.shouldHaveFocus = false;
if (root.parentModal.profileBrowser) { root.parentModal.openProfileBrowser();
root.parentModal.profileBrowser.open();
}
} }
} }
} }

View File

@@ -8,8 +8,26 @@ import qs.Widgets
FloatingWindow { FloatingWindow {
id: settingsModal id: settingsModal
property alias profileBrowser: profileBrowser property var profileBrowser: profileBrowserLoader.item
property alias wallpaperBrowser: wallpaperBrowser property var wallpaperBrowser: wallpaperBrowserLoader.item
function openProfileBrowser(allowStacking) {
profileBrowserLoader.active = true;
if (!profileBrowserLoader.item)
return;
if (allowStacking !== undefined)
profileBrowserLoader.item.allowStacking = allowStacking;
profileBrowserLoader.item.open();
}
function openWallpaperBrowser(allowStacking) {
wallpaperBrowserLoader.active = true;
if (!wallpaperBrowserLoader.item)
return;
if (allowStacking !== undefined)
wallpaperBrowserLoader.item.allowStacking = allowStacking;
wallpaperBrowserLoader.item.open();
}
property alias sidebar: sidebar property alias sidebar: sidebar
property int currentTabIndex: 0 property int currentTabIndex: 0
property bool shouldHaveFocus: visible property bool shouldHaveFocus: visible
@@ -96,8 +114,12 @@ FloatingWindow {
} }
} }
LazyLoader {
id: profileBrowserLoader
active: false
FileBrowserModal { FileBrowserModal {
id: profileBrowser id: profileBrowserItem
allowStacking: true allowStacking: true
parentModal: settingsModal parentModal: settingsModal
@@ -114,9 +136,14 @@ FloatingWindow {
allowStacking = true; allowStacking = true;
} }
} }
}
LazyLoader {
id: wallpaperBrowserLoader
active: false
FileBrowserModal { FileBrowserModal {
id: wallpaperBrowser id: wallpaperBrowserItem
allowStacking: true allowStacking: true
parentModal: settingsModal parentModal: settingsModal
@@ -133,6 +160,7 @@ FloatingWindow {
allowStacking = true; allowStacking = true;
} }
} }
}
FocusScope { FocusScope {
id: contentFocusScope id: contentFocusScope

View File

@@ -22,19 +22,39 @@ Item {
readonly property var allInstances: SettingsData.desktopWidgetInstances || [] readonly property var allInstances: SettingsData.desktopWidgetInstances || []
readonly property var allGroups: SettingsData.desktopWidgetGroups || [] readonly property var allGroups: SettingsData.desktopWidgetGroups || []
function showWidgetBrowser() {
widgetBrowserLoader.active = true;
if (widgetBrowserLoader.item)
widgetBrowserLoader.item.show();
}
function showDesktopPluginBrowser() {
desktopPluginBrowserLoader.active = true;
if (desktopPluginBrowserLoader.item)
desktopPluginBrowserLoader.item.show();
}
LazyLoader {
id: widgetBrowserLoader
active: false
DesktopWidgetBrowser { DesktopWidgetBrowser {
id: widgetBrowser
parentModal: root.parentModal parentModal: root.parentModal
onWidgetAdded: widgetType => { onWidgetAdded: widgetType => {
ToastService.showInfo(I18n.tr("Widget added")); ToastService.showInfo(I18n.tr("Widget added"));
} }
} }
}
LazyLoader {
id: desktopPluginBrowserLoader
active: false
PluginBrowser { PluginBrowser {
id: desktopPluginBrowser
parentModal: root.parentModal parentModal: root.parentModal
typeFilter: "desktop-widget" typeFilter: "desktop-widget"
} }
}
DankFlickable { DankFlickable {
anchors.fill: parent anchors.fill: parent
@@ -74,13 +94,13 @@ Item {
DankButton { DankButton {
text: I18n.tr("Add Widget") text: I18n.tr("Add Widget")
iconName: "add" iconName: "add"
onClicked: widgetBrowser.show() onClicked: root.showWidgetBrowser()
} }
DankButton { DankButton {
text: I18n.tr("Browse Plugins") text: I18n.tr("Browse Plugins")
iconName: "store" iconName: "store"
onClicked: desktopPluginBrowser.show() onClicked: root.showDesktopPluginBrowser()
} }
} }
} }

View File

@@ -1,4 +1,5 @@
import QtQuick import QtQuick
import Quickshell
import qs.Common import qs.Common
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
@@ -209,7 +210,7 @@ FocusScope {
iconName: "store" iconName: "store"
enabled: DMSService.dmsAvailable enabled: DMSService.dmsAvailable
onClicked: { onClicked: {
pluginBrowser.show(); showPluginBrowser();
} }
} }
@@ -382,9 +383,11 @@ FocusScope {
Connections { Connections {
target: DMSService target: DMSService
function onPluginsListReceived(plugins) { function onPluginsListReceived(plugins) {
pluginBrowser.isLoading = false; if (!pluginBrowserLoader.item)
pluginBrowser.allPlugins = plugins; return;
pluginBrowser.updateFilteredPlugins(); pluginBrowserLoader.item.isLoading = false;
pluginBrowserLoader.item.allPlugins = plugins;
pluginBrowserLoader.item.updateFilteredPlugins();
} }
function onInstalledPluginsReceived(plugins) { function onInstalledPluginsReceived(plugins) {
var pluginMap = {}; var pluginMap = {};
@@ -410,22 +413,36 @@ FocusScope {
} }
Component.onCompleted: { Component.onCompleted: {
pluginBrowser.parentModal = pluginsTab.parentModal;
if (DMSService.dmsAvailable && DMSService.apiVersion >= 8) if (DMSService.dmsAvailable && DMSService.apiVersion >= 8)
DMSService.listInstalled(); DMSService.listInstalled();
if (PopoutService.pendingPluginInstall) if (PopoutService.pendingPluginInstall)
Qt.callLater(() => pluginBrowser.show()); Qt.callLater(showPluginBrowser);
} }
Connections { Connections {
target: PopoutService target: PopoutService
function onPendingPluginInstallChanged() { function onPendingPluginInstallChanged() {
if (PopoutService.pendingPluginInstall) if (PopoutService.pendingPluginInstall)
pluginBrowser.show(); showPluginBrowser();
} }
} }
LazyLoader {
id: pluginBrowserLoader
active: false
PluginBrowser { PluginBrowser {
id: pluginBrowser id: pluginBrowserItem
Component.onCompleted: {
pluginBrowserItem.parentModal = pluginsTab.parentModal;
}
}
}
function showPluginBrowser() {
pluginBrowserLoader.active = true;
if (pluginBrowserLoader.item)
pluginBrowserLoader.item.show();
} }
} }

View File

@@ -131,7 +131,7 @@ Item {
if (DMSService.dmsAvailable) if (DMSService.dmsAvailable)
DMSService.listInstalledThemes(); DMSService.listInstalledThemes();
if (PopoutService.pendingThemeInstall) if (PopoutService.pendingThemeInstall)
Qt.callLater(() => themeBrowser.show()); Qt.callLater(() => showThemeBrowser());
templateCheckProcess.running = true; templateCheckProcess.running = true;
if (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl) if (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl)
checkCursorIncludeStatus(); checkCursorIncludeStatus();
@@ -169,7 +169,7 @@ Item {
target: PopoutService target: PopoutService
function onPendingThemeInstallChanged() { function onPendingThemeInstallChanged() {
if (PopoutService.pendingThemeInstall) if (PopoutService.pendingThemeInstall)
themeBrowser.show(); showThemeBrowser();
} }
} }
@@ -939,7 +939,7 @@ Item {
text: I18n.tr("Browse Themes", "browse themes button") text: I18n.tr("Browse Themes", "browse themes button")
iconName: "store" iconName: "store"
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
onClicked: themeBrowser.show() onClicked: showThemeBrowser()
} }
} }
} }
@@ -2041,7 +2041,18 @@ Item {
} }
} }
LazyLoader {
id: themeBrowserLoader
active: false
ThemeBrowser { ThemeBrowser {
id: themeBrowser id: themeBrowserItem
}
}
function showThemeBrowser() {
themeBrowserLoader.active = true;
if (themeBrowserLoader.item)
themeBrowserLoader.item.show();
} }
} }

View File

@@ -139,7 +139,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: mainWallpaperBrowser.open() onClicked: root.openMainWallpaperBrowser()
} }
} }
@@ -476,7 +476,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: lightWallpaperBrowser.open() onClicked: root.openLightWallpaperBrowser()
} }
} }
@@ -660,7 +660,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: darkWallpaperBrowser.open() onClicked: root.openDarkWallpaperBrowser()
} }
} }
@@ -1242,8 +1242,29 @@ Item {
} }
} }
function openMainWallpaperBrowser() {
mainWallpaperBrowserLoader.active = true;
if (mainWallpaperBrowserLoader.item)
mainWallpaperBrowserLoader.item.open();
}
function openLightWallpaperBrowser() {
lightWallpaperBrowserLoader.active = true;
if (lightWallpaperBrowserLoader.item)
lightWallpaperBrowserLoader.item.open();
}
function openDarkWallpaperBrowser() {
darkWallpaperBrowserLoader.active = true;
if (darkWallpaperBrowserLoader.item)
darkWallpaperBrowserLoader.item.open();
}
LazyLoader {
id: mainWallpaperBrowserLoader
active: false
FileBrowserModal { FileBrowserModal {
id: mainWallpaperBrowser
parentModal: root.parentModal parentModal: root.parentModal
browserTitle: I18n.tr("Select Wallpaper", "wallpaper file browser title") browserTitle: I18n.tr("Select Wallpaper", "wallpaper file browser title")
browserIcon: "wallpaper" browserIcon: "wallpaper"
@@ -1259,9 +1280,13 @@ Item {
close(); close();
} }
} }
}
LazyLoader {
id: lightWallpaperBrowserLoader
active: false
FileBrowserModal { FileBrowserModal {
id: lightWallpaperBrowser
parentModal: root.parentModal parentModal: root.parentModal
browserTitle: I18n.tr("Select Wallpaper", "light mode wallpaper file browser title") browserTitle: I18n.tr("Select Wallpaper", "light mode wallpaper file browser title")
browserIcon: "light_mode" browserIcon: "light_mode"
@@ -1275,9 +1300,13 @@ Item {
close(); close();
} }
} }
}
LazyLoader {
id: darkWallpaperBrowserLoader
active: false
FileBrowserModal { FileBrowserModal {
id: darkWallpaperBrowser
parentModal: root.parentModal parentModal: root.parentModal
browserTitle: I18n.tr("Select Wallpaper", "dark mode wallpaper file browser title") browserTitle: I18n.tr("Select Wallpaper", "dark mode wallpaper file browser title")
browserIcon: "dark_mode" browserIcon: "dark_mode"
@@ -1291,4 +1320,5 @@ Item {
close(); close();
} }
} }
}
} }

View File

@@ -1,5 +1,6 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell
import qs.Common import qs.Common
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
@@ -916,13 +917,27 @@ Item {
}); });
} }
LazyLoader {
id: widgetSelectionPopupLoader
active: false
WidgetSelectionPopup { WidgetSelectionPopup {
id: widgetSelectionPopup id: widgetSelectionPopupItem
parentModal: widgetsTab.parentModal parentModal: widgetsTab.parentModal
onWidgetSelected: (widgetId, targetSection) => { onWidgetSelected: (widgetId, targetSection) => {
widgetsTab.addWidgetToSection(widgetId, targetSection); widgetsTab.addWidgetToSection(widgetId, targetSection);
} }
} }
}
function showWidgetSelectionPopup(sectionId) {
widgetSelectionPopupLoader.active = true;
if (!widgetSelectionPopupLoader.item)
return;
widgetSelectionPopupLoader.item.targetSection = sectionId;
widgetSelectionPopupLoader.item.allWidgets = widgetsTab.getWidgetsForPopup();
widgetSelectionPopupLoader.item.show();
}
DankFlickable { DankFlickable {
anchors.fill: parent anchors.fill: parent
@@ -1113,9 +1128,7 @@ Item {
widgetsTab.handleItemOrderChanged(sectionId, newOrder); widgetsTab.handleItemOrderChanged(sectionId, newOrder);
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.targetSection = sectionId; showWidgetSelectionPopup(sectionId);
widgetSelectionPopup.allWidgets = widgetsTab.getWidgetsForPopup();
widgetSelectionPopup.show();
} }
onRemoveWidget: (sectionId, index) => { onRemoveWidget: (sectionId, index) => {
widgetsTab.removeWidgetFromSection(sectionId, index); widgetsTab.removeWidgetFromSection(sectionId, index);
@@ -1170,9 +1183,7 @@ Item {
widgetsTab.handleItemOrderChanged(sectionId, newOrder); widgetsTab.handleItemOrderChanged(sectionId, newOrder);
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.targetSection = sectionId; showWidgetSelectionPopup(sectionId);
widgetSelectionPopup.allWidgets = widgetsTab.getWidgetsForPopup();
widgetSelectionPopup.show();
} }
onRemoveWidget: (sectionId, index) => { onRemoveWidget: (sectionId, index) => {
widgetsTab.removeWidgetFromSection(sectionId, index); widgetsTab.removeWidgetFromSection(sectionId, index);
@@ -1227,9 +1238,7 @@ Item {
widgetsTab.handleItemOrderChanged(sectionId, newOrder); widgetsTab.handleItemOrderChanged(sectionId, newOrder);
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.targetSection = sectionId; showWidgetSelectionPopup(sectionId);
widgetSelectionPopup.allWidgets = widgetsTab.getWidgetsForPopup();
widgetSelectionPopup.show();
} }
onRemoveWidget: (sectionId, index) => { onRemoveWidget: (sectionId, index) => {
widgetsTab.removeWidgetFromSection(sectionId, index); widgetsTab.removeWidgetFromSection(sectionId, index);