launcher: show current scheme/variant

Also qsTr variant stuff
This commit is contained in:
2 * r + 2 * t 2025-08-23 16:53:15 +10:00
parent fffc6b07a9
commit f52fb9bd9e
5 changed files with 86 additions and 36 deletions

View file

@ -50,6 +50,11 @@ StyledListView {
return "apps";
}
onStateChanged: {
if (state === "scheme" || state === "variant")
Schemes.reload();
}
states: [
State {
name: "apps"

View file

@ -67,25 +67,38 @@ Item {
anchors.leftMargin: Appearance.spacing.normal
anchors.verticalCenter: parent.verticalCenter
width: parent.width - preview.width
width: parent.width - preview.width - anchors.leftMargin - (current.active ? current.width + Appearance.spacing.normal : 0)
spacing: 0
StyledText {
id: name
text: root.modelData?.name ?? ""
text: root.modelData?.flavour ?? ""
font.pointSize: Appearance.font.size.normal
}
StyledText {
id: comment
text: root.modelData?.flavour ?? ""
text: root.modelData?.name ?? ""
font.pointSize: Appearance.font.size.small
color: Colours.palette.m3outline
elide: Text.ElideRight
width: parent.width - Appearance.rounding.normal * 2
anchors.left: parent.left
anchors.right: parent.right
}
}
Loader {
id: current
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
active: `${root.modelData?.name} ${root.modelData?.flavour}` === Schemes.currentScheme
asynchronous: true
sourceComponent: MaterialIcon {
text: "check"
color: Colours.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.large
}
}
}

View file

@ -38,32 +38,43 @@ Item {
anchors.verticalCenter: parent.verticalCenter
}
Item {
Column {
anchors.left: icon.right
anchors.leftMargin: Appearance.spacing.larger
anchors.verticalCenter: icon.verticalCenter
implicitWidth: parent.width - icon.width
implicitHeight: name.implicitHeight + desc.implicitHeight
width: parent.width - icon.width - anchors.leftMargin - (current.active ? current.width + Appearance.spacing.normal : 0)
spacing: 0
StyledText {
id: name
text: root.modelData?.name ?? ""
font.pointSize: Appearance.font.size.normal
}
StyledText {
id: desc
text: root.modelData?.description ?? ""
font.pointSize: Appearance.font.size.small
color: Colours.palette.m3outline
elide: Text.ElideRight
width: root.width - icon.width - Appearance.rounding.normal * 2
anchors.left: parent.left
anchors.right: parent.right
}
}
anchors.top: name.bottom
Loader {
id: current
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
active: root.modelData?.variant === Schemes.currentVariant
asynchronous: true
sourceComponent: MaterialIcon {
text: "check"
color: Colours.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.large
}
}
}

View file

@ -17,56 +17,56 @@ Searcher {
Variant {
variant: "vibrant"
icon: "sentiment_very_dissatisfied"
name: "Vibrant"
description: "A high chroma palette. The primary palette's chroma is at maximum."
name: qsTr("Vibrant")
description: qsTr("A high chroma palette. The primary palette's chroma is at maximum.")
},
Variant {
variant: "tonalspot"
icon: "android"
name: "Tonal Spot"
description: "Default for Material theme colours. A pastel palette with a low chroma."
name: qsTr("Tonal Spot")
description: qsTr("Default for Material theme colours. A pastel palette with a low chroma.")
},
Variant {
variant: "expressive"
icon: "compare_arrows"
name: "Expressive"
description: "A medium chroma palette. The primary palette's hue is different from the seed colour, for variety."
name: qsTr("Expressive")
description: qsTr("A medium chroma palette. The primary palette's hue is different from the seed colour, for variety.")
},
Variant {
variant: "fidelity"
icon: "compare"
name: "Fidelity"
description: "Matches the seed colour, even if the seed colour is very bright (high chroma)."
name: qsTr("Fidelity")
description: qsTr("Matches the seed colour, even if the seed colour is very bright (high chroma).")
},
Variant {
variant: "content"
icon: "sentiment_calm"
name: "Content"
description: "Almost identical to fidelity."
name: qsTr("Content")
description: qsTr("Almost identical to fidelity.")
},
Variant {
variant: "fruitsalad"
icon: "nutrition"
name: "Fruit Salad"
description: "A playful theme - the seed colour's hue does not appear in the theme."
name: qsTr("Fruit Salad")
description: qsTr("A playful theme - the seed colour's hue does not appear in the theme.")
},
Variant {
variant: "rainbow"
icon: "looks"
name: "Rainbow"
description: "A playful theme - the seed colour's hue does not appear in the theme."
name: qsTr("Rainbow")
description: qsTr("A playful theme - the seed colour's hue does not appear in the theme.")
},
Variant {
variant: "neutral"
icon: "contrast"
name: "Neutral"
description: "Close to grayscale, a hint of chroma."
name: qsTr("Neutral")
description: qsTr("Close to grayscale, a hint of chroma.")
},
Variant {
variant: "monochrome"
icon: "filter_b_and_w"
name: "Monochrome"
description: "All colours are grayscale, no chroma."
name: qsTr("Monochrome")
description: qsTr("All colours are grayscale, no chroma.")
}
]
useFuzzy: Config.launcher.useFuzzy.variants

View file

@ -10,6 +10,9 @@ import QtQuick
Searcher {
id: root
property string currentScheme
property string currentVariant
function transformSearch(search: string): string {
return search.slice(`${Config.launcher.actionPrefix}scheme `.length);
}
@ -18,6 +21,10 @@ Searcher {
return `${item.name} ${item.flavour}`;
}
function reload(): void {
getCurrent.running = true;
}
list: schemes.instances
useFuzzy: Config.launcher.useFuzzy.schemes
keys: ["name", "flavour"]
@ -48,7 +55,21 @@ Searcher {
for (const f of s)
flat.push(f);
schemes.model = flat;
schemes.model = flat.sort((a, b) => (a.name + a.flavour).localeCompare((b.name + b.flavour)));
}
}
}
Process {
id: getCurrent
running: true
command: ["caelestia", "scheme", "get", "-nfv"]
stdout: StdioCollector {
onStreamFinished: {
const [name, flavour, variant] = text.trim().split("\n");
root.currentScheme = `${name} ${flavour}`;
root.currentVariant = variant;
}
}
}