mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-17 09:06:56 +08:00
21 lines
540 B
JavaScript
21 lines
540 B
JavaScript
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)
|
|
}
|
|
})
|
|
})
|
|
}
|