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"; return "apps";
} }
onStateChanged: {
if (state === "scheme" || state === "variant")
Schemes.reload();
}
states: [ states: [
State { State {
name: "apps" name: "apps"

View file

@ -67,25 +67,38 @@ Item {
anchors.leftMargin: Appearance.spacing.normal anchors.leftMargin: Appearance.spacing.normal
anchors.verticalCenter: parent.verticalCenter 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 spacing: 0
StyledText { StyledText {
id: name text: root.modelData?.flavour ?? ""
text: root.modelData?.name ?? ""
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }
StyledText { StyledText {
id: comment text: root.modelData?.name ?? ""
text: root.modelData?.flavour ?? ""
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small
color: Colours.palette.m3outline color: Colours.palette.m3outline
elide: Text.ElideRight 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 anchors.verticalCenter: parent.verticalCenter
} }
Item { Column {
anchors.left: icon.right anchors.left: icon.right
anchors.leftMargin: Appearance.spacing.larger anchors.leftMargin: Appearance.spacing.larger
anchors.verticalCenter: icon.verticalCenter anchors.verticalCenter: icon.verticalCenter
implicitWidth: parent.width - icon.width width: parent.width - icon.width - anchors.leftMargin - (current.active ? current.width + Appearance.spacing.normal : 0)
implicitHeight: name.implicitHeight + desc.implicitHeight spacing: 0
StyledText { StyledText {
id: name
text: root.modelData?.name ?? "" text: root.modelData?.name ?? ""
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }
StyledText { StyledText {
id: desc
text: root.modelData?.description ?? "" text: root.modelData?.description ?? ""
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small
color: Colours.palette.m3outline color: Colours.palette.m3outline
elide: Text.ElideRight 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 {
variant: "vibrant" variant: "vibrant"
icon: "sentiment_very_dissatisfied" icon: "sentiment_very_dissatisfied"
name: "Vibrant" name: qsTr("Vibrant")
description: "A high chroma palette. The primary palette's chroma is at maximum." description: qsTr("A high chroma palette. The primary palette's chroma is at maximum.")
}, },
Variant { Variant {
variant: "tonalspot" variant: "tonalspot"
icon: "android" icon: "android"
name: "Tonal Spot" name: qsTr("Tonal Spot")
description: "Default for Material theme colours. A pastel palette with a low chroma." description: qsTr("Default for Material theme colours. A pastel palette with a low chroma.")
}, },
Variant { Variant {
variant: "expressive" variant: "expressive"
icon: "compare_arrows" icon: "compare_arrows"
name: "Expressive" name: qsTr("Expressive")
description: "A medium chroma palette. The primary palette's hue is different from the seed colour, for variety." description: qsTr("A medium chroma palette. The primary palette's hue is different from the seed colour, for variety.")
}, },
Variant { Variant {
variant: "fidelity" variant: "fidelity"
icon: "compare" icon: "compare"
name: "Fidelity" name: qsTr("Fidelity")
description: "Matches the seed colour, even if the seed colour is very bright (high chroma)." description: qsTr("Matches the seed colour, even if the seed colour is very bright (high chroma).")
}, },
Variant { Variant {
variant: "content" variant: "content"
icon: "sentiment_calm" icon: "sentiment_calm"
name: "Content" name: qsTr("Content")
description: "Almost identical to fidelity." description: qsTr("Almost identical to fidelity.")
}, },
Variant { Variant {
variant: "fruitsalad" variant: "fruitsalad"
icon: "nutrition" icon: "nutrition"
name: "Fruit Salad" name: qsTr("Fruit Salad")
description: "A playful theme - the seed colour's hue does not appear in the theme." description: qsTr("A playful theme - the seed colour's hue does not appear in the theme.")
}, },
Variant { Variant {
variant: "rainbow" variant: "rainbow"
icon: "looks" icon: "looks"
name: "Rainbow" name: qsTr("Rainbow")
description: "A playful theme - the seed colour's hue does not appear in the theme." description: qsTr("A playful theme - the seed colour's hue does not appear in the theme.")
}, },
Variant { Variant {
variant: "neutral" variant: "neutral"
icon: "contrast" icon: "contrast"
name: "Neutral" name: qsTr("Neutral")
description: "Close to grayscale, a hint of chroma." description: qsTr("Close to grayscale, a hint of chroma.")
}, },
Variant { Variant {
variant: "monochrome" variant: "monochrome"
icon: "filter_b_and_w" icon: "filter_b_and_w"
name: "Monochrome" name: qsTr("Monochrome")
description: "All colours are grayscale, no chroma." description: qsTr("All colours are grayscale, no chroma.")
} }
] ]
useFuzzy: Config.launcher.useFuzzy.variants useFuzzy: Config.launcher.useFuzzy.variants

View file

@ -10,6 +10,9 @@ import QtQuick
Searcher { Searcher {
id: root id: root
property string currentScheme
property string currentVariant
function transformSearch(search: string): string { function transformSearch(search: string): string {
return search.slice(`${Config.launcher.actionPrefix}scheme `.length); return search.slice(`${Config.launcher.actionPrefix}scheme `.length);
} }
@ -18,6 +21,10 @@ Searcher {
return `${item.name} ${item.flavour}`; return `${item.name} ${item.flavour}`;
} }
function reload(): void {
getCurrent.running = true;
}
list: schemes.instances list: schemes.instances
useFuzzy: Config.launcher.useFuzzy.schemes useFuzzy: Config.launcher.useFuzzy.schemes
keys: ["name", "flavour"] keys: ["name", "flavour"]
@ -48,7 +55,21 @@ Searcher {
for (const f of s) for (const f of s)
flat.push(f); 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;
} }
} }
} }