Vertical bar: simpler management
This commit is contained in:
parent
b443c9f492
commit
101e3125a9
11 changed files with 25 additions and 139 deletions
|
|
@ -108,8 +108,7 @@ Variants {
|
|||
"widgetId": modelData.id,
|
||||
"section": "left",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.left.length,
|
||||
"barPosition": BarService.position
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.left.length
|
||||
}
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
|
@ -133,8 +132,7 @@ Variants {
|
|||
"widgetId": modelData.id,
|
||||
"section": "center",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.center.length,
|
||||
"barPosition": BarService.position
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.center.length
|
||||
}
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
|
@ -159,8 +157,7 @@ Variants {
|
|||
"widgetId": modelData.id,
|
||||
"section": "right",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.right.length,
|
||||
"barPosition": BarService.position
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.right.length
|
||||
}
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
|
@ -193,8 +190,7 @@ Variants {
|
|||
"widgetId": modelData.id,
|
||||
"section": "left",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.left.length,
|
||||
"barPosition": BarService.position
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.left.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -218,8 +214,7 @@ Variants {
|
|||
"widgetId": modelData.id,
|
||||
"section": "center",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.center.length,
|
||||
"barPosition": BarService.position
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.center.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -244,8 +239,7 @@ Variants {
|
|||
"widgetId": modelData.id,
|
||||
"section": "right",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.right.length,
|
||||
"barPosition": BarService.position
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.right.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,22 +18,7 @@ Item {
|
|||
property string section: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
property string barPosition: "top"
|
||||
|
||||
// Listen to BarService position changes
|
||||
Connections {
|
||||
target: BarService
|
||||
function onBarPositionChanged(newPosition) {
|
||||
barPosition = newPosition
|
||||
// Force re-evaluation of implicit sizing
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
})
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
|
||||
property var widgetSettings: {
|
||||
|
|
@ -52,6 +37,7 @@ Item {
|
|||
readonly property real minWidth: Math.max(1, screen.width * 0.06)
|
||||
readonly property real maxWidth: minWidth * 2
|
||||
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ Rectangle {
|
|||
property string section: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
property string barPosition: "top"
|
||||
|
||||
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
|
||||
property var widgetSettings: {
|
||||
|
|
@ -29,6 +28,8 @@ Rectangle {
|
|||
return {}
|
||||
}
|
||||
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
// Resolve settings: try user settings or defaults from BarWidgetRegistry
|
||||
readonly property bool use12h: widgetSettings.use12HourClock !== undefined ? widgetSettings.use12HourClock : widgetMetadata.use12HourClock
|
||||
readonly property bool reverseDayMonth: widgetSettings.reverseDayMonth !== undefined ? widgetSettings.reverseDayMonth : widgetMetadata.reverseDayMonth
|
||||
|
|
@ -40,16 +41,6 @@ Rectangle {
|
|||
implicitWidth: useCompactMode ? Math.round(Style.capsuleHeight * scaling) : Math.round(layout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
implicitHeight: useCompactMode ? Math.round(Style.capsuleHeight * 2.5 * scaling) : Math.round(Style.capsuleHeight * scaling)
|
||||
|
||||
// React to bar position changes
|
||||
Connections {
|
||||
target: BarService
|
||||
function onBarPositionChanged(newPosition) {
|
||||
root.barPosition = newPosition
|
||||
// Force re-evaluation of implicitWidth and implicitHeight
|
||||
root.implicitWidth = Qt.binding(() => useCompactMode ? Math.round(Style.capsuleHeight * scaling) : Math.round(layout.implicitWidth + Style.marginM * 2 * scaling))
|
||||
root.implicitHeight = Qt.binding(() => useCompactMode ? Math.round(Style.capsuleHeight * 2.5 * scaling) : Math.round(Style.capsuleHeight * scaling))
|
||||
}
|
||||
}
|
||||
radius: Math.round(Style.radiusS * scaling)
|
||||
color: Color.mSurfaceVariant
|
||||
|
||||
|
|
|
|||
|
|
@ -18,22 +18,6 @@ Item {
|
|||
property string section: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
property string barPosition: "top"
|
||||
|
||||
// Listen to BarService position changes
|
||||
Connections {
|
||||
target: BarService
|
||||
function onBarPositionChanged(newPosition) {
|
||||
barPosition = newPosition
|
||||
// Force re-evaluation of implicit sizing
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (rowLayout.implicitWidth + Style.marginM * 2 * scaling)
|
||||
})
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
|
||||
property var widgetSettings: {
|
||||
|
|
@ -46,6 +30,9 @@ Item {
|
|||
return {}
|
||||
}
|
||||
|
||||
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
readonly property bool showAlbumArt: (widgetSettings.showAlbumArt !== undefined) ? widgetSettings.showAlbumArt : widgetMetadata.showAlbumArt
|
||||
readonly property bool showVisualizer: (widgetSettings.showVisualizer !== undefined) ? widgetSettings.showVisualizer : widgetMetadata.showVisualizer
|
||||
readonly property string visualizerType: (widgetSettings.visualizerType !== undefined && widgetSettings.visualizerType !== "") ? widgetSettings.visualizerType : widgetMetadata.visualizerType
|
||||
|
|
|
|||
|
|
@ -16,22 +16,6 @@ Item {
|
|||
property string section: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
property string barPosition: "top"
|
||||
|
||||
// Listen to BarService position changes
|
||||
Connections {
|
||||
target: BarService
|
||||
function onBarPositionChanged(newPosition) {
|
||||
barPosition = newPosition
|
||||
// Force re-evaluation of implicit sizing
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling)
|
||||
})
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
|
||||
property var widgetSettings: {
|
||||
|
|
@ -44,6 +28,8 @@ Item {
|
|||
return {}
|
||||
}
|
||||
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
readonly property bool showCpuUsage: (widgetSettings.showCpuUsage !== undefined) ? widgetSettings.showCpuUsage : widgetMetadata.showCpuUsage
|
||||
readonly property bool showCpuTemp: (widgetSettings.showCpuTemp !== undefined) ? widgetSettings.showCpuTemp : widgetMetadata.showCpuTemp
|
||||
readonly property bool showMemoryUsage: (widgetSettings.showMemoryUsage !== undefined) ? widgetSettings.showMemoryUsage : widgetMetadata.showMemoryUsage
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ Rectangle {
|
|||
|
||||
property ShellScreen screen
|
||||
property real scaling: 1.0
|
||||
property string barPosition: "top"
|
||||
|
||||
readonly property real itemSize: 24 * scaling
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
function onLoaded() {
|
||||
// When the widget is fully initialized with its props
|
||||
|
|
@ -27,17 +27,6 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
// React to bar position changes
|
||||
Connections {
|
||||
target: BarService
|
||||
function onBarPositionChanged(newPosition) {
|
||||
root.barPosition = newPosition
|
||||
// Force re-evaluation of implicitWidth and implicitHeight
|
||||
root.implicitWidth = Qt.binding(() => (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (trayLayout.implicitWidth + Style.marginM * scaling * 2))
|
||||
root.implicitHeight = Qt.binding(() => (barPosition === "left" || barPosition === "right") ? Math.round(trayLayout.implicitHeight + Style.marginM * scaling * 2) : Math.round(Style.capsuleHeight * scaling))
|
||||
}
|
||||
}
|
||||
|
||||
visible: SystemTray.items.values.length > 0
|
||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (trayLayout.implicitWidth + Style.marginM * scaling * 2)
|
||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? Math.round(trayLayout.implicitHeight + Style.marginM * scaling * 2) : Math.round(Style.capsuleHeight * scaling)
|
||||
|
|
|
|||
|
|
@ -19,22 +19,6 @@ Item {
|
|||
property string section: ""
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
property string barPosition: "top"
|
||||
|
||||
// Listen to BarService position changes
|
||||
Connections {
|
||||
target: BarService
|
||||
function onBarPositionChanged(newPosition) {
|
||||
barPosition = newPosition
|
||||
// Force re-evaluation of implicit sizing
|
||||
implicitWidth = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? Math.round(Style.barHeight * scaling) : calculatedHorizontalWidth()
|
||||
})
|
||||
implicitHeight = Qt.binding(function () {
|
||||
return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
|
||||
property var widgetSettings: {
|
||||
|
|
@ -47,6 +31,9 @@ Item {
|
|||
return {}
|
||||
}
|
||||
|
||||
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
readonly property string labelMode: (widgetSettings.labelMode !== undefined) ? widgetSettings.labelMode : widgetMetadata.labelMode
|
||||
readonly property bool hideUnoccupied: (widgetSettings.hideUnoccupied !== undefined) ? widgetSettings.hideUnoccupied : widgetMetadata.hideUnoccupied
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ ColumnLayout {
|
|||
name: "Right"
|
||||
}
|
||||
}
|
||||
currentKey: BarService.position
|
||||
onSelected: key => BarService.setPosition(key)
|
||||
currentKey: Settings.data.bar.position
|
||||
onSelected: key => Settings.data.bar.position = key
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// Bar position property
|
||||
property string position: Settings.data.bar.position
|
||||
|
||||
// Signal emitted when bar position changes
|
||||
signal barPositionChanged(string newPosition)
|
||||
|
||||
// Watch for changes in Settings.data.bar.position
|
||||
Connections {
|
||||
target: Settings
|
||||
function onDataChanged() {
|
||||
if (Settings.data.bar.position !== root.position) {
|
||||
root.position = Settings.data.bar.position
|
||||
root.barPositionChanged(root.position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Also watch for direct changes to the position property
|
||||
onPositionChanged: {
|
||||
root.barPositionChanged(position)
|
||||
}
|
||||
|
||||
// Function to change bar position
|
||||
function setPosition(newPosition) {
|
||||
Settings.data.bar.position = newPosition
|
||||
}
|
||||
}
|
||||
|
|
@ -40,6 +40,7 @@ Loader {
|
|||
property real opacityValue: originalOpacity
|
||||
|
||||
property alias isClosing: hideTimer.running
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
signal opened
|
||||
signal closed
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ Window {
|
|||
property bool positionLeft: false
|
||||
property bool positionRight: false
|
||||
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
|
||||
flags: Qt.ToolTip | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
|
||||
color: Color.transparent
|
||||
visible: false
|
||||
|
|
@ -53,7 +55,6 @@ Window {
|
|||
|
||||
// If no explicit positioning is set, auto-detect based on bar position
|
||||
if (!positionLeft && !positionRight && !positionAbove) {
|
||||
var barPosition = BarService.position
|
||||
if (barPosition === "left") {
|
||||
shouldPositionRight = true
|
||||
} else if (barPosition === "right") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue