支持新API:getCopyFiles simulateKeyboardTap

This commit is contained in:
muwoo 2023-08-16 17:57:25 +08:00
parent c2a23f0c6c
commit 2008b62a45
4 changed files with 34 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "rubick",
"version": "2.4.1",
"version": "2.4.2",
"author": "muwoo <2424880409@qq.com>",
"private": true,
"scripts": {
@ -30,6 +30,7 @@
"get-mac-apps": "^1.0.2",
"got": "^11.8.3",
"lodash.throttle": "^4.1.1",
"node-key-sender": "^1.0.11",
"pouchdb": "^7.2.2",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",

View File

@ -162,8 +162,16 @@ window.rubick = {
shellBeep: () => {
ipcSend('shellBeep');
},
getFileIcon: (path) => {
return ipcSendSync('getFileIcon', { path });
},
getCopyedFiles: () => {
return ipcSendSync('getCopyFiles');
},
simulateKeyboardTap: (key, ...modifier) => {
ipcSend('simulateKeyboardTap', { key, modifier });
},
};

View File

@ -13,7 +13,11 @@ import { runner, detach } from '../browsers';
import fs from 'fs';
import { LocalDb, screenCapture } from '@/core';
import plist from 'plist';
import ks from 'node-key-sender';
import { DECODE_KEY } from '@/common/constans/main';
import getCopyFiles from '@/common/utils/getCopyFiles';
import mainInstance from '../index';
const runnerInstance = runner();
const detachInstance = detach();
@ -324,6 +328,20 @@ class API {
});
});
}
public getCopyFiles() {
return getCopyFiles();
}
public simulateKeyboardTap({ data: { key, modifier } }) {
let keys = [key.toLowerCase()];
if (modifier && Array.isArray(modifier) && modifier.length > 0) {
keys = modifier.concat(keys);
ks.sendCombination(keys);
} else {
ks.sendKeys(keys);
}
}
}
export default new API();

View File

@ -8070,6 +8070,11 @@ node-gyp-build@~4.1.0:
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.1.1.tgz#d7270b5d86717068d114cc57fff352f96d745feb"
integrity sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==
node-key-sender@^1.0.11:
version "1.0.11"
resolved "https://registry.npmmirror.com/node-key-sender/-/node-key-sender-1.0.11.tgz#93210f07163607d8daf2874f1a29567d0acdb94c"
integrity sha512-vv2IXd8QdZBFYXaIy02uy2rK6EKj+tOTEuoTxJKS9l8zw8Cz6DeLffR8ompj7N2A3h6XK7aiy+YAcTaeOqwp2Q==
node-libs-browser@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425"