mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-20 18:15:43 +08:00
:spark: 支持系统截屏功能
This commit is contained in:
@@ -15,6 +15,7 @@ import { LocalDb } from '@/core';
|
||||
import plist from 'plist';
|
||||
import { DECODE_KEY } from '@/common/constans/main';
|
||||
import mainInstance from '../index';
|
||||
import { screenshots } from './registerScreenshots';
|
||||
const runnerInstance = runner();
|
||||
const detachInstance = detach();
|
||||
const dbInstance = new LocalDb(app.getPath('userData'));
|
||||
@@ -33,6 +34,14 @@ class API {
|
||||
event.returnValue = data;
|
||||
// event.sender.send(`msg-back-${arg.type}`, data);
|
||||
});
|
||||
|
||||
// 注册截屏成功回调事件
|
||||
screenshots.on('ok', (e, buffer) => {
|
||||
const image = nativeImage.createFromBuffer(buffer);
|
||||
runnerInstance.executeHooks('ScreenCapture', {
|
||||
data: image.toDataURL(),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public getCurrentWindow = (window, e) => {
|
||||
@@ -313,6 +322,10 @@ class API {
|
||||
shell.beep();
|
||||
return true;
|
||||
}
|
||||
|
||||
public screenCapture() {
|
||||
screenshots.startCapture();
|
||||
}
|
||||
}
|
||||
|
||||
export default new API();
|
||||
|
||||
Reference in New Issue
Block a user