Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal-plugins/system/public/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"type": "window",
"label": "复制路径",
"match": {
"app": ["Finder.app", "explorer.exe"]
"app": ["Finder.app", "explorer.exe"],
"className": ["", "CabinetWClass"]
}
},
{
Expand All @@ -110,7 +111,8 @@
"type": "window",
"label": "在终端打开",
"match": {
"app": ["Finder.app", "explorer.exe"]
"app": ["Finder.app", "explorer.exe"],
"className": ["", "CabinetWClass"]
}
},
{
Expand Down
6 changes: 5 additions & 1 deletion src/main/managers/clipboardManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ class ClipboardManager {
className?: string
hwnd?: number
}): void {
//Windows下任务栏成为前台窗口时,阻止当前窗口数据的切换
if (data.app === 'explorer.exe' && data.className === 'Shell_TrayWnd') {
return
}
// 直接使用原生数据,保留所有字段
this.currentWindow = {
app: data.app,
Expand Down Expand Up @@ -841,7 +845,7 @@ class ClipboardManager {
resolve(null)
}, timeoutMs)

const wrappedResolve = (content: LastCopiedContent) => {
const wrappedResolve = (content: LastCopiedContent): void => {
if (timer) {
clearTimeout(timer)
timer = null
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/components/search/SearchResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ const windowMatchedActions = computed(() => {
// 使用 commandDataStore 的 searchWindowCommands 进行匹配
const matched = commandDataStore.searchWindowCommands({
app: currentWindow.app,
title: currentWindow.title
title: currentWindow.title,
className: currentWindow.className
})

// 如果有搜索内容,在匹配的窗口指令中进一步搜索
Expand Down
14 changes: 11 additions & 3 deletions src/renderer/src/stores/commandDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ interface WindowCmd {
match: {
app?: string[] // 匹配应用名称列表(如 ["Finder.app"])
title?: string // 匹配窗口标题的正则表达式字符串
className?: string[]
}
}

Expand Down Expand Up @@ -1350,7 +1351,7 @@ export const useCommandDataStore = defineStore('commandData', () => {

function matchesWindowCommand(
command: Command,
windowInfo?: { app?: string; title?: string } | null
windowInfo?: { app?: string; title?: string; className?: string } | null
): boolean {
if (
!windowInfo ||
Expand All @@ -1368,7 +1369,10 @@ export const useCommandDataStore = defineStore('commandData', () => {
// 直接字符串匹配
return windowInfo.app === appPattern
})
if (appMatches) {
const classNameMatches = windowCmd.match.className?.some(
(classNamePattern) => classNamePattern === (windowInfo.className || '')
)
Comment thread
Flinglin marked this conversation as resolved.
if (appMatches && (!windowCmd.match.className || classNameMatches)) {
return true
}
}
Expand All @@ -1385,7 +1389,11 @@ export const useCommandDataStore = defineStore('commandData', () => {
}

// 搜索支持窗口的指令(根据当前激活窗口进行匹配)
function searchWindowCommands(windowInfo?: { app?: string; title?: string }): SearchResult[] {
function searchWindowCommands(windowInfo?: {
app?: string
title?: string
className?: string
}): SearchResult[] {
if (!windowInfo || (!windowInfo.app && !windowInfo.title)) {
return []
}
Expand Down