Launcher: fixed IPC calls + fix locked up results in clipboard after short successive opening.

This commit is contained in:
LemmyCook 2025-09-03 13:49:45 -04:00
parent 1e81a89a1a
commit 392f0e14b2
3 changed files with 14 additions and 38 deletions

View file

@ -37,45 +37,18 @@ Item {
} }
} }
IpcHandler {
target: "appLauncher"
function toggle() {
launcherPanel.toggle(Quickshell.screens[0])
}
function clipboard() {
launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set clipboard mode
Qt.callLater(() => {
launcherPanel.setSearchText(">clip ")
})
}
function calculator() {
launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set calculator mode
Qt.callLater(() => {
launcherPanel.setSearchText(">calc ")
})
}
}
IpcHandler { IpcHandler {
target: "launcher" target: "launcher"
function toggle() { function toggle() {
launcherPanel.toggle(Quickshell.screens[0]) launcherPanel.toggle(Quickshell.screens[0])
} }
function clipboard() { function clipboard() {
launcherPanel.setSearchText(">clip ")
launcherPanel.toggle(Quickshell.screens[0]) launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set clipboard mode
Qt.callLater(() => {
launcherPanel.setSearchText(">clip ")
})
} }
function calculator() { function calculator() {
launcherPanel.setSearchText(">calc ")
launcherPanel.toggle(Quickshell.screens[0]) launcherPanel.toggle(Quickshell.screens[0])
// Use the setSearchText function to set calculator mode
Qt.callLater(() => {
launcherPanel.setSearchText(">calc ")
})
} }
} }

View file

@ -22,7 +22,6 @@ NPanel {
return h return h
} }
panelKeyboardFocus: true panelKeyboardFocus: true
panelBackgroundColor: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, panelBackgroundColor: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b,
Settings.data.appLauncher.backgroundOpacity) Settings.data.appLauncher.backgroundOpacity)
@ -106,6 +105,9 @@ NPanel {
} }
onClosed: { onClosed: {
// Reset search text
searchText = ""
// Notify plugins // Notify plugins
for (let plugin of plugins) { for (let plugin of plugins) {
if (plugin.onClosed) if (plugin.onClosed)
@ -172,7 +174,6 @@ NPanel {
color: Color.transparent color: Color.transparent
Component.onCompleted: { Component.onCompleted: {
searchText = ""
selectedIndex = 0 selectedIndex = 0
if (searchInput?.forceActiveFocus) { if (searchInput?.forceActiveFocus) {
searchInput.forceActiveFocus() searchInput.forceActiveFocus()
@ -295,7 +296,6 @@ NPanel {
color: Color.mSurfaceVariant color: Color.mSurfaceVariant
clip: true clip: true
// Image preview for clipboard images // Image preview for clipboard images
NImageRounded { NImageRounded {
id: imagePreview id: imagePreview
@ -329,11 +329,11 @@ NPanel {
// Error fallback // Error fallback
onStatusChanged: status => { onStatusChanged: status => {
if (status === Image.Error) { if (status === Image.Error) {
iconLoader.visible = true iconLoader.visible = true
imagePreview.visible = false imagePreview.visible = false
} }
} }
} }
// Icon fallback // Icon fallback

View file

@ -49,9 +49,12 @@ Item {
// Called when launcher opens // Called when launcher opens
function onOpened() { function onOpened() {
isWaitingForData = true
gotResults = false
lastSearchText = ""
// Refresh clipboard history when launcher opens // Refresh clipboard history when launcher opens
if (ClipboardService.active) { if (ClipboardService.active) {
isWaitingForData = true
ClipboardService.list(100) ClipboardService.list(100)
} }
} }