Laucher: Fix wayland warning about focus surface stealing
This commit is contained in:
parent
1599ee5682
commit
7548ffc191
2 changed files with 89 additions and 83 deletions
|
|
@ -174,29 +174,39 @@ NPanel {
|
|||
anchors.margins: Style.marginL * scaling
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Wrapper ensures the input stretches to full width under RowLayout
|
||||
Item {
|
||||
FocusScope {
|
||||
id: searchInputWrap
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Math.round(Style.barHeight * scaling)
|
||||
|
||||
// Search input
|
||||
// This FocusScope should get focus when panel opens
|
||||
focus: true
|
||||
|
||||
NTextInput {
|
||||
id: searchInput
|
||||
anchors.fill: parent // The NTextInput fills the wrapper
|
||||
Layout.preferredHeight: Style.barHeight * scaling
|
||||
anchors.fill: parent
|
||||
|
||||
// The input should have focus within the scope
|
||||
focus: true
|
||||
|
||||
placeholderText: "Search entries... or use > for commands"
|
||||
text: searchText
|
||||
inputMaxWidth: Number.MAX_SAFE_INTEGER
|
||||
|
||||
function forceActiveFocus() {
|
||||
inputItem.forceActiveFocus()
|
||||
// First ensure the scope has focus
|
||||
searchInputWrap.forceActiveFocus()
|
||||
// Then focus the actual input
|
||||
if (inputItem && inputItem.visible) {
|
||||
inputItem.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
inputItem.font.pointSize = Style.fontSizeL * scaling
|
||||
inputItem.verticalAlignment = TextInput.AlignVCenter
|
||||
if (inputItem) {
|
||||
inputItem.font.pointSize = Style.fontSizeL * scaling
|
||||
inputItem.verticalAlignment = TextInput.AlignVCenter
|
||||
}
|
||||
}
|
||||
|
||||
onTextChanged: searchText = text
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ QtObject {
|
|||
property var launcher: null
|
||||
|
||||
// Plugin capabilities
|
||||
property bool handleSearch: false // Don't handle regular search
|
||||
property bool handleSearch: false // Don't handle regular search
|
||||
|
||||
// Initialize plugin
|
||||
function init() {
|
||||
|
|
@ -31,25 +31,22 @@ QtObject {
|
|||
|
||||
// Return available commands when user types ">"
|
||||
function commands() {
|
||||
return [
|
||||
{
|
||||
name: ">clip",
|
||||
description: "Search clipboard history",
|
||||
icon: "content_paste",
|
||||
onActivate: function() {
|
||||
launcher.setSearchText(">clip ")
|
||||
}
|
||||
},
|
||||
{
|
||||
name: ">clip clear",
|
||||
description: "Clear all clipboard history",
|
||||
icon: "delete_sweep",
|
||||
onActivate: function() {
|
||||
CliphistService.wipeAll()
|
||||
launcher.close()
|
||||
}
|
||||
}
|
||||
]
|
||||
return [{
|
||||
"name": ">clip",
|
||||
"description": "Search clipboard history",
|
||||
"icon": "content_paste",
|
||||
"onActivate": function () {
|
||||
launcher.setSearchText(">clip ")
|
||||
}
|
||||
}, {
|
||||
"name": ">clip clear",
|
||||
"description": "Clear all clipboard history",
|
||||
"icon": "delete_sweep",
|
||||
"onActivate": function () {
|
||||
CliphistService.wipeAll()
|
||||
launcher.close()
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
// Get search results
|
||||
|
|
@ -64,14 +61,14 @@ QtObject {
|
|||
// Special command: clear
|
||||
if (query === "clear") {
|
||||
return [{
|
||||
name: "Clear Clipboard History",
|
||||
description: "Remove all items from clipboard history",
|
||||
icon: "delete_sweep",
|
||||
onActivate: function() {
|
||||
CliphistService.wipeAll()
|
||||
launcher.close()
|
||||
}
|
||||
}]
|
||||
"name": "Clear Clipboard History",
|
||||
"description": "Remove all items from clipboard history",
|
||||
"icon": "delete_sweep",
|
||||
"onActivate": function () {
|
||||
CliphistService.wipeAll()
|
||||
launcher.close()
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
// Search clipboard items
|
||||
|
|
@ -82,7 +79,7 @@ QtObject {
|
|||
const items = CliphistService.items || []
|
||||
|
||||
// Filter and format results
|
||||
items.forEach(function(item) {
|
||||
items.forEach(function (item) {
|
||||
const preview = (item.preview || "").toLowerCase()
|
||||
|
||||
// Skip if search term doesn't match
|
||||
|
|
@ -99,7 +96,7 @@ QtObject {
|
|||
}
|
||||
|
||||
// Add activation handler
|
||||
entry.onActivate = function() {
|
||||
entry.onActivate = function () {
|
||||
CliphistService.copyToClipboard(item.id)
|
||||
launcher.close()
|
||||
}
|
||||
|
|
@ -110,13 +107,12 @@ QtObject {
|
|||
// Show empty state if no results
|
||||
if (results.length === 0) {
|
||||
results.push({
|
||||
name: searchTerm ? "No matching clipboard items" : "Clipboard is empty",
|
||||
description: searchTerm ? `No items containing "${query}"` : "Copy something to see it here",
|
||||
icon: "content_paste_off",
|
||||
onActivate: function() {
|
||||
// Do nothing
|
||||
}
|
||||
})
|
||||
"name": searchTerm ? "No matching clipboard items" : "Clipboard is empty",
|
||||
"description": searchTerm ? `No items containing "${query}"` : "Copy something to see it here",
|
||||
"icon": "content_paste_off",
|
||||
"onActivate": function () {// Do nothing
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return results
|
||||
|
|
@ -127,9 +123,9 @@ QtObject {
|
|||
const meta = parseImageMeta(item.preview)
|
||||
|
||||
return {
|
||||
name: meta ? `Image ${meta.w}×${meta.h}` : "Image",
|
||||
description: meta ? `${meta.fmt} • ${meta.size}` : item.mime || "Image data",
|
||||
icon: "image"
|
||||
"name": meta ? `Image ${meta.w}×${meta.h}` : "Image",
|
||||
"description": meta ? `${meta.fmt} • ${meta.size}` : item.mime || "Image data",
|
||||
"icon": "image"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -158,9 +154,9 @@ QtObject {
|
|||
}
|
||||
|
||||
return {
|
||||
name: title,
|
||||
description: description,
|
||||
icon: "description"
|
||||
"name": title,
|
||||
"description": description,
|
||||
"icon": "description"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -174,10 +170,10 @@ QtObject {
|
|||
}
|
||||
|
||||
return {
|
||||
size: match[1],
|
||||
fmt: (match[2] || "").toUpperCase(),
|
||||
w: Number(match[3]),
|
||||
h: Number(match[4])
|
||||
"size": match[1],
|
||||
"fmt": (match[2] || "").toUpperCase(),
|
||||
"w": Number(match[3]),
|
||||
"h": Number(match[4])
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue