Dock: Float improvements, can click below dock and on the side. Should fix #237
This commit is contained in:
parent
3c97acf00f
commit
c8886629ad
2 changed files with 325 additions and 275 deletions
|
|
@ -12,10 +12,10 @@ import qs.Widgets
|
||||||
Variants {
|
Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
||||||
delegate: Loader {
|
delegate: Item {
|
||||||
|
|
||||||
required property ShellScreen modelData
|
required property ShellScreen modelData
|
||||||
property real scaling: ScalingService.getScreenScale(modelData)
|
property real scaling: ScalingService.getScreenScale(modelData)
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: ScalingService
|
target: ScalingService
|
||||||
function onScaleChanged(screenName, scale) {
|
function onScaleChanged(screenName, scale) {
|
||||||
|
|
@ -25,61 +25,39 @@ Variants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
active: Settings.isLoaded && modelData ? Settings.data.dock.monitors.includes(modelData.name) : false
|
// Shared properties between peek and dock windows
|
||||||
|
|
||||||
sourceComponent: PanelWindow {
|
|
||||||
id: dockWindow
|
|
||||||
|
|
||||||
screen: modelData
|
|
||||||
|
|
||||||
readonly property bool autoHide: Settings.data.dock.autoHide
|
readonly property bool autoHide: Settings.data.dock.autoHide
|
||||||
readonly property int hideDelay: 500
|
readonly property int hideDelay: 500
|
||||||
readonly property int showDelay: 100
|
readonly property int showDelay: 100
|
||||||
readonly property int hideAnimationDuration: Style.animationFast
|
readonly property int hideAnimationDuration: Style.animationFast
|
||||||
readonly property int showAnimationDuration: Style.animationFast
|
readonly property int showAnimationDuration: Style.animationFast
|
||||||
readonly property int peekHeight: 7 * scaling
|
readonly property int peekHeight: 1 // no scaling for peek
|
||||||
readonly property int fullHeight: dockContainer.height
|
|
||||||
readonly property int iconSize: 36 * scaling
|
readonly property int iconSize: 36 * scaling
|
||||||
readonly property int floatingMargin: Settings.data.dock.floatingRatio * Style.marginL * scaling // Margin to make dock float
|
readonly property int floatingMargin: Settings.data.dock.floatingRatio * Style.marginL * scaling
|
||||||
|
|
||||||
// Bar detection and positioning properties
|
// Bar detection and positioning properties
|
||||||
readonly property bool hasBar: modelData.name ? (Settings.data.bar.monitors.includes(modelData.name)
|
readonly property bool hasBar: modelData.name ? (Settings.data.bar.monitors.includes(modelData.name)
|
||||||
|| (Settings.data.bar.monitors.length === 0)) : false
|
|| (Settings.data.bar.monitors.length === 0)) : false
|
||||||
readonly property bool barAtBottom: hasBar && Settings.data.bar.position === "bottom"
|
readonly property bool barAtBottom: hasBar && Settings.data.bar.position === "bottom"
|
||||||
readonly property bool barAtTop: hasBar && Settings.data.bar.position === "top"
|
readonly property int barHeight: Style.barHeight * scaling
|
||||||
readonly property int barHeight: (barAtBottom || barAtTop) ? Settings.data.bar.height * scaling : 0
|
|
||||||
readonly property int dockSpacing: 8 * scaling // Space between dock and bar/edge
|
|
||||||
|
|
||||||
// Track hover state
|
// Shared state between windows
|
||||||
property bool dockHovered: false
|
property bool dockHovered: false
|
||||||
property bool anyAppHovered: false
|
property bool anyAppHovered: false
|
||||||
property bool hidden: autoHide
|
property bool hidden: autoHide
|
||||||
|
property bool peekHovered: false
|
||||||
|
|
||||||
// Dock is positioned at the bottom
|
// Separate property to control Loader - stays true during animations
|
||||||
anchors.bottom: true
|
property bool dockLoaded: !autoHide // Start loaded if autoHide is off
|
||||||
focusable: false
|
|
||||||
color: Color.transparent
|
|
||||||
|
|
||||||
WlrLayershell.namespace: "noctalia-dock"
|
// Timer to unload dock after hide animation completes
|
||||||
WlrLayershell.exclusionMode: Settings.data.dock.exclusive ? ExclusionMode.Auto : ExclusionMode.Ignore
|
Timer {
|
||||||
|
id: unloadTimer
|
||||||
// Set the window size - include extra height only if bar is at bottom
|
interval: hideAnimationDuration + 50 // Add small buffer
|
||||||
implicitWidth: dockContainer.width + (Style.marginM * 2 * scaling)
|
onTriggered: {
|
||||||
implicitHeight: fullHeight + floatingMargin + (barAtBottom ? barHeight + dockSpacing : 0)
|
if (hidden && autoHide) {
|
||||||
|
dockLoaded = false
|
||||||
// Position the entire window above the bar only when bar is at bottom
|
}
|
||||||
margins.bottom: barAtBottom ? barHeight : 0
|
|
||||||
|
|
||||||
// Watch for autoHide setting changes
|
|
||||||
onAutoHideChanged: {
|
|
||||||
if (!autoHide) {
|
|
||||||
// If auto-hide is disabled, show the dock
|
|
||||||
hidden = false
|
|
||||||
hideTimer.stop()
|
|
||||||
showTimer.stop()
|
|
||||||
} else {
|
|
||||||
// If auto-hide is enabled, start hidden
|
|
||||||
hidden = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,8 +66,9 @@ Variants {
|
||||||
id: hideTimer
|
id: hideTimer
|
||||||
interval: hideDelay
|
interval: hideDelay
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (autoHide && !dockHovered && !anyAppHovered && !peekArea.containsMouse) {
|
if (autoHide && !dockHovered && !anyAppHovered && !peekHovered) {
|
||||||
hidden = true
|
hidden = true
|
||||||
|
unloadTimer.restart() // Start unload timer when hiding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -100,47 +79,111 @@ Variants {
|
||||||
interval: showDelay
|
interval: showDelay
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (autoHide) {
|
if (autoHide) {
|
||||||
hidden = false
|
dockLoaded = true // Load dock immediately
|
||||||
|
hidden = false // Then trigger show animation
|
||||||
|
unloadTimer.stop() // Cancel any pending unload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Peek area that remains visible when dock is hidden
|
// Watch for autoHide setting changes
|
||||||
|
onAutoHideChanged: {
|
||||||
|
if (!autoHide) {
|
||||||
|
hidden = false
|
||||||
|
dockLoaded = true
|
||||||
|
hideTimer.stop()
|
||||||
|
showTimer.stop()
|
||||||
|
unloadTimer.stop()
|
||||||
|
} else {
|
||||||
|
hidden = true
|
||||||
|
unloadTimer.restart() // Schedule unload after animation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PEEK WINDOW - Always visible when auto-hide is enabled
|
||||||
|
Loader {
|
||||||
|
active: Settings.isLoaded && modelData && Settings.data.dock.monitors.includes(modelData.name) && autoHide
|
||||||
|
|
||||||
|
sourceComponent: PanelWindow {
|
||||||
|
id: peekWindow
|
||||||
|
|
||||||
|
screen: modelData
|
||||||
|
anchors.bottom: true
|
||||||
|
anchors.left: true
|
||||||
|
anchors.right: true
|
||||||
|
focusable: false
|
||||||
|
color: Color.transparent
|
||||||
|
|
||||||
|
WlrLayershell.namespace: "noctalia-dock-peek"
|
||||||
|
WlrLayershell.exclusionMode: ExclusionMode.Auto // Always exclusive
|
||||||
|
|
||||||
|
implicitHeight: peekHeight
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: barAtBottom ? Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity) : Color.transparent
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: peekArea
|
id: peekArea
|
||||||
anchors.bottom: parent.bottom
|
anchors.fill: parent
|
||||||
anchors.left: parent.left
|
hoverEnabled: true
|
||||||
anchors.right: parent.right
|
|
||||||
height: peekHeight + floatingMargin + (barAtBottom ? dockSpacing : 0)
|
|
||||||
hoverEnabled: autoHide
|
|
||||||
visible: autoHide
|
|
||||||
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
if (autoHide && hidden) {
|
peekHovered = true
|
||||||
|
if (hidden) {
|
||||||
showTimer.start()
|
showTimer.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onExited: {
|
onExited: {
|
||||||
if (autoHide && !hidden && !dockHovered && !anyAppHovered) {
|
peekHovered = false
|
||||||
|
if (!hidden && !dockHovered && !anyAppHovered) {
|
||||||
hideTimer.restart()
|
hideTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
// DOCK WINDOW
|
||||||
id: dockContainer
|
Loader {
|
||||||
width: dockLayout.implicitWidth + Style.marginM * scaling * 2
|
active: Settings.isLoaded && modelData && Settings.data.dock.monitors.includes(modelData.name) && dockLoaded
|
||||||
height: Math.round(iconSize * 1.5)
|
|
||||||
color: Qt.alpha(Color.mSurface, Settings.data.dock.backgroundOpacity)
|
sourceComponent: PanelWindow {
|
||||||
|
id: dockWindow
|
||||||
|
|
||||||
|
screen: modelData
|
||||||
|
|
||||||
|
focusable: false
|
||||||
|
color: Color.transparent
|
||||||
|
|
||||||
|
WlrLayershell.namespace: "noctalia-dock-main"
|
||||||
|
WlrLayershell.exclusionMode: Settings.data.dock.exclusive ? ExclusionMode.Auto : ExclusionMode.Ignore
|
||||||
|
|
||||||
|
// Size to fit the dock container exactly
|
||||||
|
implicitWidth: dockContainerWrapper.width
|
||||||
|
implicitHeight: dockContainerWrapper.height
|
||||||
|
|
||||||
|
// Position above the bar if it's at bottom
|
||||||
|
anchors.bottom: true
|
||||||
|
margins.bottom: barAtBottom ? barHeight + floatingMargin : floatingMargin
|
||||||
|
|
||||||
|
// Rectangle {
|
||||||
|
// anchors.fill: parent
|
||||||
|
// color: "#000FF0"
|
||||||
|
// z: -1
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Wrapper item for scale/opacity animations
|
||||||
|
Item {
|
||||||
|
id: dockContainerWrapper
|
||||||
|
width: dockContainer.width
|
||||||
|
height: dockContainer.height
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: floatingMargin + (barAtBottom ? dockSpacing : 0)
|
|
||||||
radius: Style.radiusL * scaling
|
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
|
||||||
border.color: Color.mOutline
|
|
||||||
|
|
||||||
// Fade and zoom animation properties
|
// Apply animations to this wrapper
|
||||||
opacity: hidden ? 0 : 1
|
opacity: hidden ? 0 : 1
|
||||||
scale: hidden ? 0.85 : 1
|
scale: hidden ? 0.85 : 1
|
||||||
|
|
||||||
|
|
@ -159,6 +202,16 @@ Variants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: dockContainer
|
||||||
|
width: dockLayout.implicitWidth + Style.marginM * scaling * 2
|
||||||
|
height: Math.round(iconSize * 1.5)
|
||||||
|
color: Qt.alpha(Color.mSurface, Settings.data.dock.backgroundOpacity)
|
||||||
|
anchors.centerIn: parent
|
||||||
|
radius: Style.radiusL * scaling
|
||||||
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
|
border.color: Color.mOutline
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: dockMouseArea
|
id: dockMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -169,16 +222,13 @@ Variants {
|
||||||
if (autoHide) {
|
if (autoHide) {
|
||||||
showTimer.stop()
|
showTimer.stop()
|
||||||
hideTimer.stop()
|
hideTimer.stop()
|
||||||
if (hidden) {
|
unloadTimer.stop() // Cancel unload if hovering
|
||||||
hidden = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onExited: {
|
onExited: {
|
||||||
dockHovered = false
|
dockHovered = false
|
||||||
// Only start hide timer if we're not hovering over any app or the peek area
|
if (autoHide && !anyAppHovered && !peekHovered) {
|
||||||
if (autoHide && !anyAppHovered && !peekArea.containsMouse) {
|
|
||||||
hideTimer.restart()
|
hideTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +261,8 @@ Variants {
|
||||||
Layout.preferredHeight: iconSize
|
Layout.preferredHeight: iconSize
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
|
||||||
property bool isActive: ToplevelManager.activeToplevel && ToplevelManager.activeToplevel === modelData
|
property bool isActive: ToplevelManager.activeToplevel
|
||||||
|
&& ToplevelManager.activeToplevel === modelData
|
||||||
property bool hovered: appMouseArea.containsMouse
|
property bool hovered: appMouseArea.containsMouse
|
||||||
property string appId: modelData ? modelData.appId : ""
|
property string appId: modelData ? modelData.appId : ""
|
||||||
property string appTitle: modelData ? modelData.title : ""
|
property string appTitle: modelData ? modelData.title : ""
|
||||||
|
|
@ -283,17 +334,14 @@ Variants {
|
||||||
if (autoHide) {
|
if (autoHide) {
|
||||||
showTimer.stop()
|
showTimer.stop()
|
||||||
hideTimer.stop()
|
hideTimer.stop()
|
||||||
if (hidden) {
|
unloadTimer.stop() // Cancel unload if hovering app
|
||||||
hidden = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onExited: {
|
onExited: {
|
||||||
anyAppHovered = false
|
anyAppHovered = false
|
||||||
appTooltip.hide()
|
appTooltip.hide()
|
||||||
// Only start hide timer if we're not hovering over the dock or peek area
|
if (autoHide && !dockHovered && !peekHovered) {
|
||||||
if (autoHide && !dockHovered && !peekArea.containsMouse) {
|
|
||||||
hideTimer.restart()
|
hideTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -341,4 +389,6 @@ Variants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,32 +53,32 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColumnLayout {
|
ColumnLayout {
|
||||||
// spacing: Style.marginXXS * scaling
|
spacing: Style.marginXXS * scaling
|
||||||
// Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
// NLabel {
|
NLabel {
|
||||||
// label: "Dock Floating Distance"
|
label: "Dock Floating Distance"
|
||||||
// description: "Adjust the floating distance from the screen edge."
|
description: "Adjust the floating distance from the screen edge."
|
||||||
// }
|
}
|
||||||
|
|
||||||
// RowLayout {
|
RowLayout {
|
||||||
// NSlider {
|
NSlider {
|
||||||
// Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
// from: 0
|
from: 0
|
||||||
// to: 4
|
to: 4
|
||||||
// stepSize: 0.01
|
stepSize: 0.01
|
||||||
// value: Settings.data.dock.floatingRatio
|
value: Settings.data.dock.floatingRatio
|
||||||
// onMoved: Settings.data.dock.floatingRatio = value
|
onMoved: Settings.data.dock.floatingRatio = value
|
||||||
// cutoutColor: Color.mSurface
|
cutoutColor: Color.mSurface
|
||||||
// }
|
}
|
||||||
|
|
||||||
// NText {
|
NText {
|
||||||
// text: Math.floor(Settings.data.dock.floatingRatio * 100) + "%"
|
text: Math.floor(Settings.data.dock.floatingRatio * 100) + "%"
|
||||||
// Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
// Layout.leftMargin: Style.marginS * scaling
|
Layout.leftMargin: Style.marginS * scaling
|
||||||
// color: Color.mOnSurface
|
color: Color.mOnSurface
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue