NSApplication: toggle title of menu item "Hide" to "Unhide" and vice versa.

Right-click app menu on hidden app icon should show "Unhide" on menu item and behave respectively.
This commit is contained in:
Sergii Stoian 2024-10-09 11:02:26 +00:00
parent 40fc3ab2ec
commit afe151aaaf

View file

@ -2543,7 +2543,8 @@ image.</p><p>See Also: -applicationIconImage</p>
[_hidden addObject: win];
[win orderOut: self];
}
}
}
[[_main_menu itemWithTitle:@"Hide"] setTitle:@"Unhide"];
_app_is_hidden = YES;
if (YES == [[NSUserDefaults standardUserDefaults]
@ -2590,6 +2591,10 @@ image.</p><p>See Also: -applicationIconImage</p>
[self miniaturizeAll: sender];
}
}
else
{
[self unhide: sender];
}
#endif
}
@ -2606,6 +2611,7 @@ image.</p><p>See Also: -applicationIconImage</p>
*/
- (void) unhide: (id)sender
{
[[_main_menu itemWithTitle:@"Unhide"] setTitle:@"Hide"];
if (_app_is_hidden)
{
[self unhideWithoutActivation];