wip
This commit is contained in:
parent
d711bc59e9
commit
fd04b21188
4 changed files with 174 additions and 13 deletions
|
@ -4,6 +4,9 @@ import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
|
// Add a property to control activation widget visibility
|
||||||
|
property bool isActivationWidgetVisible: false
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
// Create the panel once on each monitor.
|
// Create the panel once on each monitor.
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
@ -36,6 +39,9 @@ ShellRoot {
|
||||||
// fullscreen windows.
|
// fullscreen windows.
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
|
||||||
|
// Only show when isActivationWidgetVisible is true
|
||||||
|
visible: root.isActivationWidgetVisible
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
|
@ -51,6 +57,14 @@ ShellRoot {
|
||||||
font.pointSize: 14
|
font.pointSize: 14
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add a click handler to close the widget
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
root.isActivationWidgetVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,17 @@ Item {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: Appearance.padding.large
|
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 {
|
StyledRect {
|
||||||
|
|
|
@ -262,24 +262,155 @@ Column {
|
||||||
// Add mouse wheel scrolling
|
// Add mouse wheel scrolling
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
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: {
|
onWheel: {
|
||||||
if (wheel.angleDelta.y > 0) {
|
if (!canScroll) return
|
||||||
// Going to previous month
|
|
||||||
if (monthView.currentIndex === 0) {
|
// Handle two-finger scroll (horizontal)
|
||||||
root.currentYear--
|
if (wheel.angleDelta.x !== 0) {
|
||||||
monthView.currentIndex = 11
|
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 {
|
} else {
|
||||||
monthView.decrementCurrentIndex()
|
// Going to next month
|
||||||
|
if (monthView.currentIndex === 11) {
|
||||||
|
root.currentYear++
|
||||||
|
monthView.currentIndex = 0
|
||||||
|
} else {
|
||||||
|
monthView.incrementCurrentIndex()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// Going to next month
|
// Handle vertical scroll (optional, can be removed if not needed)
|
||||||
if (monthView.currentIndex === 11) {
|
else if (wheel.angleDelta.y !== 0) {
|
||||||
root.currentYear++
|
const scrollDown = wheel.angleDelta.y < 0
|
||||||
monthView.currentIndex = 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 {
|
} 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
|
// Day headers
|
||||||
Repeater {
|
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 {
|
StyledText {
|
||||||
width: 30
|
width: 30
|
||||||
|
|
|
@ -116,6 +116,7 @@ Variants {
|
||||||
property bool session
|
property bool session
|
||||||
property bool launcher
|
property bool launcher
|
||||||
property bool dashboard
|
property bool dashboard
|
||||||
|
property bool isActivationWidgetVisible
|
||||||
|
|
||||||
Component.onCompleted: Visibilities.screens[scope.modelData] = this
|
Component.onCompleted: Visibilities.screens[scope.modelData] = this
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue