diff --git a/activate-linux.qml b/activate-linux.qml index d5e442e..64b58b0 100644 --- a/activate-linux.qml +++ b/activate-linux.qml @@ -4,6 +4,9 @@ import Quickshell import Quickshell.Wayland ShellRoot { + // Add a property to control activation widget visibility + property bool isActivationWidgetVisible: false + Variants { // Create the panel once on each monitor. model: Quickshell.screens @@ -36,6 +39,9 @@ ShellRoot { // fullscreen windows. WlrLayershell.layer: WlrLayer.Overlay + // Only show when isActivationWidgetVisible is true + visible: root.isActivationWidgetVisible + ColumnLayout { id: content @@ -51,6 +57,14 @@ ShellRoot { font.pointSize: 14 } } + + // Add a click handler to close the widget + MouseArea { + anchors.fill: parent + onClicked: { + root.isActivationWidgetVisible = false + } + } } } } diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 1696649..b3723f2 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -87,6 +87,17 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: Appearance.padding.large + + MouseArea { + anchors.fill: parent + onClicked: { + // Toggle the activation widget visibility + const v = Visibilities.screens[QsWindow.window.screen]; + if (v) { + v.isActivationWidgetVisible = !v.isActivationWidgetVisible; + } + } + } } StyledRect { diff --git a/modules/bar/popouts/Calendar.qml b/modules/bar/popouts/Calendar.qml index 2b4141a..ffea53f 100644 --- a/modules/bar/popouts/Calendar.qml +++ b/modules/bar/popouts/Calendar.qml @@ -262,24 +262,155 @@ Column { // Add mouse wheel scrolling MouseArea { anchors.fill: parent + property bool canScroll: true + property Timer scrollTimer: Timer { + interval: 100 // Debounce time between scrolls + onTriggered: parent.canScroll = true + } + + // Configurable scroll direction + property bool invertScrollDirection: false // Set to true to invert the scroll direction + onWheel: { - if (wheel.angleDelta.y > 0) { - // Going to previous month - if (monthView.currentIndex === 0) { - root.currentYear-- - monthView.currentIndex = 11 + if (!canScroll) return + + // Handle two-finger scroll (horizontal) + if (wheel.angleDelta.x !== 0) { + const scrollRight = wheel.angleDelta.x > 0 + const shouldGoBack = invertScrollDirection ? !scrollRight : scrollRight + + if (shouldGoBack) { + // Going to previous month + if (monthView.currentIndex === 0) { + root.currentYear-- + monthView.currentIndex = 11 + } else { + monthView.decrementCurrentIndex() + } } else { - monthView.decrementCurrentIndex() + // Going to next month + if (monthView.currentIndex === 11) { + root.currentYear++ + monthView.currentIndex = 0 + } else { + monthView.incrementCurrentIndex() + } } - } else { - // Going to next month - if (monthView.currentIndex === 11) { - root.currentYear++ - monthView.currentIndex = 0 + } + // Handle vertical scroll (optional, can be removed if not needed) + else if (wheel.angleDelta.y !== 0) { + const scrollDown = wheel.angleDelta.y < 0 + const shouldGoBack = invertScrollDirection ? !scrollDown : scrollDown + + if (shouldGoBack) { + // Going to previous month + if (monthView.currentIndex === 0) { + root.currentYear-- + monthView.currentIndex = 11 + } else { + monthView.decrementCurrentIndex() + } } else { - monthView.incrementCurrentIndex() + // Going to next month + if (monthView.currentIndex === 11) { + root.currentYear++ + monthView.currentIndex = 0 + } else { + monthView.incrementCurrentIndex() + } } } + + // Prevent rapid scrolling + canScroll = false + scrollTimer.restart() + } + } + + // Add touch gesture support with percentage-based scrolling + MouseArea { + anchors.fill: parent + property real startX: 0 + property bool isDragging: false + property real scrollPercentage: 0.0 // 0.0 to 1.0, represents progress to next/prev month + property real scrollSpeed: 0.1 // Adjust this to control how fast months change (lower = slower) + + onPressed: (mouse) => { + startX = mouse.x + isDragging = true + scrollPercentage = 0.0 + } + + onReleased: { + isDragging = false + scrollPercentage = 0.0 + } + + onPositionChanged: (mouse) => { + if (!isDragging) return + + const dragDistance = mouse.x - startX + const maxDragDistance = monthView.width * 0.5 // Half the width for full month transition + + // Calculate scroll percentage (-1.0 to 1.0) + scrollPercentage = Math.max(-1.0, Math.min(1.0, dragDistance / maxDragDistance)) + + // Only trigger month change when we've scrolled enough + if (Math.abs(scrollPercentage) >= scrollSpeed) { + if (scrollPercentage > 0) { + // Scrolling right - previous month + if (monthView.currentIndex === 0) { + root.currentYear-- + monthView.currentIndex = 11 + } else { + monthView.decrementCurrentIndex() + } + } else { + // Scrolling left - next month + if (monthView.currentIndex === 11) { + root.currentYear++ + monthView.currentIndex = 0 + } else { + monthView.incrementCurrentIndex() + } + } + // Reset scroll percentage after month change + scrollPercentage = 0.0 + startX = mouse.x + } + } + } + + // Add Today button + Rectangle { + id: todayButton + visible: root.currentYear !== new Date().getFullYear() || monthView.currentIndex !== new Date().getMonth() + anchors { + top: parent.top + horizontalCenter: parent.horizontalCenter + topMargin: -24 + } + width: todayText.width + 20 + height: 25 + color: mouseArea.containsMouse ? "#3d3d3d" : "#2d2d2d" + radius: 4 + + Text { + id: todayText + anchors.centerIn: parent + text: "Today" + color: "#ffffff" + font.pixelSize: 12 + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: { + root.currentYear = new Date().getFullYear() + monthView.currentIndex = new Date().getMonth() + } } } @@ -308,7 +439,11 @@ Column { // Day headers Repeater { - model: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] + // English notation + // model: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] + + // German notation + model: ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"] StyledText { width: 30 diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml index 9930c6d..5a8930f 100644 --- a/modules/drawers/Drawers.qml +++ b/modules/drawers/Drawers.qml @@ -116,6 +116,7 @@ Variants { property bool session property bool launcher property bool dashboard + property bool isActivationWidgetVisible Component.onCompleted: Visibilities.screens[scope.modelData] = this }