From 7542040d5e1b80e34bf34360fb6026c0c7af4977 Mon Sep 17 00:00:00 2001 From: fullex <106392080+0xfullex@users.noreply.github.com> Date: Wed, 4 Jun 2025 23:56:05 +0800 Subject: [PATCH] fix(SelectionAssistant): JetBrains IDEs, Remote desktop, Gaming, PDF views, etc (#6809) fix: jetbrains ides, remote desktop, pdf views, etcs --- package.json | 2 +- src/main/configs/SelectionConfig.ts | 22 +++++++++++++++++++--- src/main/services/SelectionService.ts | 23 +++++++++++++++++++---- yarn.lock | 10 +++++----- 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 7893decc89..90c0045702 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "officeparser": "^4.1.1", "os-proxy-config": "^1.1.2", "proxy-agent": "^6.5.0", - "selection-hook": "^0.9.20", + "selection-hook": "^0.9.21", "tar": "^7.4.3", "turndown": "^7.2.0", "webdav": "^5.8.0", diff --git a/src/main/configs/SelectionConfig.ts b/src/main/configs/SelectionConfig.ts index f96487c38d..1d0a3850c9 100644 --- a/src/main/configs/SelectionConfig.ts +++ b/src/main/configs/SelectionConfig.ts @@ -1,8 +1,13 @@ -interface IBlacklist { +interface IFilterList { WINDOWS: string[] MAC?: string[] } +interface IFinetunedList { + EXCLUDE_CLIPBOARD_CURSOR_DETECT: IFilterList + INCLUDE_CLIPBOARD_DELAY_READ: IFilterList +} + /************************************************************************* * 注意:请不要修改此配置,除非你非常清楚其含义、影响和行为的目的 * Note: Do not modify this configuration unless you fully understand its meaning, implications, and intended behavior. @@ -13,7 +18,7 @@ interface IBlacklist { * * Specification: must be all lowercase, need to accurately find the actual running program name *************************************************************************/ -export const SELECTION_PREDEFINED_BLACKLIST: IBlacklist = { +export const SELECTION_PREDEFINED_BLACKLIST: IFilterList = { WINDOWS: [ // Screenshot 'snipaste.exe', @@ -36,6 +41,17 @@ export const SELECTION_PREDEFINED_BLACKLIST: IBlacklist = { 'maya.exe', // CAD 'acad.exe', - 'sldworks.exe' + 'sldworks.exe', + // Remote Desktop + 'mstsc.exe' ] } + +export const SELECTION_FINETUNED_LIST: IFinetunedList = { + EXCLUDE_CLIPBOARD_CURSOR_DETECT: { + WINDOWS: ['acrobat.exe', 'wps.exe', 'cajviewer.exe'] + }, + INCLUDE_CLIPBOARD_DELAY_READ: { + WINDOWS: ['acrobat.exe', 'wps.exe', 'cajviewer.exe', 'foxitphantom.exe'] + } +} diff --git a/src/main/services/SelectionService.ts b/src/main/services/SelectionService.ts index ab4fad7ec6..e4f33c2cf6 100644 --- a/src/main/services/SelectionService.ts +++ b/src/main/services/SelectionService.ts @@ -1,4 +1,4 @@ -import { SELECTION_PREDEFINED_BLACKLIST } from '@main/configs/SelectionConfig' +import { SELECTION_FINETUNED_LIST, SELECTION_PREDEFINED_BLACKLIST } from '@main/configs/SelectionConfig' import { isDev, isWin } from '@main/constant' import { IpcChannel } from '@shared/IpcChannel' import { BrowserWindow, ipcMain, screen } from 'electron' @@ -157,6 +157,7 @@ export class SelectionService { this.filterList = configManager.getSelectionAssistantFilterList() this.setHookGlobalFilterMode(this.filterMode, this.filterList) + this.setHookFineTunedList() configManager.subscribe(ConfigKeys.SelectionAssistantTriggerMode, (triggerMode: TriggerMode) => { const oldTriggerMode = this.triggerMode @@ -205,9 +206,9 @@ export class SelectionService { if (!this.selectionHook) return const modeMap = { - default: 0, - whitelist: 1, - blacklist: 2 + default: SelectionHook!.FilterMode.DEFAULT, + whitelist: SelectionHook!.FilterMode.INCLUDE_LIST, + blacklist: SelectionHook!.FilterMode.EXCLUDE_LIST } let combinedList: string[] = list @@ -237,6 +238,20 @@ export class SelectionService { } } + private setHookFineTunedList() { + if (!this.selectionHook) return + + this.selectionHook.setFineTunedList( + SelectionHook!.FineTunedListType.EXCLUDE_CLIPBOARD_CURSOR_DETECT, + SELECTION_FINETUNED_LIST.EXCLUDE_CLIPBOARD_CURSOR_DETECT.WINDOWS + ) + + this.selectionHook.setFineTunedList( + SelectionHook!.FineTunedListType.INCLUDE_CLIPBOARD_DELAY_READ, + SELECTION_FINETUNED_LIST.INCLUDE_CLIPBOARD_DELAY_READ.WINDOWS + ) + } + /** * Start the selection service and initialize required windows * @returns {boolean} Success status of service start diff --git a/yarn.lock b/yarn.lock index 7de5966dc6..e2bf61fbdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5667,7 +5667,7 @@ __metadata: remark-math: "npm:^6.0.0" rollup-plugin-visualizer: "npm:^5.12.0" sass: "npm:^1.88.0" - selection-hook: "npm:^0.9.20" + selection-hook: "npm:^0.9.21" shiki: "npm:^3.4.2" string-width: "npm:^7.2.0" styled-components: "npm:^6.1.11" @@ -16400,13 +16400,13 @@ __metadata: languageName: node linkType: hard -"selection-hook@npm:^0.9.20": - version: 0.9.20 - resolution: "selection-hook@npm:0.9.20" +"selection-hook@npm:^0.9.21": + version: 0.9.21 + resolution: "selection-hook@npm:0.9.21" dependencies: node-gyp: "npm:latest" node-gyp-build: "npm:^4.8.4" - checksum: 10c0/2508fc5093a735467bd7082ae84432e2b7d8675d194f9bcf74dab755a63f72ffcbbeee2784297402fbb295faddd590b0333ca290b37047d8af25ed584cd04e60 + checksum: 10c0/e458f8d37c049899e0f9450ca29f882ee01e11b15490f7ee2ddd088843e3e9a201fd5410083faebfbf11e1259a2a74b0b736ff8f1789b626a21ea48ef0ca8705 languageName: node linkType: hard