summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/dms/Widgets/FloatingWindowControls.qml
diff options
context:
space:
mode:
authorNippy <nippy@rp1.hu>2026-05-08 19:50:49 +0200
committerNippy <nippy@rp1.hu>2026-05-08 19:50:49 +0200
commit3462bcc46ecf74f576ea4397f16492c16bd75b10 (patch)
treec5ab7aef4498647e057bda8d49c11e5f9dda74c9 /raveos-hyprland-theme/theme-data/dms/Widgets/FloatingWindowControls.qml
parent56616f693b4f263cbf0d47da43b67424efa6022d (diff)
downloadRaveOS-PKGBUILD-3462bcc46ecf74f576ea4397f16492c16bd75b10.tar.gz
RaveOS-PKGBUILD-3462bcc46ecf74f576ea4397f16492c16bd75b10.zip
raveos update
Diffstat (limited to 'raveos-hyprland-theme/theme-data/dms/Widgets/FloatingWindowControls.qml')
-rw-r--r--raveos-hyprland-theme/theme-data/dms/Widgets/FloatingWindowControls.qml118
1 files changed, 118 insertions, 0 deletions
diff --git a/raveos-hyprland-theme/theme-data/dms/Widgets/FloatingWindowControls.qml b/raveos-hyprland-theme/theme-data/dms/Widgets/FloatingWindowControls.qml
new file mode 100644
index 0000000..b56291e
--- /dev/null
+++ b/raveos-hyprland-theme/theme-data/dms/Widgets/FloatingWindowControls.qml
@@ -0,0 +1,118 @@
+import QtQuick
+
+Item {
+ id: root
+
+ readonly property real edgeSize: 8
+ required property var targetWindow
+ property bool supported: typeof targetWindow.startSystemMove === "function"
+ readonly property bool canMaximize: targetWindow.minimumSize.width !== targetWindow.maximumSize.width || targetWindow.minimumSize.height !== targetWindow.maximumSize.height
+
+ anchors.fill: parent
+
+ function tryStartMove() {
+ if (!supported)
+ return;
+ targetWindow.startSystemMove();
+ }
+
+ function tryStartResize(edges) {
+ if (!supported || !canMaximize)
+ return;
+ targetWindow.startSystemResize(edges);
+ }
+
+ function tryToggleMaximize() {
+ if (!supported || !canMaximize)
+ return;
+ targetWindow.maximized = !targetWindow.maximized;
+ }
+
+ MouseArea {
+ visible: root.supported && root.canMaximize
+ height: root.edgeSize
+ 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 && root.canMaximize
+ width: root.edgeSize
+ 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 && root.canMaximize
+ width: root.edgeSize
+ 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 && root.canMaximize
+ width: root.edgeSize
+ height: root.edgeSize
+ anchors.left: parent.left
+ anchors.top: parent.top
+ cursorShape: Qt.SizeFDiagCursor
+ onPressed: root.tryStartResize(Qt.LeftEdge | Qt.TopEdge)
+ }
+
+ MouseArea {
+ visible: root.supported && root.canMaximize
+ width: root.edgeSize
+ height: root.edgeSize
+ anchors.right: parent.right
+ anchors.top: parent.top
+ cursorShape: Qt.SizeBDiagCursor
+ onPressed: root.tryStartResize(Qt.RightEdge | Qt.TopEdge)
+ }
+
+ MouseArea {
+ visible: root.supported && root.canMaximize
+ height: root.edgeSize
+ 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 && root.canMaximize
+ width: root.edgeSize
+ height: root.edgeSize
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ cursorShape: Qt.SizeBDiagCursor
+ onPressed: root.tryStartResize(Qt.LeftEdge | Qt.BottomEdge)
+ }
+
+ MouseArea {
+ visible: root.supported && root.canMaximize
+ width: root.edgeSize
+ height: root.edgeSize
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ cursorShape: Qt.SizeFDiagCursor
+ onPressed: root.tryStartResize(Qt.RightEdge | Qt.BottomEdge)
+ }
+}