feat: user config file

Config file at `~/.config/caelestia/shell.json`
This commit is contained in:
2 * r + 2 * t 2025-06-15 18:08:45 +10:00
parent 3df0f7fd26
commit 96429160c3
52 changed files with 231 additions and 222 deletions

View file

@ -1,22 +1,14 @@
pragma Singleton
import Quickshell.Io
import Quickshell
import QtQuick
Singleton {
id: root
readonly property Sizes sizes: Sizes {}
readonly property Workspaces workspaces: Workspaces {}
component Sizes: QtObject {
JsonObject {
property JsonObject sizes: JsonObject {
property int innerHeight: 30
property int windowPreviewSize: 400
property int trayMenuWidth: 300
property int batteryWidth: 250
}
component Workspaces: QtObject {
property JsonObject workspaces: JsonObject {
property int shown: 5
property bool rounded: true
property bool activeIndicator: true

View file

@ -1,13 +1,9 @@
pragma Singleton
import "root:/services"
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
readonly property color colour: Colours.palette.m3surface
readonly property int thickness: Appearance.padding.normal
readonly property int rounding: Appearance.rounding.large
JsonObject {
property color colour: Colours.palette.m3surface
property int thickness: Appearance.padding.normal
property int rounding: Appearance.rounding.large
}

36
config/Config.qml Normal file
View file

@ -0,0 +1,36 @@
pragma Singleton
import "root:/utils"
import Quickshell
import Quickshell.Io
import QtQuick
Singleton {
id: root
property alias bar: adapter.bar
property alias border: adapter.border
property alias dashboard: adapter.dashboard
property alias launcher: adapter.launcher
property alias notifs: adapter.notifs
property alias osd: adapter.osd
property alias session: adapter.session
FileView {
path: `${Paths.config}/shell.json`
watchChanges: true
onAdapterUpdated: writeAdapter()
JsonAdapter {
id: adapter
property JsonObject bar: BarConfig {}
property JsonObject border: BorderConfig {}
property JsonObject dashboard: DashboardConfig {}
property JsonObject launcher: LauncherConfig {}
property JsonObject notifs: NotifsConfig {}
property JsonObject osd: OsdConfig {}
property JsonObject session: SessionConfig {}
}
}
}

View file

@ -1,14 +1,10 @@
pragma Singleton
import Quickshell.Io
import Quickshell
import QtQuick
JsonObject {
property int mediaUpdateInterval: 500
property int visualiserBars: 45
Singleton {
readonly property int mediaUpdateInterval: 500
readonly property int visualiserBars: 45
readonly property Sizes sizes: Sizes {}
component Sizes: QtObject {
property JsonObject sizes: JsonObject {
readonly property int tabIndicatorHeight: 3
readonly property int tabIndicatorSpacing: 5
readonly property int infoWidth: 200

View file

@ -1,18 +1,14 @@
pragma Singleton
import Quickshell.Io
import Quickshell
import QtQuick
JsonObject {
property int maxShown: 8
property int maxWallpapers: 9 // Warning: even numbers look bad
property string actionPrefix: ">"
Singleton {
readonly property int maxShown: 8
readonly property int maxWallpapers: 9 // Warning: even numbers look bad
readonly property string actionPrefix: ">"
readonly property Sizes sizes: Sizes {}
component Sizes: QtObject {
readonly property int itemWidth: 600
readonly property int itemHeight: 57
readonly property int wallpaperWidth: 280
readonly property int wallpaperHeight: 200
property JsonObject sizes: JsonObject {
property int itemWidth: 600
property int itemHeight: 57
property int wallpaperWidth: 280
property int wallpaperHeight: 200
}
}

View file

@ -1,19 +1,15 @@
pragma Singleton
import Quickshell.Io
import Quickshell
import QtQuick
JsonObject {
property bool expire: false
property int defaultExpireTimeout: 3000
property real clearThreshold: 0.3
property int expandThreshold: 20
property bool actionOnClick: false
Singleton {
readonly property bool expire: false
readonly property int defaultExpireTimeout: 3000
readonly property real clearThreshold: 0.3
readonly property int expandThreshold: 20
readonly property bool actionOnClick: false
readonly property Sizes sizes: Sizes {}
component Sizes: QtObject {
readonly property int width: 400
readonly property int image: 41
readonly property int badge: 20
property JsonObject sizes: JsonObject {
property int width: 400
property int image: 41
property int badge: 20
}
}

View file

@ -1,14 +1,10 @@
pragma Singleton
import Quickshell.Io
import Quickshell
import QtQuick
JsonObject {
property int hideDelay: 2000
Singleton {
readonly property int hideDelay: 2000
readonly property Sizes sizes: Sizes {}
component Sizes: QtObject {
readonly property int sliderWidth: 30
readonly property int sliderHeight: 150
property JsonObject sizes: JsonObject {
property int sliderWidth: 30
property int sliderHeight: 150
}
}

View file

@ -1,13 +1,9 @@
pragma Singleton
import Quickshell.Io
import Quickshell
import QtQuick
JsonObject {
property int dragThreshold: 30
Singleton {
readonly property int dragThreshold: 30
readonly property Sizes sizes: Sizes {}
component Sizes: QtObject {
readonly property int button: 80
property JsonObject sizes: JsonObject {
property int button: 80
}
}

View file

@ -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;

View file

@ -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 {}
}

View file

@ -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

View file

@ -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

View file

@ -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 {

View file

@ -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
}
}
}

View file

@ -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

View file

@ -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")

View file

@ -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 {

View file

@ -7,12 +7,12 @@ ShapePath {
id: root
required property Wrapper wrapper
readonly property real rounding: BorderConfig.rounding
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
strokeWidth: -1
fillColor: BorderConfig.colour
fillColor: Config.border.colour
PathArc {
relativeX: root.rounding

View file

@ -26,7 +26,7 @@ GridLayout {
Rect {
Layout.row: 0
Layout.columnSpan: 2
Layout.preferredWidth: DashboardConfig.sizes.weatherWidth
Layout.preferredWidth: Config.dashboard.sizes.weatherWidth
Layout.fillHeight: true
Weather {}

View file

@ -28,8 +28,8 @@ Item {
return `${Math.floor(length / 60)}:${Math.floor(length % 60).toString().padStart(2, "0")}`;
}
implicitWidth: cover.implicitWidth + DashboardConfig.sizes.mediaVisualiserSize * 2 + details.implicitWidth + details.anchors.leftMargin + bongocat.implicitWidth + bongocat.anchors.leftMargin * 2 + Appearance.padding.large * 2
implicitHeight: Math.max(cover.implicitHeight + DashboardConfig.sizes.mediaVisualiserSize * 2, details.implicitHeight, bongocat.implicitHeight) + Appearance.padding.large * 2
implicitWidth: cover.implicitWidth + Config.dashboard.sizes.mediaVisualiserSize * 2 + details.implicitWidth + details.anchors.leftMargin + bongocat.implicitWidth + bongocat.anchors.leftMargin * 2 + Appearance.padding.large * 2
implicitHeight: Math.max(cover.implicitHeight + Config.dashboard.sizes.mediaVisualiserSize * 2, details.implicitHeight, bongocat.implicitHeight) + Appearance.padding.large * 2
Behavior on playerProgress {
NumberAnimation {
@ -41,7 +41,7 @@ Item {
Timer {
running: root.shouldUpdate && (Players.active?.isPlaying ?? false)
interval: DashboardConfig.mediaUpdateInterval
interval: Config.dashboard.mediaUpdateInterval
triggeredOnStart: true
repeat: true
onTriggered: Players.active?.positionChanged()
@ -66,7 +66,7 @@ Item {
property color colour: Colours.palette.m3primary
anchors.fill: cover
anchors.margins: -DashboardConfig.sizes.mediaVisualiserSize
anchors.margins: -Config.dashboard.sizes.mediaVisualiserSize
onColourChanged: requestPaint()
@ -81,7 +81,7 @@ Item {
ctx.lineWidth = 360 / len - Appearance.spacing.small / 4;
ctx.lineCap = "round";
const size = DashboardConfig.sizes.mediaVisualiserSize;
const size = Config.dashboard.sizes.mediaVisualiserSize;
const cx = centerX;
const cy = centerY;
const rx = innerX + ctx.lineWidth / 2;
@ -116,10 +116,10 @@ Item {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: Appearance.padding.large + DashboardConfig.sizes.mediaVisualiserSize
anchors.leftMargin: Appearance.padding.large + Config.dashboard.sizes.mediaVisualiserSize
implicitWidth: DashboardConfig.sizes.mediaCoverArtSize
implicitHeight: DashboardConfig.sizes.mediaCoverArtSize
implicitWidth: Config.dashboard.sizes.mediaCoverArtSize
implicitHeight: Config.dashboard.sizes.mediaCoverArtSize
color: Colours.palette.m3surfaceContainerHigh
radius: Appearance.rounding.full

View file

@ -65,7 +65,7 @@ Row {
property bool primary
readonly property real primaryMult: primary ? 1.2 : 1
readonly property real thickness: DashboardConfig.sizes.resourceProgessThickness * primaryMult
readonly property real thickness: Config.dashboard.sizes.resourceProgessThickness * primaryMult
property color fg1: Colours.palette.m3primary
property color fg2: Colours.palette.m3secondary
@ -74,8 +74,8 @@ Row {
anchors.verticalCenter: parent.verticalCenter
implicitWidth: DashboardConfig.sizes.resourceSize * primaryMult
implicitHeight: DashboardConfig.sizes.resourceSize * primaryMult
implicitWidth: Config.dashboard.sizes.resourceSize * primaryMult
implicitHeight: Config.dashboard.sizes.resourceSize * primaryMult
onValue1Changed: canvas.requestPaint()
onValue2Changed: canvas.requestPaint()

View file

@ -48,14 +48,14 @@ Item {
id: indicator
anchors.top: bar.bottom
anchors.topMargin: DashboardConfig.sizes.tabIndicatorSpacing
anchors.topMargin: Config.dashboard.sizes.tabIndicatorSpacing
implicitWidth: bar.currentItem.implicitWidth
implicitHeight: DashboardConfig.sizes.tabIndicatorHeight
implicitHeight: Config.dashboard.sizes.tabIndicatorHeight
x: {
const tab = bar.currentItem;
const width = (root.nonAnimWidth - DashboardConfig.sizes.tabIndicatorSpacing * (bar.count - 1) * 2) / bar.count
const width = (root.nonAnimWidth - Config.dashboard.sizes.tabIndicatorSpacing * (bar.count - 1) * 2) / bar.count;
return width * tab.TabBar.index + (width - tab.implicitWidth) / 2;
}
@ -69,7 +69,6 @@ Item {
color: Colours.palette.m3primary
radius: Appearance.rounding.full
}
Behavior on x {
@ -108,14 +107,17 @@ Item {
cursorShape: Qt.PointingHandCursor
onPressed: ({x,y}) => {
onPressed: ({
x,
y
}) => {
tab.TabBar.tabBar.setCurrentIndex(tab.TabBar.index);
const stateY = stateWrapper.y;
rippleAnim.x = x;
rippleAnim.y = y - stateY;
const dist = (ox,oy) => ox * ox + oy * oy;
const dist = (ox, oy) => ox * ox + oy * oy;
const stateEndY = stateY + stateWrapper.height;
rippleAnim.radius = Math.sqrt(Math.max(dist(0, stateY), dist(0, stateEndY), dist(width, stateY), dist(width, stateEndY)));
@ -176,7 +178,7 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
implicitHeight: parent.height + DashboardConfig.sizes.tabIndicatorSpacing * 2
implicitHeight: parent.height + Config.dashboard.sizes.tabIndicatorSpacing * 2
color: "transparent"
radius: Appearance.rounding.small
@ -237,7 +239,6 @@ Item {
text: tab.text
color: tab.current ? Colours.palette.m3primary : Colours.palette.m3onSurfaceVariant
}
}
}

View file

@ -8,7 +8,7 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: DashboardConfig.sizes.dateTimeWidth
implicitWidth: Config.dashboard.sizes.dateTimeWidth
StyledText {
id: hours

View file

@ -19,7 +19,7 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
implicitWidth: DashboardConfig.sizes.mediaWidth
implicitWidth: Config.dashboard.sizes.mediaWidth
Behavior on playerProgress {
NumberAnimation {
@ -31,7 +31,7 @@ Item {
Timer {
running: root.shouldUpdate && (Players.active?.isPlaying ?? false)
interval: DashboardConfig.mediaUpdateInterval
interval: Config.dashboard.mediaUpdateInterval
triggeredOnStart: true
repeat: true
onTriggered: Players.active?.positionChanged()
@ -43,16 +43,16 @@ Item {
ShapePath {
fillColor: "transparent"
strokeColor: Colours.palette.m3surfaceContainerHigh
strokeWidth: DashboardConfig.sizes.mediaProgressThickness
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + DashboardConfig.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + DashboardConfig.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - DashboardConfig.sizes.mediaProgressSweep / 2
sweepAngle: DashboardConfig.sizes.mediaProgressSweep
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
sweepAngle: Config.dashboard.sizes.mediaProgressSweep
}
Behavior on strokeColor {
@ -67,16 +67,16 @@ Item {
ShapePath {
fillColor: "transparent"
strokeColor: Colours.palette.m3primary
strokeWidth: DashboardConfig.sizes.mediaProgressThickness
strokeWidth: Config.dashboard.sizes.mediaProgressThickness
capStyle: ShapePath.RoundCap
PathAngleArc {
centerX: cover.x + cover.width / 2
centerY: cover.y + cover.height / 2
radiusX: (cover.width + DashboardConfig.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + DashboardConfig.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - DashboardConfig.sizes.mediaProgressSweep / 2
sweepAngle: DashboardConfig.sizes.mediaProgressSweep * root.playerProgress
radiusX: (cover.width + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
radiusY: (cover.height + Config.dashboard.sizes.mediaProgressThickness) / 2 + Appearance.spacing.small
startAngle: -90 - Config.dashboard.sizes.mediaProgressSweep / 2
sweepAngle: Config.dashboard.sizes.mediaProgressSweep * root.playerProgress
}
Behavior on strokeColor {
@ -95,7 +95,7 @@ Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Appearance.padding.large + DashboardConfig.sizes.mediaProgressThickness + Appearance.spacing.small
anchors.margins: Appearance.padding.large + Config.dashboard.sizes.mediaProgressThickness + Appearance.spacing.small
implicitHeight: width
color: Colours.palette.m3surfaceContainerHigh

View file

@ -49,7 +49,7 @@ Row {
anchors.bottom: icon.top
anchors.bottomMargin: Appearance.spacing.small
implicitWidth: DashboardConfig.sizes.resourceProgessThickness
implicitWidth: Config.dashboard.sizes.resourceProgessThickness
color: Colours.palette.m3surfaceContainerHigh
radius: Appearance.rounding.full

View file

@ -90,7 +90,7 @@ Row {
id: icon
anchors.left: parent.left
anchors.leftMargin: (DashboardConfig.sizes.infoIconSize - implicitWidth) / 2
anchors.leftMargin: (Config.dashboard.sizes.infoIconSize - implicitWidth) / 2
text: line.icon
color: line.colour
@ -109,7 +109,7 @@ Row {
text: `: ${line.text}`
font.pointSize: Appearance.font.size.normal
width: DashboardConfig.sizes.infoWidth
width: Config.dashboard.sizes.infoWidth
elide: Text.ElideRight
}
}

View file

@ -16,7 +16,7 @@ Shape {
required property Item bar
anchors.fill: parent
anchors.margins: BorderConfig.thickness
anchors.margins: Config.border.thickness
anchors.leftMargin: bar.implicitWidth
preferredRendererType: Shape.CurveRenderer
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1

View file

@ -16,7 +16,7 @@ Item {
id: rect
anchors.fill: parent
color: Colours.alpha(BorderConfig.colour, false)
color: Colours.alpha(Config.border.colour, false)
visible: false
}
@ -29,9 +29,9 @@ Item {
Rectangle {
anchors.fill: parent
anchors.margins: BorderConfig.thickness
anchors.margins: Config.border.thickness
anchors.leftMargin: root.bar.implicitWidth
radius: BorderConfig.rounding
radius: Config.border.rounding
}
}

View file

@ -33,9 +33,9 @@ Variants {
mask: Region {
x: bar.implicitWidth
y: BorderConfig.thickness
width: win.width - bar.implicitWidth - BorderConfig.thickness
height: win.height - BorderConfig.thickness * 2
y: Config.border.thickness
width: win.width - bar.implicitWidth - Config.border.thickness
height: win.height - Config.border.thickness * 2
intersection: Intersection.Xor
regions: regions.instances
@ -55,7 +55,7 @@ Variants {
required property Item modelData
x: modelData.x + bar.implicitWidth
y: modelData.y + BorderConfig.thickness
y: modelData.y + Config.border.thickness
width: modelData.width
height: modelData.height
intersection: Intersection.Subtract

View file

@ -31,6 +31,6 @@ Scope {
component ExclusionZone: StyledWindow {
screen: root.screen
name: "border-exclusion"
exclusiveZone: BorderConfig.thickness
exclusiveZone: Config.border.thickness
}
}

View file

@ -20,8 +20,8 @@ MouseArea {
property bool osdShortcutActive
function withinPanelHeight(panel: Item, x: real, y: real): bool {
const panelY = BorderConfig.thickness + panel.y;
return y >= panelY - BorderConfig.rounding && y <= panelY + panel.height + BorderConfig.rounding;
const panelY = Config.border.thickness + panel.y;
return y >= panelY - Config.border.rounding && y <= panelY + panel.height + Config.border.rounding;
}
function inRightPanel(panel: Item, x: real, y: real): bool {
@ -30,7 +30,7 @@ MouseArea {
function inTopPanel(panel: Item, x: real, y: real): bool {
const panelX = bar.implicitWidth + panel.x;
return y < BorderConfig.thickness + panel.y + panel.height && x >= panelX - BorderConfig.rounding && x <= panelX + panel.width + BorderConfig.rounding;
return y < Config.border.thickness + panel.y + panel.height && x >= panelX - Config.border.rounding && x <= panelX + panel.width + Config.border.rounding;
}
anchors.fill: parent
@ -51,7 +51,10 @@ MouseArea {
}
}
onPositionChanged: ({x, y}) => {
onPositionChanged: ({
x,
y
}) => {
// Show osd on hover
const showOsd = inRightPanel(panels.osd, x, y);
@ -68,9 +71,9 @@ MouseArea {
// Show/hide session on drag
if (pressed && withinPanelHeight(panels.session, x, y)) {
const dragX = x - dragStart.x;
if (dragX < -SessionConfig.dragThreshold)
if (dragX < -Config.session.dragThreshold)
visibilities.session = true;
else if (dragX > SessionConfig.dragThreshold)
else if (dragX > Config.session.dragThreshold)
visibilities.session = false;
}

View file

@ -24,7 +24,7 @@ Item {
readonly property BarPopouts.Wrapper popouts: popouts
anchors.fill: parent
anchors.margins: BorderConfig.thickness
anchors.margins: Config.border.thickness
anchors.leftMargin: bar.implicitWidth
Component.onCompleted: Visibilities.panels[screen] = this
@ -83,7 +83,7 @@ Item {
anchors.left: parent.left
anchors.verticalCenter: parent.top
anchors.verticalCenterOffset: {
const off = root.popouts.currentCenter - BorderConfig.thickness;
const off = root.popouts.currentCenter - Config.border.thickness;
const diff = root.height - Math.floor(off + implicitHeight / 2);
if (diff < 0)
return off + diff;

View file

@ -9,7 +9,7 @@ Item {
required property Actions.Action modelData
required property var list
implicitHeight: LauncherConfig.sizes.itemHeight
implicitHeight: Config.launcher.sizes.itemHeight
anchors.left: parent?.left
anchors.right: parent?.right

View file

@ -96,7 +96,7 @@ Singleton {
}))
function fuzzyQuery(search: string): var {
return Fuzzy.go(search.slice(LauncherConfig.actionPrefix.length), preppedActions, {
return Fuzzy.go(search.slice(Config.launcher.actionPrefix.length), preppedActions, {
all: true,
keys: ["name", "desc"],
scoreFn: r => r[0].score > 0 ? r[0].score * 0.9 + r[1].score * 0.1 : 0
@ -104,7 +104,7 @@ Singleton {
}
function autocomplete(list: AppList, text: string): void {
list.search.text = `${LauncherConfig.actionPrefix}${text} `;
list.search.text = `${Config.launcher.actionPrefix}${text} `;
}
Process {

View file

@ -11,7 +11,7 @@ Item {
required property DesktopEntry modelData
required property PersistentProperties visibilities
implicitHeight: LauncherConfig.sizes.itemHeight
implicitHeight: Config.launcher.sizes.itemHeight
anchors.left: parent?.left
anchors.right: parent?.right

View file

@ -14,14 +14,14 @@ ListView {
required property TextField search
required property PersistentProperties visibilities
property bool isAction: search.text.startsWith(LauncherConfig.actionPrefix)
property bool isAction: search.text.startsWith(Config.launcher.actionPrefix)
function getModelValues() {
let text = search.text;
if (isAction)
return Actions.fuzzyQuery(text);
if (text.startsWith(LauncherConfig.actionPrefix))
text = search.text.slice(LauncherConfig.actionPrefix.length);
if (text.startsWith(Config.launcher.actionPrefix))
text = search.text.slice(Config.launcher.actionPrefix.length);
return Apps.fuzzyQuery(text);
}
@ -32,7 +32,7 @@ ListView {
spacing: Appearance.spacing.small
orientation: Qt.Vertical
implicitHeight: (LauncherConfig.sizes.itemHeight + spacing) * Math.min(LauncherConfig.maxShown, count) - spacing
implicitHeight: (Config.launcher.sizes.itemHeight + spacing) * Math.min(Config.launcher.maxShown, count) - spacing
highlightMoveDuration: Appearance.anim.durations.normal
highlightResizeDuration: 0

View file

@ -7,12 +7,12 @@ ShapePath {
id: root
required property Wrapper wrapper
readonly property real rounding: BorderConfig.rounding
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
strokeWidth: -1
fillColor: BorderConfig.colour
fillColor: Config.border.colour
PathArc {
relativeX: root.rounding

View file

@ -74,7 +74,7 @@ Item {
topPadding: Appearance.padding.larger
bottomPadding: Appearance.padding.larger
placeholderText: qsTr("Type \"%1\" for commands").arg(LauncherConfig.actionPrefix)
placeholderText: qsTr("Type \"%1\" for commands").arg(Config.launcher.actionPrefix)
background: null
onAccepted: {
@ -83,7 +83,7 @@ Item {
if (list.showWallpapers) {
Wallpapers.setWallpaper(currentItem.modelData.path);
root.visibilities.launcher = false;
} else if (text.startsWith(LauncherConfig.actionPrefix)) {
} else if (text.startsWith(Config.launcher.actionPrefix)) {
currentItem.modelData.onClicked(list.currentList);
} else {
Apps.launch(currentItem.modelData);

View file

@ -15,7 +15,7 @@ Item {
required property int padding
required property int rounding
property bool showWallpapers: search.text.startsWith(`${LauncherConfig.actionPrefix}wallpaper `)
property bool showWallpapers: search.text.startsWith(`${Config.launcher.actionPrefix}wallpaper `)
property var currentList: (showWallpapers ? wallpaperList : appList).item
anchors.horizontalCenter: parent.horizontalCenter
@ -29,7 +29,7 @@ Item {
name: "apps"
PropertyChanges {
root.implicitWidth: LauncherConfig.sizes.itemWidth
root.implicitWidth: Config.launcher.sizes.itemWidth
root.implicitHeight: Math.max(empty.height, appList.height)
appList.active: true
}
@ -43,8 +43,8 @@ Item {
name: "wallpapers"
PropertyChanges {
root.implicitWidth: Math.max(LauncherConfig.sizes.itemWidth, wallpaperList.width)
root.implicitHeight: LauncherConfig.sizes.wallpaperHeight
root.implicitWidth: Math.max(Config.launcher.sizes.itemWidth, wallpaperList.width)
root.implicitHeight: Config.launcher.sizes.wallpaperHeight
wallpaperList.active: true
}
}

View file

@ -42,7 +42,7 @@ StyledRect {
path: root.modelData.path
smooth: !root.PathView.view.moving
width: LauncherConfig.sizes.wallpaperWidth
width: Config.launcher.sizes.wallpaperWidth
height: width / 16 * 9
}

View file

@ -14,8 +14,8 @@ PathView {
const screenWidth = QsWindow.window?.screen.width * 0.8;
if (!screenWidth)
return 0;
const itemWidth = LauncherConfig.sizes.wallpaperWidth * 0.8;
const max = LauncherConfig.maxWallpapers;
const itemWidth = Config.launcher.sizes.wallpaperWidth * 0.8;
const max = Config.launcher.maxWallpapers;
if (max * itemWidth > screenWidth) {
const items = Math.floor(screenWidth / itemWidth);
return items > 1 && items % 2 === 0 ? items - 1 : items;
@ -43,7 +43,7 @@ PathView {
Wallpapers.preview(currentItem.modelData.path);
}
implicitWidth: Math.min(numItems, count) * (LauncherConfig.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
implicitWidth: Math.min(numItems, count) * (Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
pathItemCount: numItems
cacheItemCount: 4

View file

@ -8,13 +8,13 @@ ShapePath {
id: root
required property Wrapper wrapper
readonly property real rounding: BorderConfig.rounding
readonly property real rounding: Config.border.rounding
readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
property real fullHeightRounding: wrapper.height >= QsWindow.window?.height - BorderConfig.thickness * 2 ? -rounding : rounding
property real fullHeightRounding: wrapper.height >= QsWindow.window?.height - Config.border.thickness * 2 ? -rounding : rounding
strokeWidth: -1
fillColor: BorderConfig.colour
fillColor: Config.border.colour
PathLine {
relativeX: -(root.wrapper.width + root.rounding)

View file

@ -14,7 +14,7 @@ Item {
anchors.bottom: parent.bottom
anchors.right: parent.right
implicitWidth: NotifsConfig.sizes.width + padding * 2
implicitWidth: Config.notifs.sizes.width + padding * 2
implicitHeight: {
const count = list.count;
if (count === 0)
@ -29,19 +29,19 @@ Item {
const panel = Visibilities.panels[screen];
if (visibilities && panel) {
if (visibilities.osd) {
const h = panel.osd.y - BorderConfig.rounding * 2;
const h = panel.osd.y - Config.border.rounding * 2;
if (height > h)
height = h;
}
if (visibilities.session) {
const h = panel.session.y - BorderConfig.rounding * 2;
const h = panel.session.y - Config.border.rounding * 2;
if (height > h)
height = h;
}
}
return Math.min((screen?.height ?? 0) - BorderConfig.thickness * 2, height + padding * 2);
return Math.min((screen?.height ?? 0) - Config.border.thickness * 2, height + padding * 2);
}
ClippingWrapperRectangle {
@ -108,7 +108,7 @@ Item {
Anim {
target: notif
property: "x"
to: (notif.x >= 0 ? NotifsConfig.sizes.width : -NotifsConfig.sizes.width) * 2
to: (notif.x >= 0 ? Config.notifs.sizes.width : -Config.notifs.sizes.width) * 2
duration: Appearance.anim.durations.normal
easing.bezierCurve: Appearance.anim.curves.emphasized
}

View file

@ -20,10 +20,10 @@ StyledRect {
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer
radius: Appearance.rounding.normal
implicitWidth: NotifsConfig.sizes.width
implicitWidth: Config.notifs.sizes.width
implicitHeight: inner.implicitHeight
x: NotifsConfig.sizes.width
x: Config.notifs.sizes.width
Component.onCompleted: x = 0
RetainableLock {
@ -52,7 +52,7 @@ StyledRect {
root.modelData.notification.dismiss();
}
onReleased: event => {
if (Math.abs(root.x) < NotifsConfig.sizes.width * NotifsConfig.clearThreshold)
if (Math.abs(root.x) < Config.notifs.sizes.width * Config.notifs.clearThreshold)
root.x = 0;
else
root.modelData.popup = false;
@ -60,12 +60,12 @@ StyledRect {
onPositionChanged: event => {
if (pressed) {
const diffY = event.y - startY;
if (Math.abs(diffY) > NotifsConfig.expandThreshold)
if (Math.abs(diffY) > Config.notifs.expandThreshold)
root.expanded = diffY > 0;
}
}
onClicked: event => {
if (!NotifsConfig.actionOnClick || event.button !== Qt.LeftButton)
if (!Config.notifs.actionOnClick || event.button !== Qt.LeftButton)
return;
const actions = root.modelData.actions;
@ -107,14 +107,14 @@ StyledRect {
anchors.left: parent.left
anchors.top: parent.top
width: NotifsConfig.sizes.image
height: NotifsConfig.sizes.image
width: Config.notifs.sizes.image
height: Config.notifs.sizes.image
visible: root.hasImage || root.hasAppIcon
sourceComponent: ClippingRectangle {
radius: Appearance.rounding.full
implicitWidth: NotifsConfig.sizes.image
implicitHeight: NotifsConfig.sizes.image
implicitWidth: Config.notifs.sizes.image
implicitHeight: Config.notifs.sizes.image
Image {
anchors.fill: parent
@ -140,8 +140,8 @@ StyledRect {
sourceComponent: StyledRect {
radius: Appearance.rounding.full
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3surfaceContainerHighest : Colours.palette.m3tertiaryContainer
implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image
implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image
implicitWidth: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
implicitHeight: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
Loader {
id: icon

View file

@ -7,12 +7,12 @@ ShapePath {
id: root
required property Wrapper wrapper
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
strokeWidth: -1
fillColor: BorderConfig.colour
fillColor: Config.border.colour
PathArc {
relativeX: -root.roundingX

View file

@ -28,8 +28,8 @@ Column {
value: Audio.volume
onMoved: Audio.setVolume(value)
implicitWidth: OsdConfig.sizes.sliderWidth
implicitHeight: OsdConfig.sizes.sliderHeight
implicitWidth: Config.osd.sizes.sliderWidth
implicitHeight: Config.osd.sizes.sliderHeight
}
VerticalSlider {
@ -37,7 +37,7 @@ Column {
value: root.monitor?.brightness ?? 0
onMoved: root.monitor?.setBrightness(value)
implicitWidth: OsdConfig.sizes.sliderWidth
implicitHeight: OsdConfig.sizes.sliderHeight
implicitWidth: Config.osd.sizes.sliderWidth
implicitHeight: Config.osd.sizes.sliderHeight
}
}

View file

@ -39,7 +39,7 @@ Scope {
Timer {
id: timer
interval: OsdConfig.hideDelay
interval: Config.osd.hideDelay
onTriggered: {
if (!root.hovered)
root.visibilities.osd = false;

View file

@ -7,12 +7,12 @@ ShapePath {
id: root
required property Wrapper wrapper
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
strokeWidth: -1
fillColor: BorderConfig.colour
fillColor: Config.border.colour
PathArc {
relativeX: -root.roundingX

View file

@ -48,8 +48,8 @@ Column {
}
AnimatedImage {
width: SessionConfig.sizes.button
height: SessionConfig.sizes.button
width: Config.session.sizes.button
height: Config.session.sizes.button
sourceSize.width: width
sourceSize.height: height
@ -84,8 +84,8 @@ Column {
required property string icon
required property list<string> command
implicitWidth: SessionConfig.sizes.button
implicitHeight: SessionConfig.sizes.button
implicitWidth: Config.session.sizes.button
implicitHeight: Config.session.sizes.button
radius: Appearance.rounding.large
color: button.activeFocus ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer

View file

@ -11,7 +11,7 @@ Singleton {
Process {
running: true
command: ["sh", "-c", `printf '[general]\nframerate=60\nbars=${DashboardConfig.visualiserBars}\n[output]\nchannels=mono\nmethod=raw\nraw_target=/dev/stdout\ndata_format=ascii\nascii_max_range=100' | cava -p /dev/stdin`]
command: ["sh", "-c", `printf '[general]\nframerate=60\nbars=${Config.dashboard.visualiserBars}\n[output]\nchannels=mono\nmethod=raw\nraw_target=/dev/stdout\ndata_format=ascii\nascii_max_range=100' | cava -p /dev/stdin`]
stdout: SplitParser {
onRead: data => root.values = data.slice(0, -1).split(";").map(v => parseInt(v, 10))
}

View file

@ -80,9 +80,9 @@ Singleton {
readonly property Timer timer: Timer {
running: true
interval: notif.notification.expireTimeout > 0 ? notif.notification.expireTimeout : NotifsConfig.defaultExpireTimeout
interval: notif.notification.expireTimeout > 0 ? notif.notification.expireTimeout : Config.notifs.defaultExpireTimeout
onTriggered: {
if (NotifsConfig.expire)
if (Config.notifs.expire)
notif.popup = false;
}
}

View file

@ -13,6 +13,7 @@ Singleton {
readonly property url data: `${StandardPaths.standardLocations(StandardPaths.GenericDataLocation)[0]}/caelestia`
readonly property url state: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia`
readonly property url cache: `${StandardPaths.standardLocations(StandardPaths.GenericCacheLocation)[0]}/caelestia`
readonly property url config: `${StandardPaths.standardLocations(StandardPaths.GenericConfigLocation)[0]}/caelestia`
readonly property url imagecache: `${cache}/imagecache`