Add bar position

This commit is contained in:
Ly-sec 2025-08-19 12:52:54 +02:00
parent 1564992442
commit 7b26ddaa32
11 changed files with 72 additions and 14 deletions

View file

@ -44,7 +44,11 @@ NLoader {
margins {
top: (Settings.data.bar.monitors.includes(modelData.name)
|| (Settings.data.bar.monitors.length === 0)) ? Math.floor(Style.barHeight * scaling) : 0
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.barPosition === "top"
? Math.floor(Style.barHeight * scaling) : 0
bottom: (Settings.data.bar.monitors.includes(modelData.name)
|| (Settings.data.bar.monitors.length === 0)) && Settings.data.bar.barPosition === "bottom"
? Math.floor(Style.barHeight * scaling) : 0
}
// Source we want to show only as a ring

View file

@ -25,7 +25,8 @@ Variants {
|| (Settings.data.bar.monitors.length === 0)) : false
anchors {
top: true
top: Settings.data.bar.barPosition === "top"
bottom: Settings.data.bar.barPosition === "bottom"
left: true
right: true
}

View file

@ -73,10 +73,14 @@ NLoader {
border.width: Math.max(1, Style.borderS * scaling)
width: 380 * scaling
height: 500 * scaling
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: Style.marginXS * scaling
anchors.rightMargin: Style.marginXS * scaling
anchors {
right: parent.right
rightMargin: Style.marginXS * scaling
top: Settings.data.bar.barPosition === "top" ? parent.top : undefined
bottom: Settings.data.bar.barPosition === "bottom" ? parent.bottom : undefined
topMargin: Settings.data.bar.barPosition === "top" ? Style.marginXS * scaling : undefined
bottomMargin: Settings.data.bar.barPosition === "bottom" ? Style.barHeight * scaling + Style.marginXS * scaling : undefined
}
// Animation properties
property real scaleValue: 0.8

View file

@ -20,6 +20,7 @@ Rectangle {
id: tooltip
text: Time.dateString
target: clock
positionAbove: Settings.data.bar.barPosition === "bottom"
}
onEntered: {

View file

@ -119,6 +119,7 @@ Rectangle {
id: trayTooltip
target: trayIcon
text: modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item"
positionAbove: Settings.data.bar.barPosition === "bottom"
}
}
}

View file

@ -88,10 +88,14 @@ NLoader {
border.width: Math.max(1, Style.borderS * scaling)
width: 340 * scaling
height: 500 * scaling
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: Style.marginXS * scaling
anchors.rightMargin: Style.marginXS * scaling
anchors {
right: parent.right
rightMargin: Style.marginXS * scaling
top: Settings.data.bar.barPosition === "top" ? parent.top : undefined
bottom: Settings.data.bar.barPosition === "bottom" ? parent.bottom : undefined
topMargin: Settings.data.bar.barPosition === "top" ? Style.marginXS * scaling : undefined
bottomMargin: Settings.data.bar.barPosition === "bottom" ? Style.barHeight * scaling + Style.marginXS * scaling : undefined
}
// Animation properties
property real scaleValue: 0.8

View file

@ -40,6 +40,44 @@ ColumnLayout {
color: Color.mOnSurface
}
ColumnLayout {
spacing: Style.marginXXS * scaling
Layout.fillWidth: true
NText {
text: "Bar Position"
font.pointSize: Style.fontSizeL * scaling
font.weight: Style.fontWeightBold
color: Color.mOnSurface
}
NText {
text: "Choose where to place the bar on the screen"
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
NComboBox {
Layout.fillWidth: true
model: ListModel {
ListElement {
key: "top"
name: "Top"
}
ListElement {
key: "bottom"
name: "Bottom"
}
}
currentKey: Settings.data.bar.barPosition
onSelected: function (key) {
Settings.data.bar.barPosition = key
}
}
}
NToggle {
label: "Show Active Window"
description: "Display the title of the currently focused window on the left side of the bar."

View file

@ -90,8 +90,12 @@ NLoader {
property real innerMargin: sidePanel.cardSpacing
// Height scales to content plus vertical padding
height: content.implicitHeight + innerMargin * 2
// Place the panel just below the bar (overlay content starts below bar due to topMargin)
y: Style.marginS * scaling
// Place the panel relative to the bar based on its position
y: Settings.data.bar.barPosition === "top" ? Style.marginS * scaling : undefined
anchors {
bottom: Settings.data.bar.barPosition === "bottom" ? parent.bottom : undefined
bottomMargin: Settings.data.bar.barPosition === "bottom" ? Style.barHeight * scaling + Style.marginS * scaling : undefined
}
// Center horizontally under the anchorX, clamped to the screen bounds
x: Math.max(Style.marginS * scaling, Math.min(parent.width - width - Style.marginS * scaling,
Math.round(anchorX - width / 2)))