From 9f4d83a9ce15397d8d30ca825ad27bcc0da8c612 Mon Sep 17 00:00:00 2001 From: Anton Kharuzhy Date: Fri, 27 Sep 2024 15:37:24 +0200 Subject: [PATCH] #55: mouse handlers added to spacers --- package/contents/ui/MouseHandlers.qml | 40 +++++++++++++++++++++ package/contents/ui/main.qml | 50 +++++---------------------- package/metadata.json | 2 +- 3 files changed, 49 insertions(+), 43 deletions(-) create mode 100644 package/contents/ui/MouseHandlers.qml diff --git a/package/contents/ui/MouseHandlers.qml b/package/contents/ui/MouseHandlers.qml new file mode 100644 index 0000000..539335d --- /dev/null +++ b/package/contents/ui/MouseHandlers.qml @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: 2024 Anton Kharuzhy + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import QtQuick + +Item { + id: handlers + anchors.fill: parent + + signal invokeKWinShortcut(string shortcut) + + WidgetDragHandler { + Component.onCompleted: { + invokeKWinShortcut.connect(handlers.invokeKWinShortcut); + } + } + + WidgetTapHandler { + Component.onCompleted: { + invokeKWinShortcut.connect(handlers.invokeKWinShortcut); + } + } + + WidgetWheelHandler { + orientation: Qt.Vertical + Component.onCompleted: { + invokeKWinShortcut.connect(handlers.invokeKWinShortcut); + } + } + + WidgetWheelHandler { + orientation: Qt.Horizontal + Component.onCompleted: { + invokeKWinShortcut.connect(handlers.invokeKWinShortcut); + } + } +} diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index a6f334c..e8721ce 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -134,27 +134,7 @@ PlasmoidItem { source: tasksModel.activeWindow.icon || "window" enabled: tasksModel.hasActiveWindow && !!tasksModel.activeWindow.icon - WidgetDragHandler { - Component.onCompleted: { - invokeKWinShortcut.connect(root.invokeKWinShortcut); - } - } - - WidgetTapHandler { - Component.onCompleted: { - invokeKWinShortcut.connect(root.invokeKWinShortcut); - } - } - - WidgetWheelHandler { - orientation: Qt.Vertical - Component.onCompleted: { - invokeKWinShortcut.connect(root.invokeKWinShortcut); - } - } - - WidgetWheelHandler { - orientation: Qt.Horizontal + MouseHandlers { Component.onCompleted: { invokeKWinShortcut.connect(root.invokeKWinShortcut); } @@ -174,6 +154,12 @@ PlasmoidItem { Layout.preferredWidth: width color: "transparent" enabled: tasksModel.hasActiveWindow + + MouseHandlers { + Component.onCompleted: { + invokeKWinShortcut.connect(root.invokeKWinShortcut); + } + } } } @@ -241,27 +227,7 @@ PlasmoidItem { Component.onCompleted: updateTitleTextReplacements() - WidgetDragHandler { - Component.onCompleted: { - invokeKWinShortcut.connect(root.invokeKWinShortcut); - } - } - - WidgetTapHandler { - Component.onCompleted: { - invokeKWinShortcut.connect(root.invokeKWinShortcut); - } - } - - WidgetWheelHandler { - orientation: Qt.Vertical - Component.onCompleted: { - invokeKWinShortcut.connect(root.invokeKWinShortcut); - } - } - - WidgetWheelHandler { - orientation: Qt.Horizontal + MouseHandlers { Component.onCompleted: { invokeKWinShortcut.connect(root.invokeKWinShortcut); } diff --git a/package/metadata.json b/package/metadata.json index 55decb0..11b8bae 100644 --- a/package/metadata.json +++ b/package/metadata.json @@ -12,7 +12,7 @@ "Id": "com.github.antroids.application-title-bar", "Name": "Application Title Bar", "License": "GPL-3.0+", - "Version": "0.7.3", + "Version": "0.7.4", "Website": "https://github.com/antroids/application-title-bar", "FormFactors": [ "desktop"