repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
quickshell/nuguland/features/noko/NokoConfig.qml
Rawimport QtQuick
import "../.."
import "../../human.js" as Human
// Setup and preferences of noko; dictation and history stay in its popup.
// Downloads wait for consent and name their size; the engine updates itself.
ConfigSection {
id: root
required property Noko service
readonly property bool engineMissing: root.service.statusKnown && !root.service.engineRevision && !root.service.pendingRevision
readonly property bool modelsMissing: root.service.pendingAssetsMissing || root.service.currentAssetsMissing
function size(bytes: real): string {
return bytes >= 1e9 ? (bytes / 1e9).toFixed(1) + " gb" : Math.max(1, Math.round(bytes / 1e6)) + " mb";
}
name: "noko"
label: "noko"
onEntered: service.refresh()
rows: [
ConfigRow {
kind: ConfigRow.Action
label: "install noko"
visible: root.engineMissing || root.service.installing && !root.service.maintenance
busy: root.service.installing
enabled: !root.service.dictating
status: root.service.installing ? Human.label(root.service.installLabel, "downloading") : (root.service.latestSize > 0 ? "speech engine · " + root.size(root.service.latestSize) : "speech engine")
progress: root.service.installing ? root.service.installProgress : -1
error: root.service.status === "error" ? Human.text(root.service.lastError) : ""
onActivated: root.service.install()
},
ConfigRow {
kind: ConfigRow.Action
label: "install speech model"
visible: root.modelsMissing && !root.engineMissing
busy: root.service.installing
enabled: !root.service.dictating
status: root.service.installing ? Human.label(root.service.installLabel, "downloading") : root.size(root.service.assetBytes) + " download"
progress: root.service.installing ? root.service.installProgress : -1
error: root.service.status === "error" ? Human.text(root.service.lastError) : ""
onActivated: root.service.install()
},
ConfigRow {
kind: ConfigRow.Status
label: ""
status: "speech engine · " + (!root.service.statusKnown ? "checking" : (root.service.updating ? "updating" : (root.service.engineRevision ? (root.service.updateError || "ready") : "missing")))
},
ConfigRow {
kind: ConfigRow.Status
label: ""
status: "typing into apps · " + (root.service.typingReady ? "ready" : "missing")
},
ConfigRow {
kind: ConfigRow.Choice
label: "wake word"
value: root.service.wakeEnabled ? "on" : "off"
status: root.service.wakeListening ? "microphone on" : ""
error: root.service.wakeError
options: [
ConfigOption {
value: "off"
label: "off"
},
ConfigOption {
value: "on"
label: "on"
}
]
onEdited: value => root.service.setWakeEnabled(value === "on")
},
ConfigRow {
kind: ConfigRow.Text
label: "wake phrase"
value: root.service.wakePhrase
error: root.service.wakePhraseError
onEdited: value => root.service.editWakePhrase(value)
},
ConfigRow {
kind: ConfigRow.Text
lines: 4
label: "hotwords"
value: root.service.hotwordsText
status: "one term per line"
error: root.service.hotwordsError
onEdited: value => root.service.editHotwords(value)
}
]
}