mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Tray GTK fixes
This commit is contained in:
parent
9ef6dcacb6
commit
5e1fc3910a
3 changed files with 10 additions and 4 deletions
|
@ -59,7 +59,7 @@ public class AppMainWindow {
|
|||
private synchronized void onChange() {
|
||||
lastUpdate = Instant.now();
|
||||
if (thread == null) {
|
||||
thread = ThreadHelper.createPlatformThread("window change timeout", true, () -> {
|
||||
thread = ThreadHelper.unstarted(() -> {
|
||||
while (true) {
|
||||
var toStop = lastUpdate.plus(Duration.of(1, ChronoUnit.SECONDS));
|
||||
if (Instant.now().isBefore(toStop)) {
|
||||
|
@ -237,6 +237,10 @@ public class AppMainWindow {
|
|||
}
|
||||
|
||||
public void show() {
|
||||
// Due to some weird GTK bug, we have to set these sizes every time we show a window even though they have been previously set
|
||||
stage.setWidth(stage.getWidth());
|
||||
stage.setHeight(stage.getHeight());
|
||||
|
||||
stage.show();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.net.URL;
|
|||
public class AppTrayIcon {
|
||||
|
||||
private boolean shown = false;
|
||||
|
||||
|
||||
/**
|
||||
* The default AWT SystemTray
|
||||
*/
|
||||
|
@ -37,8 +37,8 @@ public class AppTrayIcon {
|
|||
|
||||
var image = switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> "img/logo/logo_16x16.png";
|
||||
case OsType.Linux linux -> "img/logo/logo_22x22.png";
|
||||
case OsType.MacOs macOs -> "img/logo/logo_22x22.png";
|
||||
case OsType.Linux linux -> "img/logo/logo_24x24.png";
|
||||
case OsType.MacOs macOs -> "img/logo/logo_24x24.png";
|
||||
};
|
||||
var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, image).orElseThrow();
|
||||
|
||||
|
@ -49,6 +49,7 @@ public class AppTrayIcon {
|
|||
{
|
||||
var open = new MenuItem(AppI18n.get("open"));
|
||||
open.addActionListener(e -> {
|
||||
tray.remove(trayIcon);
|
||||
OperationMode.switchToAsync(OperationMode.GUI);
|
||||
});
|
||||
popupMenu.add(open);
|
||||
|
@ -65,6 +66,7 @@ public class AppTrayIcon {
|
|||
|
||||
trayIcon.addActionListener(e -> {
|
||||
if (OsType.getLocal() != OsType.MACOS) {
|
||||
tray.remove(trayIcon);
|
||||
OperationMode.switchToAsync(OperationMode.GUI);
|
||||
}
|
||||
});
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Loading…
Reference in a new issue