mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
feat: Top/Left/Right/Bottom Dock positioning
This commit is contained in:
@@ -991,13 +991,23 @@ Singleton {
|
|||||||
|
|
||||||
function setShowDock(enabled) {
|
function setShowDock(enabled) {
|
||||||
showDock = enabled
|
showDock = enabled
|
||||||
if (enabled && dankBarPosition === SettingsData.Position.Top) {
|
if (enabled && dockPosition === dankBarPosition) {
|
||||||
setDockPosition(SettingsData.Position.Bottom)
|
if (dankBarPosition === SettingsData.Position.Top) {
|
||||||
return
|
setDockPosition(SettingsData.Position.Bottom)
|
||||||
}
|
return
|
||||||
if (enabled && dankBarPosition === SettingsData.Position.Top) {
|
}
|
||||||
setDockPosition(SettingsData.Position.Bottom)
|
if (dankBarPosition === SettingsData.Position.Bottom) {
|
||||||
return
|
setDockPosition(SettingsData.Position.Top)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (dankBarPosition === SettingsData.Position.Left) {
|
||||||
|
setDockPosition(SettingsData.Position.Right)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (dankBarPosition === SettingsData.Position.Right) {
|
||||||
|
setDockPosition(SettingsData.Position.Left)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
@@ -1144,14 +1154,22 @@ Singleton {
|
|||||||
|
|
||||||
function setDankBarPosition(position) {
|
function setDankBarPosition(position) {
|
||||||
dankBarPosition = position
|
dankBarPosition = position
|
||||||
if (position === SettingsData.Position.Bottom && showDock) {
|
if (position === SettingsData.Position.Bottom && dockPosition === SettingsData.Position.Bottom && showDock) {
|
||||||
setDockPosition(SettingsData.Position.Top)
|
setDockPosition(SettingsData.Position.Top)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (position === SettingsData.Position.Top && showDock) {
|
if (position === SettingsData.Position.Top && dockPosition === SettingsData.Position.Top && showDock) {
|
||||||
setDockPosition(SettingsData.Position.Bottom)
|
setDockPosition(SettingsData.Position.Bottom)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (position === SettingsData.Position.Left && dockPosition === SettingsData.Position.Left && showDock) {
|
||||||
|
setDockPosition(SettingsData.Position.Right)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (position === SettingsData.Position.Right && dockPosition === SettingsData.Position.Right && showDock) {
|
||||||
|
setDockPosition(SettingsData.Position.Left)
|
||||||
|
return
|
||||||
|
}
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1163,6 +1181,12 @@ Singleton {
|
|||||||
if (position === SettingsData.Position.Top && dankBarPosition === SettingsData.Position.Top && showDock) {
|
if (position === SettingsData.Position.Top && dankBarPosition === SettingsData.Position.Top && showDock) {
|
||||||
setDankBarPosition(SettingsData.Position.Bottom)
|
setDankBarPosition(SettingsData.Position.Bottom)
|
||||||
}
|
}
|
||||||
|
if (position === SettingsData.Position.Left && dankBarPosition === SettingsData.Position.Left && showDock) {
|
||||||
|
setDankBarPosition(SettingsData.Position.Right)
|
||||||
|
}
|
||||||
|
if (position === SettingsData.Position.Right && dankBarPosition === SettingsData.Position.Right && showDock) {
|
||||||
|
setDankBarPosition(SettingsData.Position.Left)
|
||||||
|
}
|
||||||
saveSettings()
|
saveSettings()
|
||||||
Qt.callLater(() => forceDockLayoutRefresh())
|
Qt.callLater(() => forceDockLayoutRefresh())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ Variants {
|
|||||||
|
|
||||||
WlrLayershell.namespace: "quickshell:dock"
|
WlrLayershell.namespace: "quickshell:dock"
|
||||||
|
|
||||||
|
readonly property bool isVertical: SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: SettingsData.dockPosition === SettingsData.Position.Top
|
top: !isVertical ? (SettingsData.dockPosition === SettingsData.Position.Top) : true
|
||||||
bottom: SettingsData.dockPosition === SettingsData.Position.Bottom
|
bottom: !isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom) : true
|
||||||
left: true
|
left: !isVertical ? true : (SettingsData.dockPosition === SettingsData.Position.Left)
|
||||||
right: true
|
right: !isVertical ? true : (SettingsData.dockPosition === SettingsData.Position.Right)
|
||||||
}
|
}
|
||||||
|
|
||||||
property var modelData: item
|
property var modelData: item
|
||||||
@@ -35,12 +37,20 @@ Variants {
|
|||||||
readonly property real widgetHeight: Math.max(20, 26 + SettingsData.dankBarInnerPadding * 0.6)
|
readonly property real widgetHeight: Math.max(20, 26 + SettingsData.dankBarInnerPadding * 0.6)
|
||||||
readonly property real effectiveBarHeight: Math.max(widgetHeight + SettingsData.dankBarInnerPadding + 4, Theme.barHeight - 4 - (8 - SettingsData.dankBarInnerPadding))
|
readonly property real effectiveBarHeight: Math.max(widgetHeight + SettingsData.dankBarInnerPadding + 4, Theme.barHeight - 4 - (8 - SettingsData.dankBarInnerPadding))
|
||||||
readonly property real barSpacing: {
|
readonly property real barSpacing: {
|
||||||
// Only add spacing if bar is visible, horizontal (Top/Bottom), and at same position as dock
|
|
||||||
const barIsHorizontal = (SettingsData.dankBarPosition === SettingsData.Position.Top || SettingsData.dankBarPosition === SettingsData.Position.Bottom)
|
const barIsHorizontal = (SettingsData.dankBarPosition === SettingsData.Position.Top || SettingsData.dankBarPosition === SettingsData.Position.Bottom)
|
||||||
|
const barIsVertical = (SettingsData.dankBarPosition === SettingsData.Position.Left || SettingsData.dankBarPosition === SettingsData.Position.Right)
|
||||||
const samePosition = (SettingsData.dockPosition === SettingsData.dankBarPosition)
|
const samePosition = (SettingsData.dockPosition === SettingsData.dankBarPosition)
|
||||||
return (SettingsData.dankBarVisible && barIsHorizontal && samePosition)
|
const dockIsHorizontal = !isVertical
|
||||||
? (SettingsData.dankBarSpacing + effectiveBarHeight + SettingsData.dankBarBottomGap)
|
const dockIsVertical = isVertical
|
||||||
: 0
|
|
||||||
|
if (!SettingsData.dankBarVisible) return 0
|
||||||
|
if (dockIsHorizontal && barIsHorizontal && samePosition) {
|
||||||
|
return SettingsData.dankBarSpacing + effectiveBarHeight + SettingsData.dankBarBottomGap
|
||||||
|
}
|
||||||
|
if (dockIsVertical && barIsVertical && samePosition) {
|
||||||
|
return SettingsData.dankBarSpacing + effectiveBarHeight + SettingsData.dankBarBottomGap
|
||||||
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property real dockMargin: SettingsData.dockSpacing
|
readonly property real dockMargin: SettingsData.dockSpacing
|
||||||
@@ -103,6 +113,83 @@ Variants {
|
|||||||
item: dockMouseArea
|
item: dockMouseArea
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: appTooltip
|
||||||
|
z: 1000
|
||||||
|
|
||||||
|
property var hoveredButton: {
|
||||||
|
if (!dockApps.children[0]) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
const layoutItem = dockApps.children[0]
|
||||||
|
const flowLayout = layoutItem.children[0]
|
||||||
|
let repeater = null
|
||||||
|
for (var i = 0; i < flowLayout.children.length; i++) {
|
||||||
|
const child = flowLayout.children[i]
|
||||||
|
if (child && typeof child.count !== "undefined" && typeof child.itemAt === "function") {
|
||||||
|
repeater = child
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!repeater || !repeater.itemAt) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
for (var i = 0; i < repeater.count; i++) {
|
||||||
|
const item = repeater.itemAt(i)
|
||||||
|
if (item && item.dockButton && item.dockButton.showTooltip) {
|
||||||
|
return item.dockButton
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
property string tooltipText: hoveredButton ? hoveredButton.tooltipText : ""
|
||||||
|
|
||||||
|
visible: hoveredButton !== null && tooltipText !== ""
|
||||||
|
width: px(tooltipLabel.implicitWidth + 24)
|
||||||
|
height: px(tooltipLabel.implicitHeight + 12)
|
||||||
|
|
||||||
|
color: Theme.surfaceContainer
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
border.width: 1
|
||||||
|
border.color: Theme.outlineMedium
|
||||||
|
|
||||||
|
x: {
|
||||||
|
if (!hoveredButton) return 0
|
||||||
|
const buttonPos = hoveredButton.mapToItem(dock.contentItem, 0, 0)
|
||||||
|
if (!dock.isVertical) {
|
||||||
|
return buttonPos.x + hoveredButton.width / 2 - width / 2
|
||||||
|
} else {
|
||||||
|
if (SettingsData.dockPosition === SettingsData.Position.Right) {
|
||||||
|
return buttonPos.x - width - Theme.spacingS
|
||||||
|
} else {
|
||||||
|
return buttonPos.x + hoveredButton.width + Theme.spacingS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
y: {
|
||||||
|
if (!hoveredButton) return 0
|
||||||
|
const buttonPos = hoveredButton.mapToItem(dock.contentItem, 0, 0)
|
||||||
|
if (!dock.isVertical) {
|
||||||
|
if (SettingsData.dockPosition === SettingsData.Position.Bottom) {
|
||||||
|
return buttonPos.y - height - Theme.spacingS
|
||||||
|
} else {
|
||||||
|
return buttonPos.y + hoveredButton.height + Theme.spacingS
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return buttonPos.y + hoveredButton.height / 2 - height / 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: tooltipLabel
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: appTooltip.tooltipText
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: dockCore
|
id: dockCore
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -125,14 +212,31 @@ Variants {
|
|||||||
id: dockMouseArea
|
id: dockMouseArea
|
||||||
property real currentScreen: modelData ? modelData : dock.screen
|
property real currentScreen: modelData ? modelData : dock.screen
|
||||||
property real screenWidth: currentScreen ? currentScreen.geometry.width : 1920
|
property real screenWidth: currentScreen ? currentScreen.geometry.width : 1920
|
||||||
|
property real screenHeight: currentScreen ? currentScreen.geometry.height : 1080
|
||||||
property real maxDockWidth: Math.min(screenWidth * 0.8, 1200)
|
property real maxDockWidth: Math.min(screenWidth * 0.8, 1200)
|
||||||
|
property real maxDockHeight: Math.min(screenHeight * 0.8, 1200)
|
||||||
|
|
||||||
height: dock.reveal ? px(58 + SettingsData.dockSpacing + SettingsData.dockBottomGap) : 1
|
height: {
|
||||||
width: dock.reveal ? Math.min(dockBackground.implicitWidth + 32, maxDockWidth) : Math.min(Math.max(dockBackground.implicitWidth + 64, 200), screenWidth * 0.5)
|
if (dock.isVertical) {
|
||||||
|
return dock.reveal ? Math.min(dockBackground.implicitHeight + 32, maxDockHeight) : Math.min(Math.max(dockBackground.implicitHeight + 64, 200), screenHeight * 0.5)
|
||||||
|
} else {
|
||||||
|
return dock.reveal ? px(58 + SettingsData.dockSpacing + SettingsData.dockBottomGap) : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
width: {
|
||||||
|
if (dock.isVertical) {
|
||||||
|
return dock.reveal ? px(58 + SettingsData.dockSpacing + SettingsData.dockBottomGap) : 1
|
||||||
|
} else {
|
||||||
|
return dock.reveal ? Math.min(dockBackground.implicitWidth + 32, maxDockWidth) : Math.min(Math.max(dockBackground.implicitWidth + 64, 200), screenWidth * 0.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
anchors {
|
anchors {
|
||||||
top: SettingsData.dockPosition === SettingsData.Position.Bottom ? undefined : parent.top
|
top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? undefined : parent.top) : undefined
|
||||||
bottom: SettingsData.dockPosition === SettingsData.Position.Bottom ? parent.bottom : undefined
|
bottom: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? parent.bottom : undefined) : undefined
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: !dock.isVertical ? parent.horizontalCenter : undefined
|
||||||
|
left: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? undefined : parent.left) : undefined
|
||||||
|
right: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? parent.right : undefined) : undefined
|
||||||
|
verticalCenter: dock.isVertical ? parent.verticalCenter : undefined
|
||||||
}
|
}
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
@@ -144,6 +248,12 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 200
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: dockContainer
|
id: dockContainer
|
||||||
@@ -151,7 +261,17 @@ Variants {
|
|||||||
|
|
||||||
transform: Translate {
|
transform: Translate {
|
||||||
id: dockSlide
|
id: dockSlide
|
||||||
|
x: {
|
||||||
|
if (!dock.isVertical) return 0
|
||||||
|
if (dock.reveal) return 0
|
||||||
|
if (SettingsData.dockPosition === SettingsData.Position.Right) {
|
||||||
|
return 60
|
||||||
|
} else {
|
||||||
|
return -60
|
||||||
|
}
|
||||||
|
}
|
||||||
y: {
|
y: {
|
||||||
|
if (dock.isVertical) return 0
|
||||||
if (dock.reveal) return 0
|
if (dock.reveal) return 0
|
||||||
if (SettingsData.dockPosition === SettingsData.Position.Bottom) {
|
if (SettingsData.dockPosition === SettingsData.Position.Bottom) {
|
||||||
return 60
|
return 60
|
||||||
@@ -160,6 +280,13 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on x {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 200
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 200
|
duration: 200
|
||||||
@@ -172,15 +299,20 @@ Variants {
|
|||||||
id: dockBackground
|
id: dockBackground
|
||||||
objectName: "dockBackground"
|
objectName: "dockBackground"
|
||||||
anchors {
|
anchors {
|
||||||
top: SettingsData.dockPosition === SettingsData.Position.Bottom ? undefined : parent.top
|
top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? undefined : parent.top) : undefined
|
||||||
bottom: SettingsData.dockPosition === SettingsData.Position.Bottom ? parent.bottom : undefined
|
bottom: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? parent.bottom : undefined) : undefined
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: !dock.isVertical ? parent.horizontalCenter : undefined
|
||||||
|
left: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? undefined : parent.left) : undefined
|
||||||
|
right: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? parent.right : undefined) : undefined
|
||||||
|
verticalCenter: dock.isVertical ? parent.verticalCenter : undefined
|
||||||
}
|
}
|
||||||
anchors.topMargin: SettingsData.dockPosition === SettingsData.Position.Bottom ? 0 : barSpacing + 4
|
anchors.topMargin: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? 0 : barSpacing + 4) : 0
|
||||||
anchors.bottomMargin: SettingsData.dockPosition === SettingsData.Position.Bottom ? barSpacing + 1 : 0
|
anchors.bottomMargin: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? barSpacing + 1 : 0) : 0
|
||||||
|
anchors.leftMargin: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? 0 : barSpacing + 4) : 0
|
||||||
|
anchors.rightMargin: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? barSpacing + 1 : 0) : 0
|
||||||
|
|
||||||
implicitWidth: dockApps.implicitWidth + SettingsData.dockSpacing * 2
|
implicitWidth: dock.isVertical ? (dockApps.implicitHeight + SettingsData.dockSpacing * 2) : (dockApps.implicitWidth + SettingsData.dockSpacing * 2)
|
||||||
implicitHeight: dockApps.implicitHeight + SettingsData.dockSpacing * 2
|
implicitHeight: dock.isVertical ? (dockApps.implicitWidth + SettingsData.dockSpacing * 2) : (dockApps.implicitHeight + SettingsData.dockSpacing * 2)
|
||||||
width: implicitWidth
|
width: implicitWidth
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
|
|
||||||
@@ -199,69 +331,24 @@ Variants {
|
|||||||
DockApps {
|
DockApps {
|
||||||
id: dockApps
|
id: dockApps
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: !dock.isVertical ? parent.top : undefined
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: !dock.isVertical ? parent.bottom : undefined
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: !dock.isVertical ? parent.horizontalCenter : undefined
|
||||||
anchors.topMargin: SettingsData.dockSpacing
|
anchors.left: dock.isVertical ? parent.left : undefined
|
||||||
anchors.bottomMargin: SettingsData.dockSpacing
|
anchors.right: dock.isVertical ? parent.right : undefined
|
||||||
|
anchors.verticalCenter: dock.isVertical ? parent.verticalCenter : undefined
|
||||||
|
anchors.topMargin: !dock.isVertical ? SettingsData.dockSpacing : 0
|
||||||
|
anchors.bottomMargin: !dock.isVertical ? SettingsData.dockSpacing : 0
|
||||||
|
anchors.leftMargin: dock.isVertical ? SettingsData.dockSpacing : 0
|
||||||
|
anchors.rightMargin: dock.isVertical ? SettingsData.dockSpacing : 0
|
||||||
|
|
||||||
contextMenu: dockVariants.contextMenu
|
contextMenu: dockVariants.contextMenu
|
||||||
groupByApp: dock.groupByApp
|
groupByApp: dock.groupByApp
|
||||||
|
isVertical: dock.isVertical
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: appTooltip
|
|
||||||
|
|
||||||
property var hoveredButton: {
|
|
||||||
if (!dockApps.children[0]) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
const row = dockApps.children[0]
|
|
||||||
let repeater = null
|
|
||||||
for (var i = 0; i < row.children.length; i++) {
|
|
||||||
const child = row.children[i]
|
|
||||||
if (child && typeof child.count !== "undefined" && typeof child.itemAt === "function") {
|
|
||||||
repeater = child
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!repeater || !repeater.itemAt) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
for (var i = 0; i < repeater.count; i++) {
|
|
||||||
const item = repeater.itemAt(i)
|
|
||||||
if (item && item.dockButton && item.dockButton.showTooltip) {
|
|
||||||
return item.dockButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
property string tooltipText: hoveredButton ? hoveredButton.tooltipText : ""
|
|
||||||
|
|
||||||
visible: hoveredButton !== null && tooltipText !== ""
|
|
||||||
width: px(tooltipLabel.implicitWidth + 24)
|
|
||||||
height: px(tooltipLabel.implicitHeight + 12)
|
|
||||||
|
|
||||||
color: Theme.surfaceContainer
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
border.width: 1
|
|
||||||
border.color: Theme.outlineMedium
|
|
||||||
|
|
||||||
y: SettingsData.dockPosition === SettingsData.Position.Bottom ? -height - Theme.spacingS : parent.height + Theme.spacingS
|
|
||||||
x: hoveredButton ? hoveredButton.mapToItem(dockContainer, hoveredButton.width / 2, 0).x - width / 2 : 0
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
id: tooltipLabel
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: appTooltip.tooltipText
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ Item {
|
|||||||
property bool requestDockShow: false
|
property bool requestDockShow: false
|
||||||
property int pinnedAppCount: 0
|
property int pinnedAppCount: 0
|
||||||
property bool groupByApp: false
|
property bool groupByApp: false
|
||||||
|
property bool isVertical: false
|
||||||
|
|
||||||
implicitWidth: row.width
|
implicitWidth: isVertical ? appLayout.height : appLayout.width
|
||||||
implicitHeight: row.height
|
implicitHeight: isVertical ? appLayout.width : appLayout.height
|
||||||
|
|
||||||
function movePinnedApp(fromIndex, toIndex) {
|
function movePinnedApp(fromIndex, toIndex) {
|
||||||
if (fromIndex === toIndex) {
|
if (fromIndex === toIndex) {
|
||||||
@@ -33,11 +34,16 @@ Item {
|
|||||||
SessionData.setPinnedApps(currentPinned)
|
SessionData.setPinnedApps(currentPinned)
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Item {
|
||||||
id: row
|
id: appLayout
|
||||||
spacing: 8
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
height: 40
|
width: layoutFlow.width
|
||||||
|
height: layoutFlow.height
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
id: layoutFlow
|
||||||
|
flow: root.isVertical ? Flow.TopToBottom : Flow.LeftToRight
|
||||||
|
spacing: 8
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
id: repeater
|
||||||
@@ -218,6 +224,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -92,24 +92,41 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dockBackground = findDockBackground(dockWindow.contentItem)
|
const dockBackground = findDockBackground(dockWindow.contentItem)
|
||||||
|
let actualDockWidth = dockWindow.width
|
||||||
if (dockBackground) {
|
if (dockBackground) {
|
||||||
actualDockHeight = dockBackground.height
|
actualDockHeight = dockBackground.height
|
||||||
|
actualDockWidth = dockBackground.width
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom
|
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
|
||||||
const dockBottomMargin = 16
|
const dockMargin = 16
|
||||||
let buttonScreenY
|
let buttonScreenX, buttonScreenY
|
||||||
|
|
||||||
if (isDockAtBottom) {
|
if (isVertical) {
|
||||||
buttonScreenY = root.screen.height - actualDockHeight - dockBottomMargin - 20
|
const dockContentHeight = dockWindow.height
|
||||||
|
const screenHeight = root.screen.height
|
||||||
|
const dockTopMargin = Math.round((screenHeight - dockContentHeight) / 2)
|
||||||
|
buttonScreenY = dockTopMargin + buttonPosInDock.y + anchorItem.height / 2
|
||||||
|
|
||||||
|
if (SettingsData.dockPosition === SettingsData.Position.Right) {
|
||||||
|
buttonScreenX = root.screen.width - actualDockWidth - dockMargin - 20
|
||||||
|
} else {
|
||||||
|
buttonScreenX = actualDockWidth + dockMargin + 20
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buttonScreenY = actualDockHeight + dockBottomMargin + 20
|
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom
|
||||||
}
|
|
||||||
|
|
||||||
const dockContentWidth = dockWindow.width
|
if (isDockAtBottom) {
|
||||||
const screenWidth = root.screen.width
|
buttonScreenY = root.screen.height - actualDockHeight - dockMargin - 20
|
||||||
const dockLeftMargin = Math.round((screenWidth - dockContentWidth) / 2)
|
} else {
|
||||||
const buttonScreenX = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2
|
buttonScreenY = actualDockHeight + dockMargin + 20
|
||||||
|
}
|
||||||
|
|
||||||
|
const dockContentWidth = dockWindow.width
|
||||||
|
const screenWidth = root.screen.width
|
||||||
|
const dockLeftMargin = Math.round((screenWidth - dockContentWidth) / 2)
|
||||||
|
buttonScreenX = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2
|
||||||
|
}
|
||||||
|
|
||||||
anchorPos = Qt.point(buttonScreenX, buttonScreenY)
|
anchorPos = Qt.point(buttonScreenX, buttonScreenY)
|
||||||
}
|
}
|
||||||
@@ -121,17 +138,35 @@ PanelWindow {
|
|||||||
height: Math.max(60, menuColumn.implicitHeight + Theme.spacingS * 2)
|
height: Math.max(60, menuColumn.implicitHeight + Theme.spacingS * 2)
|
||||||
|
|
||||||
x: {
|
x: {
|
||||||
const left = 10
|
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
|
||||||
const right = root.width - width - 10
|
if (isVertical) {
|
||||||
const want = root.anchorPos.x - width / 2
|
const isDockAtRight = SettingsData.dockPosition === SettingsData.Position.Right
|
||||||
return Math.max(left, Math.min(right, want))
|
if (isDockAtRight) {
|
||||||
|
return Math.max(10, root.anchorPos.x - width + 30)
|
||||||
|
} else {
|
||||||
|
return Math.min(root.width - width - 10, root.anchorPos.x - 30)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const left = 10
|
||||||
|
const right = root.width - width - 10
|
||||||
|
const want = root.anchorPos.x - width / 2
|
||||||
|
return Math.max(left, Math.min(right, want))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
y: {
|
y: {
|
||||||
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom
|
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
|
||||||
if (isDockAtBottom) {
|
if (isVertical) {
|
||||||
return Math.max(10, root.anchorPos.y - height + 30)
|
const top = 10
|
||||||
|
const bottom = root.height - height - 10
|
||||||
|
const want = root.anchorPos.y - height / 2
|
||||||
|
return Math.max(top, Math.min(bottom, want))
|
||||||
} else {
|
} else {
|
||||||
return Math.min(root.height - height - 10, root.anchorPos.y - 30)
|
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom
|
||||||
|
if (isDockAtBottom) {
|
||||||
|
return Math.max(10, root.anchorPos.y - height + 30)
|
||||||
|
} else {
|
||||||
|
return Math.min(root.height - height - 10, root.anchorPos.y - 30)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color: Theme.popupBackground()
|
color: Theme.popupBackground()
|
||||||
|
|||||||
@@ -65,11 +65,24 @@ Item {
|
|||||||
DankButtonGroup {
|
DankButtonGroup {
|
||||||
id: positionButtonGroup
|
id: positionButtonGroup
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
model: ["Top", "Bottom"]
|
model: ["Top", "Bottom", "Left", "Right"]
|
||||||
currentIndex: SettingsData.dockPosition === SettingsData.Position.Bottom ? 1 : 0
|
currentIndex: {
|
||||||
|
switch (SettingsData.dockPosition) {
|
||||||
|
case SettingsData.Position.Top: return 0
|
||||||
|
case SettingsData.Position.Bottom: return 1
|
||||||
|
case SettingsData.Position.Left: return 2
|
||||||
|
case SettingsData.Position.Right: return 3
|
||||||
|
default: return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
onSelectionChanged: (index, selected) => {
|
onSelectionChanged: (index, selected) => {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
SettingsData.setDockPosition(index === 1 ? SettingsData.Position.Bottom : SettingsData.Position.Top)
|
switch (index) {
|
||||||
|
case 0: SettingsData.setDockPosition(SettingsData.Position.Top); break
|
||||||
|
case 1: SettingsData.setDockPosition(SettingsData.Position.Bottom); break
|
||||||
|
case 2: SettingsData.setDockPosition(SettingsData.Position.Left); break
|
||||||
|
case 3: SettingsData.setDockPosition(SettingsData.Position.Right); break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +183,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Display a dock with pinned and running applications that can be positioned at the top or bottom of the screen"
|
text: "Display a dock with pinned and running applications that can be positioned at the top, bottom, left, or right edge of the screen"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ ShellRoot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onCurrentPositionChanged: {
|
onCurrentPositionChanged: {
|
||||||
console.log("DEBUG: Dock position changed to:", currentPosition, "- recreating dock")
|
|
||||||
const comp = sourceComponent
|
const comp = sourceComponent
|
||||||
sourceComponent = null
|
sourceComponent = null
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user