@@ -100,12 +100,16 @@ const onWindowClose = (event) => event.preventDefault(),
100
100
window . removeEventListener ( "beforeunload" , onWindowUnload , true ) ;
101
101
} ;
102
102
103
- const setHideTaskbarIcon = ( ) => {
104
- getWindows ( ) . forEach ( ( win ) => {
105
- win . setSkipTaskbar ( plugin . settings . hideTaskbarIcon ) ;
106
- } ) ;
103
+ const hideTaskbarIcons = ( ) => {
104
+ getWindows ( ) . forEach ( ( win ) => win . setSkipTaskbar ( true ) ) ;
105
+ if ( process . platform === "darwin" ) app . dock . hide ( ) ;
107
106
} ,
108
- setLaunchOnStartup = ( ) => {
107
+ showTaskbarIcons = ( ) => {
108
+ getWindows ( ) . forEach ( ( win ) => win . setSkipTaskbar ( false ) ) ;
109
+ if ( process . platform === "darwin" ) app . dock . show ( ) ;
110
+ } ;
111
+
112
+ const setLaunchOnStartup = ( ) => {
109
113
const { launchOnStartup, runInBackground, hideOnLaunch } = plugin . settings ;
110
114
app . setLoginItemSettings ( {
111
115
openAtLogin : launchOnStartup ,
@@ -248,7 +252,10 @@ const OPTIONS = [
248
252
` ,
249
253
type : "toggle" ,
250
254
default : false ,
251
- onChange : setHideTaskbarIcon ,
255
+ onChange ( ) {
256
+ if ( plugin . settings . hideTaskbarIcon ) hideTaskbarIcons ( ) ;
257
+ else showTaskbarIcons ( ) ;
258
+ } ,
252
259
} ,
253
260
{
254
261
key : "createTrayIcon" ,
@@ -410,10 +417,10 @@ class TrayPlugin extends obsidian.Plugin {
410
417
plugin = this ;
411
418
createTrayIcon ( ) ;
412
419
registerHotkeys ( ) ;
413
- setHideTaskbarIcon ( ) ;
414
420
setLaunchOnStartup ( ) ;
415
421
observeWindows ( ) ;
416
422
if ( settings . runInBackground ) interceptWindowClose ( ) ;
423
+ if ( settings . hideTaskbarIcon ) hideTaskbarIcons ( ) ;
417
424
if ( settings . hideOnLaunch ) {
418
425
this . registerEvent ( this . app . workspace . onLayoutReady ( hideWindows ) ) ;
419
426
}
@@ -435,6 +442,7 @@ class TrayPlugin extends obsidian.Plugin {
435
442
log ( LOG_CLEANUP ) ;
436
443
unregisterHotkeys ( ) ;
437
444
allowWindowClose ( ) ;
445
+ showTaskbarIcons ( ) ;
438
446
destroyTray ( ) ;
439
447
}
440
448
0 commit comments