Actually fully disable CliphistService if ClipboardHistory is disabled
This commit is contained in:
parent
5e822b49b4
commit
1c96bc89d8
1 changed files with 8 additions and 7 deletions
|
|
@ -12,7 +12,8 @@ Singleton {
|
||||||
// Public API
|
// Public API
|
||||||
property var items: [] // [{id, preview, mime, isImage}]
|
property var items: [] // [{id, preview, mime, isImage}]
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
property bool enabled: Settings.data.appLauncher.enableClipboardHistory
|
// Active only when feature is enabled and settings have finished initial load
|
||||||
|
property bool active: Settings.data.appLauncher.enableClipboardHistory && !Settings.isInitialLoad
|
||||||
|
|
||||||
// Optional automatic watchers to feed cliphist DB
|
// Optional automatic watchers to feed cliphist DB
|
||||||
property bool autoWatch: true
|
property bool autoWatch: true
|
||||||
|
|
@ -33,10 +34,10 @@ Singleton {
|
||||||
|
|
||||||
// Start/stop watchers when enabled changes
|
// Start/stop watchers when enabled changes
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (root.enabled) startWatchers()
|
if (root.active) startWatchers()
|
||||||
}
|
}
|
||||||
onEnabledChanged: {
|
onActiveChanged: {
|
||||||
if (root.enabled) {
|
if (root.active) {
|
||||||
startWatchers()
|
startWatchers()
|
||||||
} else {
|
} else {
|
||||||
stopWatchers()
|
stopWatchers()
|
||||||
|
|
@ -50,7 +51,7 @@ Singleton {
|
||||||
Timer {
|
Timer {
|
||||||
interval: 5000
|
interval: 5000
|
||||||
repeat: true
|
repeat: true
|
||||||
running: root.enabled
|
running: root.active
|
||||||
onTriggered: list()
|
onTriggered: list()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,7 +148,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
function startWatchers() {
|
function startWatchers() {
|
||||||
if (!root.enabled || !autoWatch || watchersStarted) return
|
if (!root.active || !autoWatch || watchersStarted) return
|
||||||
watchersStarted = true
|
watchersStarted = true
|
||||||
// Start text watcher
|
// Start text watcher
|
||||||
watchText.command = ["wl-paste", "--type", "text", "--watch", "cliphist", "store"]
|
watchText.command = ["wl-paste", "--type", "text", "--watch", "cliphist", "store"]
|
||||||
|
|
@ -165,7 +166,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
function list(maxPreviewWidth) {
|
function list(maxPreviewWidth) {
|
||||||
if (!root.enabled) { return }
|
if (!root.active) { return }
|
||||||
if (listProc.running) return
|
if (listProc.running) return
|
||||||
loading = true
|
loading = true
|
||||||
const width = maxPreviewWidth || 100
|
const width = maxPreviewWidth || 100
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue