mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-30 11:26:24 +02:00
save clipboard contents on shortcut trigger
This commit is contained in:
parent
0f846cd9c4
commit
0abbfbfe27
1 changed files with 3 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ const SHORTCUT = 'CommandOrControl+Option+S';
|
||||||
let quickAskWindow: BrowserWindow | null = null;
|
let quickAskWindow: BrowserWindow | null = null;
|
||||||
let pendingText = '';
|
let pendingText = '';
|
||||||
let sourceApp = '';
|
let sourceApp = '';
|
||||||
|
let savedClipboard = '';
|
||||||
|
|
||||||
function getFrontmostApp(): string {
|
function getFrontmostApp(): string {
|
||||||
if (process.platform !== 'darwin') return '';
|
if (process.platform !== 'darwin') return '';
|
||||||
|
|
@ -97,8 +98,9 @@ export function registerQuickAsk(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceApp = getFrontmostApp();
|
sourceApp = getFrontmostApp();
|
||||||
|
savedClipboard = clipboard.readText();
|
||||||
|
|
||||||
const text = clipboard.readText().trim();
|
const text = savedClipboard.trim();
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
|
|
||||||
pendingText = text;
|
pendingText = text;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue