mirror of
				https://github.com/dragonwocky/obsidian-tray.git
				synced 2025-10-31 22:28:07 +11:00 
			
		
		
		
	Fix #22
This commit is contained in:
		
							parent
							
								
									a5abaf32e7
								
							
						
					
					
						commit
						71ba850a15
					
				
							
								
								
									
										20
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								main.js
									
									
									
									
									
								
							| @ -69,6 +69,21 @@ const childWindows = new Set(), | |||||||
|     else showWindows(); |     else showWindows(); | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  | let isMaximized = false; | ||||||
|  | const onMinimize = () => { | ||||||
|  |     if (isMaximized) getCurrentWindow().maximize(); | ||||||
|  |     hideWindows(); | ||||||
|  |   }, interceptWindowMinimize = () => { | ||||||
|  |     isMaximized = getCurrentWindow().isMaximized(); | ||||||
|  |     getCurrentWindow().on("maximize", () => { | ||||||
|  |       isMaximized = true; | ||||||
|  |     }); | ||||||
|  |     getCurrentWindow().on("unmaximize", () => { | ||||||
|  |       isMaximized = false; | ||||||
|  |     }); | ||||||
|  |     getCurrentWindow().on("minimize", onMinimize); | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
| const onWindowClose = (event) => event.preventDefault(), | const onWindowClose = (event) => event.preventDefault(), | ||||||
|   onWindowUnload = (event) => { |   onWindowUnload = (event) => { | ||||||
|     log(LOG_WINDOW_CLOSE); |     log(LOG_WINDOW_CLOSE); | ||||||
| @ -394,7 +409,10 @@ class TrayPlugin extends obsidian.Plugin { | |||||||
|     setHideTaskbarIcon(); |     setHideTaskbarIcon(); | ||||||
|     setLaunchOnStartup(); |     setLaunchOnStartup(); | ||||||
|     observeChildWindows(); |     observeChildWindows(); | ||||||
|     if (settings.runInBackground) interceptWindowClose(); |     if (settings.runInBackground) { | ||||||
|  |       interceptWindowMinimize(); | ||||||
|  |       interceptWindowClose(); | ||||||
|  |     } | ||||||
|     if (settings.hideOnLaunch) { |     if (settings.hideOnLaunch) { | ||||||
|       this.registerEvent(this.app.workspace.onLayoutReady(hideWindows)); |       this.registerEvent(this.app.workspace.onLayoutReady(hideWindows)); | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user