diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 1ef171b..ec156ce 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -74,6 +74,7 @@ Singleton { property JsonObject bar bar: JsonObject { + property string barPosition: "top" // Possible values: "top", "bottom", "left", "right" property bool showActiveWindow: true property bool showSystemInfo: false property bool showMedia: false diff --git a/Modules/Background/ScreenCorners.qml b/Modules/Background/ScreenCorners.qml index bb5159d..f8a58d7 100644 --- a/Modules/Background/ScreenCorners.qml +++ b/Modules/Background/ScreenCorners.qml @@ -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 diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 82aad01..55e8933 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -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 } diff --git a/Modules/Bar/BluetoothMenu.qml b/Modules/Bar/BluetoothMenu.qml index ff0959d..6a7d40e 100644 --- a/Modules/Bar/BluetoothMenu.qml +++ b/Modules/Bar/BluetoothMenu.qml @@ -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 diff --git a/Modules/Bar/Clock.qml b/Modules/Bar/Clock.qml index e20f3e3..a7cf60f 100644 --- a/Modules/Bar/Clock.qml +++ b/Modules/Bar/Clock.qml @@ -20,6 +20,7 @@ Rectangle { id: tooltip text: Time.dateString target: clock + positionAbove: Settings.data.bar.barPosition === "bottom" } onEntered: { diff --git a/Modules/Bar/Tray.qml b/Modules/Bar/Tray.qml index 7c793a6..4476f8d 100644 --- a/Modules/Bar/Tray.qml +++ b/Modules/Bar/Tray.qml @@ -119,6 +119,7 @@ Rectangle { id: trayTooltip target: trayIcon text: modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item" + positionAbove: Settings.data.bar.barPosition === "bottom" } } } diff --git a/Modules/Bar/WiFiMenu.qml b/Modules/Bar/WiFiMenu.qml index 28fb35a..bd35c23 100644 --- a/Modules/Bar/WiFiMenu.qml +++ b/Modules/Bar/WiFiMenu.qml @@ -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 diff --git a/Modules/SettingsPanel/Tabs/BarTab.qml b/Modules/SettingsPanel/Tabs/BarTab.qml index f03c084..f8b7481 100644 --- a/Modules/SettingsPanel/Tabs/BarTab.qml +++ b/Modules/SettingsPanel/Tabs/BarTab.qml @@ -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." diff --git a/Modules/SidePanel/SidePanel.qml b/Modules/SidePanel/SidePanel.qml index 1d9d2ae..f5e9f48 100644 --- a/Modules/SidePanel/SidePanel.qml +++ b/Modules/SidePanel/SidePanel.qml @@ -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))) diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index c1b0e43..c5005b4 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -51,7 +51,7 @@ Rectangle { NTooltip { id: tooltip target: root - positionAbove: false + positionAbove: Settings.data.bar.barPosition === "bottom" text: root.tooltipText } diff --git a/Widgets/NPill.qml b/Widgets/NPill.qml index d56cb46..680c4a2 100644 --- a/Widgets/NPill.qml +++ b/Widgets/NPill.qml @@ -168,7 +168,7 @@ Item { NTooltip { id: tooltip - positionAbove: false + positionAbove: Settings.data.bar.barPosition === "bottom" target: pill delay: Style.tooltipDelayLong text: root.tooltipText