diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-15 18:08:45 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-15 18:08:45 +1000 |
| commit | 96429160c30ba5f6dcd25c8e6a181221195c41d8 (patch) | |
| tree | 6f95bac8f3056abae67c04ae612b574ce1c37286 /modules/bar | |
| parent | internal: properly fix beat detector (diff) | |
| download | caelestia-shell-96429160c30ba5f6dcd25c8e6a181221195c41d8.tar.gz caelestia-shell-96429160c30ba5f6dcd25c8e6a181221195c41d8.tar.bz2 caelestia-shell-96429160c30ba5f6dcd25c8e6a181221195c41d8.zip | |
feat: user config file
Config file at `~/.config/caelestia/shell.json`
Diffstat (limited to 'modules/bar')
| -rw-r--r-- | modules/bar/Bar.qml | 6 | ||||
| -rw-r--r-- | modules/bar/components/workspaces/ActiveIndicator.qml | 16 | ||||
| -rw-r--r-- | modules/bar/components/workspaces/OccupiedBg.qml | 6 | ||||
| -rw-r--r-- | modules/bar/components/workspaces/Workspace.qml | 16 | ||||
| -rw-r--r-- | modules/bar/components/workspaces/Workspaces.qml | 8 | ||||
| -rw-r--r-- | modules/bar/popouts/ActiveWindow.qml | 4 | ||||
| -rw-r--r-- | modules/bar/popouts/Background.qml | 4 | ||||
| -rw-r--r-- | modules/bar/popouts/Battery.qml | 2 | ||||
| -rw-r--r-- | modules/bar/popouts/TrayMenu.qml | 4 |
9 files changed, 33 insertions, 33 deletions
diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 2e8ab89..1d0db8d 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -63,7 +63,7 @@ Item { anchors.bottom: parent.bottom anchors.left: parent.left - implicitWidth: child.implicitWidth + BorderConfig.thickness * 2 + implicitWidth: child.implicitWidth + Config.border.thickness * 2 Item { id: child @@ -97,8 +97,8 @@ Item { MouseArea { anchors.fill: parent - anchors.leftMargin: -BorderConfig.thickness - anchors.rightMargin: -BorderConfig.thickness + anchors.leftMargin: -Config.border.thickness + anchors.rightMargin: -Config.border.thickness onWheel: event => { const activeWs = Hyprland.activeClient?.workspace?.name; diff --git a/modules/bar/components/workspaces/ActiveIndicator.qml b/modules/bar/components/workspaces/ActiveIndicator.qml index 3f3ca62..6807397 100644 --- a/modules/bar/components/workspaces/ActiveIndicator.qml +++ b/modules/bar/components/workspaces/ActiveIndicator.qml @@ -20,7 +20,7 @@ StyledRect { property real offset: Math.min(leading, trailing) property real size: { const s = Math.abs(leading - trailing) + currentSize; - if (BarConfig.workspaces.activeTrail && lastWs > currentWsIdx) + if (Config.bar.workspaces.activeTrail && lastWs > currentWsIdx) return Math.min(getWsY(lastWs) + (workspaces[lastWs]?.size ?? 0) - offset, s); return s; } @@ -43,9 +43,9 @@ StyledRect { clip: true x: 1 y: offset + 1 - implicitWidth: BarConfig.sizes.innerHeight - 2 + implicitWidth: Config.bar.sizes.innerHeight - 2 implicitHeight: size - 2 - radius: BarConfig.workspaces.rounded ? Appearance.rounding.full : 0 + radius: Config.bar.workspaces.rounded ? Appearance.rounding.full : 0 color: Colours.palette.m3primary StyledRect { @@ -72,13 +72,13 @@ StyledRect { } Behavior on leading { - enabled: BarConfig.workspaces.activeTrail + enabled: Config.bar.workspaces.activeTrail Anim {} } Behavior on trailing { - enabled: BarConfig.workspaces.activeTrail + enabled: Config.bar.workspaces.activeTrail Anim { duration: Appearance.anim.durations.normal * 2 @@ -86,19 +86,19 @@ StyledRect { } Behavior on currentSize { - enabled: BarConfig.workspaces.activeTrail + enabled: Config.bar.workspaces.activeTrail Anim {} } Behavior on offset { - enabled: !BarConfig.workspaces.activeTrail + enabled: !Config.bar.workspaces.activeTrail Anim {} } Behavior on size { - enabled: !BarConfig.workspaces.activeTrail + enabled: !Config.bar.workspaces.activeTrail Anim {} } diff --git a/modules/bar/components/workspaces/OccupiedBg.qml b/modules/bar/components/workspaces/OccupiedBg.qml index 4fba2f4..c5ed7cc 100644 --- a/modules/bar/components/workspaces/OccupiedBg.qml +++ b/modules/bar/components/workspaces/OccupiedBg.qml @@ -18,7 +18,7 @@ Item { onOccupiedChanged: { let count = 0; const start = groupOffset; - const end = start + BarConfig.workspaces.shown; + const end = start + Config.bar.workspaces.shown; for (const [ws, occ] of Object.entries(occupied)) { if (ws > start && ws <= end && occ) { if (!occupied[ws - 1]) { @@ -52,11 +52,11 @@ Item { readonly property Workspace end: root.workspaces[modelData.end - 1 - root.groupOffset] ?? null color: Colours.alpha(Colours.palette.m3surfaceContainerHigh, true) - radius: BarConfig.workspaces.rounded ? Appearance.rounding.full : 0 + radius: Config.bar.workspaces.rounded ? Appearance.rounding.full : 0 x: start?.x ?? 0 y: start?.y ?? 0 - implicitWidth: BarConfig.sizes.innerHeight + implicitWidth: Config.bar.sizes.innerHeight implicitHeight: end?.y + end?.height - start?.y anchors.horizontalCenter: parent.horizontalCenter diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml index fa5fe62..6cf5c40 100644 --- a/modules/bar/components/workspaces/Workspace.qml +++ b/modules/bar/components/workspaces/Workspace.qml @@ -19,7 +19,7 @@ Item { readonly property int ws: groupOffset + index + 1 readonly property bool isOccupied: occupied[ws] ?? false - readonly property bool hasWindows: isOccupied && BarConfig.workspaces.showWindows + readonly property bool hasWindows: isOccupied && Config.bar.workspaces.showWindows Layout.preferredWidth: childrenRect.width Layout.preferredHeight: size @@ -27,24 +27,24 @@ Item { StyledText { id: indicator - readonly property string label: BarConfig.workspaces.label || root.ws - readonly property string occupiedLabel: BarConfig.workspaces.occupiedLabel || label - readonly property string activeLabel: BarConfig.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label) + readonly property string label: Config.bar.workspaces.label || root.ws + readonly property string occupiedLabel: Config.bar.workspaces.occupiedLabel || label + readonly property string activeLabel: Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label) animate: true text: Hyprland.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label - color: BarConfig.workspaces.occupiedBg || root.isOccupied || Hyprland.activeWsId === root.ws ? Colours.palette.m3onSurface : Colours.palette.m3outlineVariant + color: Config.bar.workspaces.occupiedBg || root.isOccupied || Hyprland.activeWsId === root.ws ? Colours.palette.m3onSurface : Colours.palette.m3outlineVariant horizontalAlignment: StyledText.AlignHCenter verticalAlignment: StyledText.AlignVCenter - width: BarConfig.sizes.innerHeight - height: BarConfig.sizes.innerHeight + width: Config.bar.sizes.innerHeight + height: Config.bar.sizes.innerHeight } Loader { id: windows - active: BarConfig.workspaces.showWindows + active: Config.bar.workspaces.showWindows asynchronous: true anchors.horizontalCenter: indicator.horizontalCenter diff --git a/modules/bar/components/workspaces/Workspaces.qml b/modules/bar/components/workspaces/Workspaces.qml index 4f4c75b..9264762 100644 --- a/modules/bar/components/workspaces/Workspaces.qml +++ b/modules/bar/components/workspaces/Workspaces.qml @@ -14,7 +14,7 @@ Item { acc[curr.id] = curr.lastIpcObject.windows > 0; return acc; }, {}) - readonly property int groupOffset: Math.floor((Hyprland.activeWsId - 1) / BarConfig.workspaces.shown) * BarConfig.workspaces.shown + readonly property int groupOffset: Math.floor((Hyprland.activeWsId - 1) / Config.bar.workspaces.shown) * Config.bar.workspaces.shown implicitWidth: layout.implicitWidth implicitHeight: layout.implicitHeight @@ -27,7 +27,7 @@ Item { layer.smooth: true Repeater { - model: BarConfig.workspaces.shown + model: Config.bar.workspaces.shown Workspace { occupied: root.occupied @@ -37,7 +37,7 @@ Item { } Loader { - active: BarConfig.workspaces.occupiedBg + active: Config.bar.workspaces.occupiedBg asynchronous: true z: -1 @@ -51,7 +51,7 @@ Item { } Loader { - active: BarConfig.workspaces.activeIndicator + active: Config.bar.workspaces.activeIndicator asynchronous: true sourceComponent: ActiveIndicator { diff --git a/modules/bar/popouts/ActiveWindow.qml b/modules/bar/popouts/ActiveWindow.qml index f3a5269..03130f1 100644 --- a/modules/bar/popouts/ActiveWindow.qml +++ b/modules/bar/popouts/ActiveWindow.qml @@ -61,8 +61,8 @@ Item { captureSource: ToplevelManager.toplevels.values.find(t => t.title === Hyprland.activeClient?.title) ?? null live: visible - constraintSize.width: BarConfig.sizes.windowPreviewSize - constraintSize.height: BarConfig.sizes.windowPreviewSize + constraintSize.width: Config.bar.sizes.windowPreviewSize + constraintSize.height: Config.bar.sizes.windowPreviewSize } } } diff --git a/modules/bar/popouts/Background.qml b/modules/bar/popouts/Background.qml index a56b0b7..c099118 100644 --- a/modules/bar/popouts/Background.qml +++ b/modules/bar/popouts/Background.qml @@ -8,13 +8,13 @@ ShapePath { required property Wrapper wrapper required property bool invertBottomRounding - readonly property real rounding: BorderConfig.rounding + readonly property real rounding: Config.border.rounding readonly property bool flatten: wrapper.width < rounding * 2 readonly property real roundingX: flatten ? wrapper.width / 2 : rounding property real ibr: invertBottomRounding ? -1 : 1 strokeWidth: -1 - fillColor: BorderConfig.colour + fillColor: Config.border.colour PathArc { relativeX: root.roundingX diff --git a/modules/bar/popouts/Battery.qml b/modules/bar/popouts/Battery.qml index 44e51ce..ebd0fc8 100644 --- a/modules/bar/popouts/Battery.qml +++ b/modules/bar/popouts/Battery.qml @@ -10,7 +10,7 @@ Column { id: root spacing: Appearance.spacing.normal - width: BarConfig.sizes.batteryWidth + width: Config.bar.sizes.batteryWidth StyledText { text: UPower.displayDevice.isLaptopBattery ? qsTr("Remaining: %1%").arg(Math.round(UPower.displayDevice.percentage * 100)) : qsTr("No battery detected") diff --git a/modules/bar/popouts/TrayMenu.qml b/modules/bar/popouts/TrayMenu.qml index d69bf38..433de7f 100644 --- a/modules/bar/popouts/TrayMenu.qml +++ b/modules/bar/popouts/TrayMenu.qml @@ -80,7 +80,7 @@ StackView { required property QsMenuEntry modelData - implicitWidth: BarConfig.sizes.trayMenuWidth + implicitWidth: Config.bar.sizes.trayMenuWidth implicitHeight: modelData.isSeparator ? 1 : children.implicitHeight radius: Appearance.rounding.full @@ -153,7 +153,7 @@ StackView { font.family: label.font.family elide: Text.ElideRight - elideWidth: BarConfig.sizes.trayMenuWidth - (icon.active ? icon.implicitWidth + label.anchors.leftMargin : 0) - (expand.active ? expand.implicitWidth + Appearance.spacing.normal : 0) + elideWidth: Config.bar.sizes.trayMenuWidth - (icon.active ? icon.implicitWidth + label.anchors.leftMargin : 0) - (expand.active ? expand.implicitWidth + Appearance.spacing.normal : 0) } Loader { |