Skip to content

Commit

Permalink
[optimize] boss key for video logic issue #323
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiram committed Aug 30, 2024
1 parent f8487ec commit c3428b9
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 171 deletions.
11 changes: 11 additions & 0 deletions src/main/utils/tool.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { BrowserWindow } from 'electron';
import { getWin } from '../core/winManger';

const toggleWindowVisibility = () => {
const windows = BrowserWindow.getAllWindows();
if (windows.length === 0) return;
const anyVisible = windows.some((win) => win.isVisible());
windows.forEach((win) => {
if (!win.isDestroyed()) {
const playWin = getWin('play');
if (anyVisible) {
win.hide();
if (playWin) {
playWin.webContents.send('media-control', false);
playWin.webContents.setAudioMuted(true);
}
} else {
win.show();
if (playWin) {
playWin.webContents.send('media-control', true);
playWin.webContents.setAudioMuted(false);
playWin.focus();
}
}
}
});
Expand Down
Loading

0 comments on commit c3428b9

Please sign in to comment.