mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-26 11:16:29 +00:00
Rework [stage]
This commit is contained in:
@@ -45,13 +45,17 @@ public class AppTrayIcon {
|
||||
{
|
||||
var quit = new MenuItem(AppI18n.get("quit"));
|
||||
quit.addActionListener(e -> {
|
||||
tray.remove(trayIcon);
|
||||
trayIcon.setPopupMenu(null);
|
||||
AppOperationMode.shutdown(false);
|
||||
});
|
||||
popupMenu.add(quit);
|
||||
}
|
||||
|
||||
trayIcon.addActionListener(e -> {
|
||||
if (AppOperationMode.isInShutdown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (OsType.ofLocal() != OsType.MACOS) {
|
||||
tray.remove(trayIcon);
|
||||
AppOperationMode.switchToAsync(AppOperationMode.GUI);
|
||||
|
||||
@@ -21,6 +21,7 @@ import io.xpipe.app.icon.SystemIconManager;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.platform.PlatformInit;
|
||||
import io.xpipe.app.platform.PlatformState;
|
||||
import io.xpipe.app.platform.PlatformThread;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.prefs.WorkspaceManager;
|
||||
import io.xpipe.app.process.LocalShell;
|
||||
@@ -228,6 +229,12 @@ public class AppBaseMode extends AppOperationMode {
|
||||
BrowserLocalFileSystem.reset();
|
||||
ProcModuleProvider.get().reset();
|
||||
AppBeaconServer.reset();
|
||||
|
||||
AppMainWindow.get().hide();
|
||||
if (AppTray.get() != null) {
|
||||
PlatformThread.runLaterIfNeededBlocking(() -> AppTray.get().hide());
|
||||
}
|
||||
|
||||
StoreViewState.reset();
|
||||
StoreFilterState.reset();
|
||||
AppLayoutModel.reset();
|
||||
|
||||
@@ -37,10 +37,13 @@ public class AppGuiMode extends AppOperationMode {
|
||||
.toList()
|
||||
.forEach(w -> w.hide());
|
||||
|
||||
// If we are in an externally started shutdown hook, don't close the windows until the platform exits
|
||||
// That way, it is kept open to block for shutdowns on Windows systems
|
||||
if (OsType.ofLocal() != OsType.WINDOWS || !AppOperationMode.isInShutdownHook()) {
|
||||
// When changing between modes, close window instantly
|
||||
// Otherwise, the background mode shutdown closes this
|
||||
if (!AppOperationMode.isInShutdown()) {
|
||||
AppMainWindow.get().hide();
|
||||
} else {
|
||||
// Show teardown screen
|
||||
AppMainWindow.resetContent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.xpipe.app.core.mode;
|
||||
|
||||
import io.xpipe.app.core.AppTray;
|
||||
import io.xpipe.app.core.window.AppMainWindow;
|
||||
import io.xpipe.app.issue.*;
|
||||
import io.xpipe.app.platform.PlatformInit;
|
||||
import io.xpipe.app.platform.PlatformThread;
|
||||
@@ -38,9 +39,12 @@ public class AppTrayMode extends AppOperationMode {
|
||||
|
||||
@Override
|
||||
public void onSwitchFrom() {
|
||||
if (AppTray.get() != null) {
|
||||
TrackEvent.info("Closing tray");
|
||||
PlatformThread.runLaterIfNeededBlocking(() -> AppTray.get().hide());
|
||||
// When changing between modes, close tray instantly
|
||||
// Otherwise, the background mode shutdown closes this
|
||||
if (!AppOperationMode.isInShutdown()) {
|
||||
if (AppTray.get() != null) {
|
||||
PlatformThread.runLaterIfNeededBlocking(() -> AppTray.get().hide());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user