File tree Expand file tree Collapse file tree 3 files changed +276
-171
lines changed Expand file tree Collapse file tree 3 files changed +276
-171
lines changed Original file line number Diff line number Diff line change 1
1
import { BrowserWindow } from 'electron' ;
2
+ import { getWin } from '../core/winManger' ;
2
3
3
4
const toggleWindowVisibility = ( ) => {
4
5
const windows = BrowserWindow . getAllWindows ( ) ;
5
6
if ( windows . length === 0 ) return ;
6
7
const anyVisible = windows . some ( ( win ) => win . isVisible ( ) ) ;
7
8
windows . forEach ( ( win ) => {
8
9
if ( ! win . isDestroyed ( ) ) {
10
+ const playWin = getWin ( 'play' ) ;
9
11
if ( anyVisible ) {
10
12
win . hide ( ) ;
13
+ if ( playWin ) {
14
+ playWin . webContents . send ( 'media-control' , false ) ;
15
+ playWin . webContents . setAudioMuted ( true ) ;
16
+ }
11
17
} else {
12
18
win . show ( ) ;
19
+ if ( playWin ) {
20
+ playWin . webContents . send ( 'media-control' , true ) ;
21
+ playWin . webContents . setAudioMuted ( false ) ;
22
+ playWin . focus ( ) ;
23
+ }
13
24
}
14
25
}
15
26
} ) ;
You can’t perform that action at this time.
0 commit comments