From 91484b5edd7874dff5738fd83cf07c68165e3ce1 Mon Sep 17 00:00:00 2001 From: voidarc Date: Wed, 26 Aug 2026 17:46:03 +0100 Subject: [PATCH] added tablet mode for mobile03 --- Bar.qml | 2 +- Bar/Time.qml | 138 ++++++++++++++++++++++++++++++++++++++- Components/Container.qml | 50 ++++++++++++-- Services/IpcManager.qml | 13 ++++ 4 files changed, 197 insertions(+), 6 deletions(-) diff --git a/Bar.qml b/Bar.qml index 4d61f2a..a0f8a71 100644 --- a/Bar.qml +++ b/Bar.qml @@ -23,7 +23,7 @@ Scope { PanelWindow { id: win - property double barExclusionZone: 15 + property double barExclusionZone: IpcManager.tabletMode ? 35 : 15 property double barMaxHeight: modelData.height required property var modelData property HyprlandMonitor monitor: Hyprland.monitorFor(modelData) diff --git a/Bar/Time.qml b/Bar/Time.qml index c60c278..82545aa 100644 --- a/Bar/Time.qml +++ b/Bar/Time.qml @@ -29,7 +29,8 @@ Container { property bool notified: false boxColor: Colors.mauve - defaultItem: time + boxWidth: IpcManager.tabletMode ? 600 : 100 + defaultItem: IpcManager.tabletMode ? tabletTime : time exclusiveMonitor: root.monitor exclusiveToScreen: true @@ -330,6 +331,141 @@ Container { } } + Component { + id: tabletTime + + Item { + property string component: "tabletTime" + + Rectangle { + color: Colors.surface1 + radius: root.boxRadius - 2 + + anchors { + fill: parent + margins: 3 + } + + Row { + anchors { + bottom: parent.bottom + bottomMargin: 3 + left: parent.left + leftMargin: 4 + top: parent.top + topMargin: 3 + } + + Rectangle { + color: Colors.overlay0 + implicitWidth: 25 + radius: root.boxRadius - 4 + + anchors { + bottom: parent.bottom + top: parent.top + } + + TapHandler { + onTapped: { + console.log("kando"); + } + } + + StyledText { + anchors.fill: parent + color: Colors.mauve + fontSize: 14 + fontWeight: 10 + horizontalAlignment: Qt.AlignHCenter + propo: true + text: "󱗿" + verticalAlignment: Qt.AlignVCenter + } + } + } + + CenteredText { + color: Colors.mauve + text: TimeManager.time + } + } + + Row { + spacing: 3 + + anchors { + bottom: parent.bottom + bottomMargin: 3 + right: parent.right + rightMargin: 7 + top: parent.top + topMargin: 3 + } + + Rectangle { + color: Colors.overlay0 + implicitWidth: 25 + radius: root.boxRadius - 4 + + anchors { + bottom: parent.bottom + bottomMargin: 3 + top: parent.top + topMargin: 3 + } + + TapHandler { + onTapped: { + WorkspaceManager.activateWorkspaceById("-1"); + } + } + + StyledText { + anchors.fill: parent + color: Colors.mauve + fontSize: 14 + fontWeight: 10 + horizontalAlignment: Qt.AlignHCenter + propo: true + text: "" + verticalAlignment: Qt.AlignVCenter + } + } + + Rectangle { + color: Colors.overlay0 + implicitWidth: 25 + radius: root.boxRadius - 4 + + anchors { + bottom: parent.bottom + bottomMargin: 3 + top: parent.top + topMargin: 3 + } + + TapHandler { + onTapped: { + Hyprland.dispatch(`hl.dsp.focus({workspace = "+1"})`); + } + } + + StyledText { + anchors.fill: parent + color: Colors.mauve + fontSize: 14 + fontWeight: 10 + horizontalAlignment: Qt.AlignHCenter + propo: true + text: "" + verticalAlignment: Qt.AlignVCenter + } + } + } + } + } + Component { id: notification diff --git a/Components/Container.qml b/Components/Container.qml index e1e1a30..89ee900 100644 --- a/Components/Container.qml +++ b/Components/Container.qml @@ -5,6 +5,7 @@ import Quickshell import Quickshell.Hyprland import "../Color.js" as Colors +import "../Services/" Item { id: root @@ -78,6 +79,7 @@ Item { State { name: "closed" when: root.hovered == false && root.boxOpened == false && root.overriden == false + && IpcManager.tabletMode == false PropertyChanges { container.radius: root.boxRadius @@ -91,19 +93,38 @@ Item { } } }, + State { + name: "tablet" + when: root.hovered == false && root.boxOpened == false && root.overriden == false + && IpcManager.tabletMode == true + + PropertyChanges { + container.radius: root.boxRadius + root.implicitHeight: 33 + root.implicitWidth: root.boxWidth + } + + StateChangeScript { + script: { + stack.replace(root.defaultItem); + } + } + }, State { name: "hovered" when: root.hovered == true && root.boxOpened == false && root.overriden == false PropertyChanges { container.radius: root.boxRadius + 3 - root.implicitHeight: root.boxHeight + 2 + root.implicitHeight: IpcManager.tabletMode ? 35 : root.boxHeight + 2 root.implicitWidth: root.boxWidth + 2 } StateChangeScript { script: { - stack.replace(root.defaultItem); + if (IpcManager.tabletMode == false) { + stack.replace(root.defaultItem); + } } } }, @@ -182,8 +203,11 @@ Item { } else { root.hovered = false; root.boxOpened = false; - if (root.state == "closed") { - root.stack.replace(root.defaultItem); + if (root.state == "closed" || root.state == "tablet") { + if (IpcManager.tabletMode == false) { + root.stack.replace(root.defaultItem); + console.log("some"); + } } } } @@ -199,6 +223,24 @@ Item { } } + TapHandler { + id: touchScreenTapHandler + + acceptedDevices: PointerDevice.TouchScreen + + onGrabChanged: state => { + if (state == 1) { + if (root.openedItem) { + root.hovered = true; + root.boxOpened = true; + } + } else if (state == 2) { + root.hovered = false; + root.boxOpened = false; + } + } + } + Rectangle { id: container diff --git a/Services/IpcManager.qml b/Services/IpcManager.qml index 767db62..a6c0ff8 100644 --- a/Services/IpcManager.qml +++ b/Services/IpcManager.qml @@ -10,9 +10,12 @@ Singleton { property var focusState: WlrKeyboardFocus.None property bool logoutMenuOpen: false + property bool tabletMode: true signal closeLogoutMenu + signal enableTabletMode signal logoutMenu + signal normalMode onCloseLogoutMenu: { root.focusState = WlrKeyboardFocus.None; @@ -20,6 +23,16 @@ Singleton { } IpcHandler { + function disableTabletMode(): void { + root.normalMode(); + root.tabletMode = false; + } + + function enableTabletMode(): void { + root.enableTabletMode(); + root.tabletMode = true; + } + function openLogoutMenu(): void { root.logoutMenu(); root.focusState = WlrKeyboardFocus.Exclusive;