Improved the dock, still needs some love
This commit is contained in:
parent
8ee5c34543
commit
f80e6a0294
1 changed files with 34 additions and 33 deletions
|
|
@ -30,6 +30,7 @@ NLoader {
|
||||||
property int showAnimationDuration: 150
|
property int showAnimationDuration: 150
|
||||||
property int peekHeight: 2
|
property int peekHeight: 2
|
||||||
property int fullHeight: dockContainer.height
|
property int fullHeight: dockContainer.height
|
||||||
|
property int iconSize: 48
|
||||||
|
|
||||||
// Track hover state
|
// Track hover state
|
||||||
property bool dockHovered: false
|
property bool dockHovered: false
|
||||||
|
|
@ -44,19 +45,24 @@ NLoader {
|
||||||
visible: modelData ? Settings.data.dock.monitors.includes(modelData.name) : false
|
visible: modelData ? Settings.data.dock.monitors.includes(modelData.name) : false
|
||||||
|
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
anchors.bottom: true
|
anchors.bottom: true
|
||||||
anchors.left: true
|
anchors.left: true
|
||||||
anchors.right: true
|
anchors.right: true
|
||||||
focusable: false
|
focusable: false
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
implicitHeight: 60
|
implicitHeight: iconSize * 1.5 * scaling
|
||||||
|
|
||||||
// Timer for auto-hide delay
|
// Timer for auto-hide delay
|
||||||
Timer {
|
Timer {
|
||||||
id: hideTimer
|
id: hideTimer
|
||||||
interval: hideDelay
|
interval: hideDelay
|
||||||
onTriggered: if (autoHide && !dockHovered && !anyAppHovered)
|
onTriggered: {
|
||||||
hidden = true
|
if (autoHide && !dockHovered && !anyAppHovered) {
|
||||||
|
hidden = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer for show delay
|
// Timer for show delay
|
||||||
|
|
@ -80,7 +86,7 @@ NLoader {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
height: 10
|
height: 10 * scaling
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
|
|
||||||
|
|
@ -104,13 +110,13 @@ NLoader {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: dockContainer
|
id: dockContainer
|
||||||
width: dock.width + 40
|
width: dock.width + 48 * scaling
|
||||||
height: 50
|
height: iconSize * 1.5 * scaling
|
||||||
color: Colors.mSurface
|
color: Colors.mSurfaceVariant
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
topLeftRadius: 20
|
topLeftRadius: Style.radiusLarge * scaling
|
||||||
topRightRadius: 20
|
topRightRadius: Style.radiusLarge * scaling
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: dockMouseArea
|
id: dockMouseArea
|
||||||
|
|
@ -136,7 +142,7 @@ NLoader {
|
||||||
Item {
|
Item {
|
||||||
id: dock
|
id: dock
|
||||||
width: runningAppsRow.width
|
width: runningAppsRow.width
|
||||||
height: parent.height - 10
|
height: parent.height - (20 * scaling)
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
NTooltip {
|
NTooltip {
|
||||||
|
|
@ -160,7 +166,7 @@ NLoader {
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: runningAppsRow
|
id: runningAppsRow
|
||||||
spacing: 8
|
spacing: Style.marginLarge * scaling
|
||||||
height: parent.height
|
height: parent.height
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
|
@ -169,9 +175,8 @@ NLoader {
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: appButton
|
id: appButton
|
||||||
width: 36
|
width: iconSize * scaling
|
||||||
height: 36
|
height: iconSize * scaling
|
||||||
radius: 18
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
property bool isActive: ToplevelManager.activeToplevel && ToplevelManager.activeToplevel === modelData
|
property bool isActive: ToplevelManager.activeToplevel && ToplevelManager.activeToplevel === modelData
|
||||||
|
|
@ -179,32 +184,28 @@ NLoader {
|
||||||
property string appId: modelData ? modelData.appId : ""
|
property string appId: modelData ? modelData.appId : ""
|
||||||
property string appTitle: modelData ? modelData.title : ""
|
property string appTitle: modelData ? modelData.title : ""
|
||||||
|
|
||||||
Behavior on color {
|
// The icon
|
||||||
ColorAnimation {
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: appIcon
|
id: appIcon
|
||||||
width: 28
|
width: iconSize * scaling
|
||||||
height: 28
|
height: iconSize * scaling
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
source: dock.getAppIcon(modelData)
|
source: dock.getAppIcon(modelData)
|
||||||
visible: source.toString() !== ""
|
visible: source.toString() !== ""
|
||||||
smooth: false
|
smooth: true
|
||||||
mipmap: false
|
mipmap: false
|
||||||
antialiasing: false
|
antialiasing: false
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
// Fall back if no icon
|
||||||
|
NText {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: !appIcon.visible
|
visible: !appIcon.visible
|
||||||
text: appButton.appId ? appButton.appId.charAt(0).toUpperCase() : "?"
|
text: "question_mark"
|
||||||
font.pixelSize: 14
|
font.family: "Material Symbols Rounded"
|
||||||
font.bold: true
|
font.pointSize: iconSize * 0.7 * scaling
|
||||||
color: appButton.isActive ? Colors.mPrimary : Colors.mOnSurface
|
color: appButton.isActive ? Colors.mPrimary : Colors.mOnSurfaceVariant
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
@ -252,13 +253,13 @@ NLoader {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: isActive
|
visible: isActive
|
||||||
width: 20
|
width: iconSize * 0.75
|
||||||
height: 3
|
height: 4 * scaling
|
||||||
color: Colors.mPrimary
|
color: Colors.mPrimary
|
||||||
radius: 1.5
|
radius: Style.radiusTiny
|
||||||
anchors.bottom: parent.bottom
|
anchors.top: parent.bottom
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.bottomMargin: 2
|
anchors.topMargin: 2* scaling
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue