mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-17 16:24:16 +08:00
feat: 支持截屏,下载方式调整
This commit is contained in:
20
static/plugins/capture/utils.js
Normal file
20
static/plugins/capture/utils.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const { remote, ipcRenderer } = require('electron');
|
||||
|
||||
let currentWindow = remote.getCurrentWindow()
|
||||
|
||||
exports.getCurrentScreen = () => {
|
||||
let { x, y } = currentWindow.getBounds();
|
||||
ipcRenderer.send('capture-screen', {
|
||||
type: 'getAllDisplays',
|
||||
winId: currentWindow.id,
|
||||
x,
|
||||
y,
|
||||
});
|
||||
return new Promise(resolve => {
|
||||
ipcRenderer.on('getAllDisplays', (e, { type, winId, screen}) => {
|
||||
if (winId === currentWindow.id) {
|
||||
resolve(screen)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user