1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 00:12:50 -05:00

window: add support for startSystemMove, resize, maximize to floating

windows
This commit is contained in:
bbedward
2025-12-22 13:18:37 -05:00
parent c703cb6504
commit 4982ea53dd
12 changed files with 578 additions and 230 deletions

View File

@@ -47,6 +47,7 @@ FocusScope {
property int actualGridColumns: 5 property int actualGridColumns: 5
property bool _initialized: false property bool _initialized: false
property bool closeOnEscape: true property bool closeOnEscape: true
property var windowControls: null
signal fileSelected(string path) signal fileSelected(string path)
signal closeRequested signal closeRequested
@@ -155,7 +156,6 @@ FocusScope {
const lastSlash = path.lastIndexOf('/'); const lastSlash = path.lastIndexOf('/');
if (lastSlash <= 0) if (lastSlash <= 0)
return; return;
const newPath = path.substring(0, lastSlash); const newPath = path.substring(0, lastSlash);
if (newPath.length < homeDir.length) { if (newPath.length < homeDir.length) {
currentPath = homeDir; currentPath = homeDir;
@@ -534,6 +534,14 @@ FocusScope {
width: parent.width width: parent.width
height: 48 height: 48
MouseArea {
anchors.fill: parent
onPressed: if (windowControls)
windowControls.tryStartMove()
onDoubleClicked: if (windowControls)
windowControls.tryToggleMaximize()
}
Row { Row {
spacing: Theme.spacingM spacing: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -595,6 +603,16 @@ FocusScope {
onClicked: root.showKeyboardHints = !root.showKeyboardHints onClicked: root.showKeyboardHints = !root.showKeyboardHints
} }
DankActionButton {
visible: windowControls?.supported ?? false
circular: false
iconName: windowControls?.targetWindow?.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: if (windowControls)
windowControls.tryToggleMaximize()
}
DankActionButton { DankActionButton {
circular: false circular: false
iconName: "close" iconName: "close"

View File

@@ -1,6 +1,7 @@
import QtQuick import QtQuick
import Quickshell import Quickshell
import qs.Common import qs.Common
import qs.Widgets
FloatingWindow { FloatingWindow {
id: fileBrowserModal id: fileBrowserModal
@@ -60,6 +61,7 @@ FloatingWindow {
anchors.fill: parent anchors.fill: parent
focus: true focus: true
closeOnEscape: false closeOnEscape: false
windowControls: windowControls
browserTitle: fileBrowserModal.browserTitle browserTitle: fileBrowserModal.browserTitle
browserIcon: fileBrowserModal.browserIcon browserIcon: fileBrowserModal.browserIcon
@@ -74,4 +76,9 @@ FloatingWindow {
onFileSelected: path => fileBrowserModal.fileSelected(path) onFileSelected: path => fileBrowserModal.fileSelected(path)
onCloseRequested: fileBrowserModal.close() onCloseRequested: fileBrowserModal.close()
} }
FloatingWindowControls {
id: windowControls
targetWindow: fileBrowserModal
}
} }

View File

@@ -107,6 +107,15 @@ FloatingWindow {
event.accepted = true; event.accepted = true;
} }
MouseArea {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: headerRow.height + Theme.spacingM
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
Row { Row {
id: headerRow id: headerRow
anchors.left: parent.left anchors.left: parent.left
@@ -117,7 +126,7 @@ FloatingWindow {
anchors.topMargin: Theme.spacingM anchors.topMargin: Theme.spacingM
Column { Column {
width: parent.width - 40 width: parent.width - 60
spacing: Theme.spacingXS spacing: Theme.spacingXS
StyledText { StyledText {
@@ -151,13 +160,25 @@ FloatingWindow {
} }
} }
DankActionButton { Row {
iconName: "close" spacing: Theme.spacingXS
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText DankActionButton {
enabled: !isLoading visible: windowControls.supported
opacity: enabled ? 1 : 0.5 iconName: root.maximized ? "fullscreen_exit" : "fullscreen"
onClicked: cancelAuth() iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton {
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
enabled: !isLoading
opacity: enabled ? 1 : 0.5
onClicked: cancelAuth()
}
} }
} }
@@ -314,4 +335,9 @@ FloatingWindow {
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: root
}
} }

View File

@@ -171,190 +171,237 @@ FloatingWindow {
} }
} }
ColumnLayout { Column {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingL spacing: 0
spacing: Theme.spacingL
visible: DgopService.dgopAvailable visible: DgopService.dgopAvailable
RowLayout { Item {
Layout.fillWidth: true width: parent.width
height: 40 height: 48
StyledText { MouseArea {
text: I18n.tr("System Monitor") anchors.fill: parent
font.pixelSize: Theme.fontSizeLarge + 4 onPressed: windowControls.tryStartMove()
font.weight: Font.Bold onDoubleClicked: windowControls.tryToggleMaximize()
color: Theme.surfaceText
Layout.alignment: Qt.AlignVCenter
} }
Item {
Layout.fillWidth: true
}
DankActionButton {
circular: false
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: () => {
processListModal.hide();
}
Layout.alignment: Qt.AlignVCenter
}
}
Rectangle {
Layout.fillWidth: true
height: 52
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
radius: Theme.cornerRadius
border.color: Theme.outlineLight
border.width: 1
Row { Row {
anchors.fill: parent anchors.left: parent.left
anchors.margins: 4 anchors.leftMargin: Theme.spacingL
spacing: 2 anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingM
Repeater { DankIcon {
model: tabNames name: "analytics"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Rectangle { StyledText {
width: (parent.width - (tabNames.length - 1) * 2) / tabNames.length text: I18n.tr("System Monitor")
height: 44 font.pixelSize: Theme.fontSizeXLarge
radius: Theme.cornerRadius font.weight: Font.Medium
color: currentTab === index ? Theme.primaryPressed : (tabMouseArea.containsMouse ? Theme.primaryHoverLight : "transparent") color: Theme.surfaceText
border.color: currentTab === index ? Theme.primary : "transparent" anchors.verticalCenter: parent.verticalCenter
border.width: currentTab === index ? 1 : 0 }
}
Row { Row {
anchors.centerIn: parent anchors.right: parent.right
spacing: Theme.spacingXS anchors.rightMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon { DankActionButton {
name: { visible: windowControls.supported
const tabIcons = ["list_alt", "analytics", "settings"]; circular: false
return tabIcons[index] || "tab"; iconName: processListModal.maximized ? "fullscreen_exit" : "fullscreen"
} iconSize: Theme.iconSize - 4
size: Theme.iconSize - 2 iconColor: Theme.surfaceText
color: currentTab === index ? Theme.primary : Theme.surfaceText onClicked: windowControls.tryToggleMaximize()
opacity: currentTab === index ? 1 : 0.7 }
anchors.verticalCenter: parent.verticalCenter
Behavior on color { DankActionButton {
ColorAnimation { circular: false
duration: Theme.shortDuration iconName: "close"
} iconSize: Theme.iconSize - 4
} iconColor: Theme.surfaceText
} onClicked: processListModal.hide()
StyledText {
text: modelData
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: currentTab === index ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -1
Behavior on color {
ColorAnimation {
duration: Theme.shortDuration
}
}
}
}
MouseArea {
id: tabMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: () => {
currentTab = index;
}
}
Behavior on color {
ColorAnimation {
duration: Theme.shortDuration
}
}
Behavior on border.color {
ColorAnimation {
duration: Theme.shortDuration
}
}
}
} }
} }
} }
Rectangle { Item {
Layout.fillWidth: true width: parent.width
Layout.fillHeight: true height: parent.height - 48
radius: Theme.cornerRadius
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
border.color: Theme.outlineLight
border.width: 1
Loader {
id: processesTab
ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingS anchors.leftMargin: Theme.spacingL
active: processListModal.visible && currentTab === 0 anchors.rightMargin: Theme.spacingL
visible: currentTab === 0 anchors.bottomMargin: Theme.spacingL
opacity: currentTab === 0 ? 1 : 0 anchors.topMargin: 0
sourceComponent: processesTabComponent spacing: Theme.spacingL
Behavior on opacity { Rectangle {
NumberAnimation { Layout.fillWidth: true
duration: Theme.mediumDuration height: 52
easing.type: Theme.emphasizedEasing color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
radius: Theme.cornerRadius
border.color: Theme.outlineLight
border.width: 1
Row {
anchors.fill: parent
anchors.margins: 4
spacing: 2
Repeater {
model: tabNames
Rectangle {
width: (parent.width - (tabNames.length - 1) * 2) / tabNames.length
height: 44
radius: Theme.cornerRadius
color: currentTab === index ? Theme.primaryPressed : (tabMouseArea.containsMouse ? Theme.primaryHoverLight : "transparent")
border.color: currentTab === index ? Theme.primary : "transparent"
border.width: currentTab === index ? 1 : 0
Row {
anchors.centerIn: parent
spacing: Theme.spacingXS
DankIcon {
name: {
const tabIcons = ["list_alt", "analytics", "settings"];
return tabIcons[index] || "tab";
}
size: Theme.iconSize - 2
color: currentTab === index ? Theme.primary : Theme.surfaceText
opacity: currentTab === index ? 1 : 0.7
anchors.verticalCenter: parent.verticalCenter
Behavior on color {
ColorAnimation {
duration: Theme.shortDuration
}
}
}
StyledText {
text: modelData
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: currentTab === index ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -1
Behavior on color {
ColorAnimation {
duration: Theme.shortDuration
}
}
}
}
MouseArea {
id: tabMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: () => {
currentTab = index;
}
}
Behavior on color {
ColorAnimation {
duration: Theme.shortDuration
}
}
Behavior on border.color {
ColorAnimation {
duration: Theme.shortDuration
}
}
}
}
} }
} }
}
Loader { Rectangle {
id: performanceTab Layout.fillWidth: true
Layout.fillHeight: true
radius: Theme.cornerRadius
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
border.color: Theme.outlineLight
border.width: 1
anchors.fill: parent Loader {
anchors.margins: Theme.spacingS id: processesTab
active: processListModal.visible && currentTab === 1
visible: currentTab === 1
opacity: currentTab === 1 ? 1 : 0
sourceComponent: performanceTabComponent
Behavior on opacity { anchors.fill: parent
NumberAnimation { anchors.margins: Theme.spacingS
duration: Theme.mediumDuration active: processListModal.visible && currentTab === 0
easing.type: Theme.emphasizedEasing visible: currentTab === 0
opacity: currentTab === 0 ? 1 : 0
sourceComponent: processesTabComponent
Behavior on opacity {
NumberAnimation {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
} }
}
}
Loader { Loader {
id: systemTab id: performanceTab
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingS anchors.margins: Theme.spacingS
active: processListModal.visible && currentTab === 2 active: processListModal.visible && currentTab === 1
visible: currentTab === 2 visible: currentTab === 1
opacity: currentTab === 2 ? 1 : 0 opacity: currentTab === 1 ? 1 : 0
sourceComponent: systemTabComponent sourceComponent: performanceTabComponent
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
}
}
}
Loader {
id: systemTab
anchors.fill: parent
anchors.margins: Theme.spacingS
active: processListModal.visible && currentTab === 2
visible: currentTab === 2
opacity: currentTab === 2 ? 1 : 0
sourceComponent: systemTabComponent
Behavior on opacity {
NumberAnimation {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
} }
} }
} }
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: processListModal
}
} }

View File

@@ -163,6 +163,12 @@ FloatingWindow {
height: 48 height: 48
z: 10 z: 10
MouseArea {
anchors.fill: parent
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Theme.surfaceContainer color: Theme.surfaceContainer
@@ -203,17 +209,28 @@ FloatingWindow {
} }
} }
DankActionButton { Row {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Theme.spacingM anchors.rightMargin: Theme.spacingM
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: Theme.spacingM anchors.topMargin: Theme.spacingM
circular: false spacing: Theme.spacingXS
iconName: "close"
iconSize: Theme.iconSize - 4 DankActionButton {
iconColor: Theme.surfaceText visible: windowControls.supported
onClicked: () => { circular: false
settingsModal.hide(); iconName: settingsModal.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton {
circular: false
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: settingsModal.hide()
} }
} }
} }
@@ -257,4 +274,9 @@ FloatingWindow {
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: settingsModal
}
} }

View File

@@ -208,7 +208,7 @@ FloatingWindow {
usernameInput.text = ""; usernameInput.text = "";
anonInput.text = ""; anonInput.text = "";
domainMatchInput.text = ""; domainMatchInput.text = "";
for (let i = 0; i < dynamicFieldsRepeater.count; i++) { for (var i = 0; i < dynamicFieldsRepeater.count; i++) {
const item = dynamicFieldsRepeater.itemAt(i); const item = dynamicFieldsRepeater.itemAt(i);
if (item?.children[0]) if (item?.children[0])
item.children[0].text = ""; item.children[0].text = "";
@@ -248,51 +248,71 @@ FloatingWindow {
Row { Row {
width: contentCol.width width: contentCol.width
Column { MouseArea {
width: parent.width - 40 width: parent.width - 60
spacing: Theme.spacingXS height: headerCol.height
onPressed: windowControls.tryStartMove()
StyledText { onDoubleClicked: windowControls.tryToggleMaximize()
text: isVpnPrompt ? I18n.tr("Connect to VPN") : I18n.tr("Connect to Wi-Fi")
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Medium
}
Column { Column {
id: headerCol
width: parent.width width: parent.width
spacing: Theme.spacingXS spacing: Theme.spacingXS
StyledText { StyledText {
text: { text: isVpnPrompt ? I18n.tr("Connect to VPN") : I18n.tr("Connect to Wi-Fi")
if (fieldsInfo.length > 0) font.pixelSize: Theme.fontSizeLarge
return I18n.tr("Enter credentials for ") + wifiPasswordSSID; color: Theme.surfaceText
if (isVpnPrompt) font.weight: Font.Medium
return I18n.tr("Enter password for ") + wifiPasswordSSID;
const prefix = requiresEnterprise ? I18n.tr("Enter credentials for ") : I18n.tr("Enter password for ");
return prefix + wifiPasswordSSID;
}
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceTextMedium
width: parent.width
elide: Text.ElideRight
} }
StyledText { Column {
visible: isPromptMode && promptReason === "wrong-password"
text: I18n.tr("Incorrect password")
font.pixelSize: Theme.fontSizeSmall
color: Theme.error
width: parent.width width: parent.width
spacing: Theme.spacingXS
StyledText {
text: {
if (fieldsInfo.length > 0)
return I18n.tr("Enter credentials for ") + wifiPasswordSSID;
if (isVpnPrompt)
return I18n.tr("Enter password for ") + wifiPasswordSSID;
const prefix = requiresEnterprise ? I18n.tr("Enter credentials for ") : I18n.tr("Enter password for ");
return prefix + wifiPasswordSSID;
}
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceTextMedium
width: parent.width
elide: Text.ElideRight
}
StyledText {
visible: isPromptMode && promptReason === "wrong-password"
text: I18n.tr("Incorrect password")
font.pixelSize: Theme.fontSizeSmall
color: Theme.error
width: parent.width
}
} }
} }
} }
DankActionButton { Row {
iconName: "close" spacing: Theme.spacingXS
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText DankActionButton {
onClicked: clearAndClose() visible: windowControls.supported
iconName: root.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton {
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: clearAndClose()
}
} }
} }
@@ -624,7 +644,7 @@ FloatingWindow {
color: connectArea.containsMouse ? Qt.darker(Theme.primary, 1.1) : Theme.primary color: connectArea.containsMouse ? Qt.darker(Theme.primary, 1.1) : Theme.primary
enabled: { enabled: {
if (fieldsInfo.length > 0) { if (fieldsInfo.length > 0) {
for (let i = 0; i < fieldsInfo.length; i++) { for (var i = 0; i < fieldsInfo.length; i++) {
if (!fieldsInfo[i].isSecret) if (!fieldsInfo[i].isSecret)
continue; continue;
const fieldName = fieldsInfo[i].name; const fieldName = fieldsInfo[i].name;
@@ -668,4 +688,9 @@ FloatingWindow {
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: root
}
} }

View File

@@ -202,7 +202,7 @@ Item {
color: "transparent" color: "transparent"
WlrLayershell.namespace: "quickshell:desktop-widget:" + root.pluginId + (root.instanceId ? ":" + root.instanceId : "") WlrLayershell.namespace: "quickshell:desktop-widget:" + root.pluginId + (root.instanceId ? ":" + root.instanceId : "")
WlrLayershell.layer: WlrLayer.Bottom WlrLayershell.layer: root.isInteracting && !CompositorService.useHyprlandFocusGrab ? WlrLayer.Overlay : WlrLayer.Bottom
WlrLayershell.exclusionMode: ExclusionMode.Ignore WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.keyboardFocus: { WlrLayershell.keyboardFocus: {
if (!root.isInteracting) if (!root.isInteracting)

View File

@@ -1,4 +1,4 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior
import QtQuick import QtQuick
import Quickshell import Quickshell
@@ -189,6 +189,12 @@ FloatingWindow {
width: parent.width width: parent.width
height: 48 height: 48
MouseArea {
anchors.fill: parent
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Theme.withAlpha(Theme.surfaceContainer, 0.5) color: Theme.withAlpha(Theme.surfaceContainer, 0.5)
@@ -216,15 +222,28 @@ FloatingWindow {
} }
} }
DankActionButton { Row {
circular: false
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Theme.spacingM anchors.rightMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: root.hide() spacing: Theme.spacingXS
DankActionButton {
visible: windowControls.supported
circular: false
iconName: root.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton {
circular: false
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: root.hide()
}
} }
} }
@@ -414,4 +433,9 @@ FloatingWindow {
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: root
}
} }

View File

@@ -29,7 +29,6 @@ FloatingWindow {
if (!SessionData.showThirdPartyPlugins && !isFirstParty) if (!SessionData.showThirdPartyPlugins && !isFirstParty)
continue; continue;
if (typeFilter !== "") { if (typeFilter !== "") {
var hasCapability = plugin.capabilities && plugin.capabilities.includes(typeFilter); var hasCapability = plugin.capabilities && plugin.capabilities.includes(typeFilter);
if (!hasCapability) if (!hasCapability)
@@ -108,12 +107,12 @@ FloatingWindow {
var pluginId = PopoutService.pendingPluginInstall; var pluginId = PopoutService.pendingPluginInstall;
PopoutService.pendingPluginInstall = ""; PopoutService.pendingPluginInstall = "";
urlInstallConfirm.showWithOptions({ urlInstallConfirm.showWithOptions({
title: I18n.tr("Install Plugin", "plugin installation dialog title"), "title": I18n.tr("Install Plugin", "plugin installation dialog title"),
message: I18n.tr("Install plugin '%1' from the DMS registry?", "plugin installation confirmation").arg(pluginId), "message": I18n.tr("Install plugin '%1' from the DMS registry?", "plugin installation confirmation").arg(pluginId),
confirmText: I18n.tr("Install", "install action button"), "confirmText": I18n.tr("Install", "install action button"),
cancelText: I18n.tr("Cancel"), "cancelText": I18n.tr("Cancel"),
onConfirm: () => installPlugin(pluginId, true), "onConfirm": () => installPlugin(pluginId, true),
onCancel: () => hide() "onCancel": () => hide()
}); });
} }
@@ -181,7 +180,9 @@ FloatingWindow {
} }
var updated = root.allPlugins.map(p => { var updated = root.allPlugins.map(p => {
var isInstalled = pluginMap[p.name] || pluginMap[p.id] || false; var isInstalled = pluginMap[p.name] || pluginMap[p.id] || false;
return Object.assign({}, p, { installed: isInstalled }); return Object.assign({}, p, {
"installed": isInstalled
});
}); });
root.allPlugins = updated; root.allPlugins = updated;
root.updateFilteredPlugins(); root.updateFilteredPlugins();
@@ -227,6 +228,12 @@ FloatingWindow {
anchors.top: parent.top anchors.top: parent.top
height: Math.max(headerIcon.height, headerText.height, refreshButton.height, closeButton.height) height: Math.max(headerIcon.height, headerText.height, refreshButton.height, closeButton.height)
MouseArea {
anchors.fill: parent
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
DankIcon { DankIcon {
id: headerIcon id: headerIcon
name: "store" name: "store"
@@ -276,6 +283,14 @@ FloatingWindow {
onClicked: root.refreshPlugins() onClicked: root.refreshPlugins()
} }
DankActionButton {
visible: windowControls.supported
iconName: root.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 2
iconColor: Theme.outline
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton { DankActionButton {
id: closeButton id: closeButton
iconName: "close" iconName: "close"
@@ -718,4 +733,9 @@ FloatingWindow {
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: root
}
} }

View File

@@ -114,12 +114,12 @@ FloatingWindow {
var themeId = PopoutService.pendingThemeInstall; var themeId = PopoutService.pendingThemeInstall;
PopoutService.pendingThemeInstall = ""; PopoutService.pendingThemeInstall = "";
urlInstallConfirm.showWithOptions({ urlInstallConfirm.showWithOptions({
title: I18n.tr("Install Theme", "theme installation dialog title"), "title": I18n.tr("Install Theme", "theme installation dialog title"),
message: I18n.tr("Install theme '%1' from the DMS registry?", "theme installation confirmation").arg(themeId), "message": I18n.tr("Install theme '%1' from the DMS registry?", "theme installation confirmation").arg(themeId),
confirmText: I18n.tr("Install", "install action button"), "confirmText": I18n.tr("Install", "install action button"),
cancelText: I18n.tr("Cancel"), "cancelText": I18n.tr("Cancel"),
onConfirm: () => installTheme(themeId, themeId, true), "onConfirm": () => installTheme(themeId, themeId, true),
onCancel: () => hide() "onCancel": () => hide()
}); });
} }
@@ -222,6 +222,12 @@ FloatingWindow {
anchors.top: parent.top anchors.top: parent.top
height: Math.max(headerIcon.height, headerText.height, refreshButton.height, closeButton.height) height: Math.max(headerIcon.height, headerText.height, refreshButton.height, closeButton.height)
MouseArea {
anchors.fill: parent
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
DankIcon { DankIcon {
id: headerIcon id: headerIcon
name: "palette" name: "palette"
@@ -256,6 +262,14 @@ FloatingWindow {
onClicked: root.refreshThemes() onClicked: root.refreshThemes()
} }
DankActionButton {
visible: windowControls.supported
iconName: root.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 2
iconColor: Theme.outline
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton { DankActionButton {
id: closeButton id: closeButton
iconName: "close" iconName: "close"
@@ -569,4 +583,9 @@ FloatingWindow {
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: root
}
} }

View File

@@ -175,6 +175,12 @@ FloatingWindow {
width: parent.width width: parent.width
height: 48 height: 48
MouseArea {
anchors.fill: parent
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Theme.surfaceContainer color: Theme.surfaceContainer
@@ -203,15 +209,28 @@ FloatingWindow {
} }
} }
DankActionButton { Row {
circular: false
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Theme.spacingM anchors.rightMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: root.hide() spacing: Theme.spacingXS
DankActionButton {
visible: windowControls.supported
circular: false
iconName: root.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton {
circular: false
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: root.hide()
}
} }
} }
@@ -354,4 +373,9 @@ FloatingWindow {
} }
} }
} }
FloatingWindowControls {
id: windowControls
targetWindow: root
}
} }

View File

@@ -0,0 +1,116 @@
import QtQuick
Item {
id: root
required property var targetWindow
property bool supported: typeof targetWindow.startSystemMove === "function"
anchors.fill: parent
function tryStartMove() {
if (!supported)
return;
targetWindow.startSystemMove();
}
function tryStartResize(edges) {
if (!supported)
return;
targetWindow.startSystemResize(edges);
}
function tryToggleMaximize() {
if (!supported)
return;
targetWindow.maximized = !targetWindow.maximized;
}
MouseArea {
visible: root.supported
height: 6
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.leftMargin: 6
anchors.rightMargin: 6
cursorShape: Qt.SizeVerCursor
onPressed: root.tryStartResize(Qt.TopEdge)
}
MouseArea {
visible: root.supported
width: 6
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 6
anchors.bottomMargin: 6
cursorShape: Qt.SizeHorCursor
onPressed: root.tryStartResize(Qt.LeftEdge)
}
MouseArea {
visible: root.supported
width: 6
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 6
anchors.bottomMargin: 6
cursorShape: Qt.SizeHorCursor
onPressed: root.tryStartResize(Qt.RightEdge)
}
MouseArea {
visible: root.supported
width: 6
height: 6
anchors.left: parent.left
anchors.top: parent.top
cursorShape: Qt.SizeFDiagCursor
onPressed: root.tryStartResize(Qt.LeftEdge | Qt.TopEdge)
}
MouseArea {
visible: root.supported
width: 6
height: 6
anchors.right: parent.right
anchors.top: parent.top
cursorShape: Qt.SizeBDiagCursor
onPressed: root.tryStartResize(Qt.RightEdge | Qt.TopEdge)
}
MouseArea {
visible: root.supported
height: 6
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: 6
anchors.rightMargin: 6
cursorShape: Qt.SizeVerCursor
onPressed: root.tryStartResize(Qt.BottomEdge)
}
MouseArea {
visible: root.supported
width: 6
height: 6
anchors.left: parent.left
anchors.bottom: parent.bottom
cursorShape: Qt.SizeBDiagCursor
onPressed: root.tryStartResize(Qt.LeftEdge | Qt.BottomEdge)
}
MouseArea {
visible: root.supported
width: 6
height: 6
anchors.right: parent.right
anchors.bottom: parent.bottom
cursorShape: Qt.SizeFDiagCursor
onPressed: root.tryStartResize(Qt.RightEdge | Qt.BottomEdge)
}
}