-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a minimized window incorrectly reports itself as visible #210
Comments
Minimizing a window is not the same as hiding it so
The gtk docs says that a window manager can choose to ignore the unminimzing request but |
"Minimizing a window is not the same as hiding it so document.hidden ans document.visibiltyState are correct." The former statement does not imply the latter. The link I gave explicitly states that a minimized window should be considered Electron does this IMO correctly, for what it's worth. "window.set_focus(true) should force it be on the current desktop unminimzed and focused." Doesn't work for me. I just get a notification that the windiow "is ready" but it isn't made visible. I tried variations of:
(Note |
I guess we need to investigate why |
just tested on Windows and |
I also tested the combination with window.set_minimized(true); // this returns the focus to previously focused window on Windows
window.set_visible(false); Then I showed the window like this. window.set_visible(true);
window.set_minimized(false);
window.set_focus(); |
A minor problem is that the transition from hidden to minimized doesn't work - the window stays hidden (rather than minimized). A bigger problem is getting |
detecting whether the window is minimized or not could be easily added to our api as
yeah that's what the code snippet I added is supposed to do. I wrote the snippet with apps like
We can add |
A Doing the following will hide the window, not minimize it (on Linux/GtkWebKit):
If I leve off the
However If I had
Still a bit clumsy, but not as bad. |
Okay I have booted up my Linux and tried,
We are currently in feature-freeze phase and this won't be included in the upcoming v1 release of tao/wry/tauri, it will have to wait until v1 is out then I will implement it in the With that said, I am closing this issue. |
"Okay I have booted up my Linux and tried, set_minimized(false) and it works perfectly and as expected" What is the sequence of calls you use to minimize and then un-minimize? I find I have to |
My first test was let mut minimized = false;
if req.method == "toggleMinimize" {
minimized = !minimized;
window.set_minimized(minimized);
} My second test was combining it with let mut minimized = false;
if req.method == "toggleMinimizeHidden" {
if window.is_visible() {
window.set_minimizd(true);
window.set_visible(false);
} else {
window.set_visible(false);
window.set_minmized(true);
}
} Keep in mind all requests are made from another window. |
Not sure what you're saying. None of these tests (ignoring typos) work, at least in my environment. I.e. switch from visible to minimized (not hidden) and back again, "Keep in mind all requests are made from another window." Yes. I use commands like this (which I have working fine when using an Electron window):
|
Please post your repo or at least a compiled version of your app, I can try it later. |
By the way: I can now send one of the requests to minimize/hide/show/toggle-minimize/toggle-hide to a DomTerm window, and it behaves as expected. However, the code needed for it to work is rather kludgy:
I.e. to transition from hidden to minimized (in a way thar can deal with a future
These redundant transitions seem to be what is necessary. I don't know why. It works - but it sure is ugly. |
your code could be simplified to just this. march req {
"minimize" => {
window.set_minimized(true);
}
"hide" => {
window.set_minimized(true);
window.set_visible(false);
}
"show" => {
window.set_visible(true);
window.set_minimized(false);
window.set_focus();
}
} |
Yes, that would be more elegant - but it doesn't work. For example |
on what os? this should be working on Windows and macOS, linux might be weird because it is dependent on the window manager in use. |
Fedora 37, running X11-Gnome (not Wayland at the moment). Wry 0.26.0. |
Note a more complex transition: normal -> |
by this what do you mean exactly? is the window not present in the dock? or is the window visible but doesn't get brought to the front and focused? |
There is no dock in my setup. The difference between hidden and minimized is only apparent when I request "Expose Windows" (pressing the Window key): A minimized windows shows up on Expose (and can be made visible by clicking on it), while a hidden window does not. When I However, |
@FabianLars could you test this on your gnome when you have a chance? last time I checked this, it worked fine on AwesomeWM |
tbh i'm super confused what i'm supposed to test here.
what else should i test? |
I am mainly interested in this snippet using tao or wry: march req {
"minimize" => {
window.set_minimized(true);
}
"hide" => {
window.set_minimized(true);
window.set_visible(false);
}
"show" => {
window.set_visible(true);
window.set_minimized(false);
window.set_focus();
}
} try triggering the req |
Nope, the window stays minimized using wry's (and therefore tao's) latest git commit. Same if i cut it down to just |
that's weird, the minimize code hasn't been touched since the tauri beta or even from before that. |
using wry@0.23 (what tauri 1.2 uses) doesn't make it work either so either i'm doing something really stupid, or tauri does additional stuff on unminimize |
usually it needs to be paired with |
okay i tested unminimize in tauri again and now it doesn't work either. (not with setFocus either). I'll switch to my actual linux installation, i don't trust wslg enough. |
Okay so, using fedora 37:
|
|
Just tested on KDE using |
did you also test kde x11 vs kde wayland? (on most distros you can switch it after logging out, there should be some gear icon or something on the login screen) |
I am on KDE x11 |
wouldn't be surprised if it doesn't work on Wayland, because wayland is more restrictive and we can't fix that either. |
yeah, didn't work for me on kde wayland, only on kde x11. Though i could swear it used to work better-ish some months ago but probably just wishful thinking. but tbh, it feels pretty bad if it only works on kde x11, considering the popularity of gnome and gnome based DEs, and the rise of wayland (default on fedora and kubuntu (at least on ubuntu, not actually sure about their kde version)). Maybe a bit too philosophical, but can we really consider an API working on Linux if it doesn't work as expected for most Linux users even if it's technically not our fault? |
There is one last thing I want to test so I will install Gnome to investigate a bit further but no promises. |
I was going to say "but it works using Electron or Qt" ... except it no longer does. Both Electron and Qt the normal -> hidden -> minimize sequence make the window visible, and I'm fairly sure it didn't used to do that. (Though in the past I mostly tested on Wayland.) FWIW things work on fine on macOS. I'll try to switch to Wayland later today to check that is also broken there. I suspect the regression on Gnome on some relatively-new regression, and it would be best to report it. (For what it's worth, I did report a bug on webkitgtk - and it got fixed and the fix is finally in Fedora.) |
Which I find weird too since we are simply calling GTK APIs directly so you'd expect it to work on Gnome without a problem, in fact, I was always worried about other Window Managers but nowadays I have seen a lot of APIs break on Gnome that I am quite sure used to work well. |
Yup just tested on Gnome and it doesn't work. Unfortunately I don't think there is much we can do since they state in their docs that the window manager could choose not to unminimize the window see https://docs.gtk.org/gtk3/method.Window.deiconify.html |
No, that's not how I read it. It says you can't count on it being deiconified because ther user or window manager could re-iconify it. If the request to deiconify is overridden/ignored by the WM that would definitely be contrary to expected WM behavior - and (for a general-purpose WM with sane defaults) a bug. The point is the Gtk is at the mercy of the (buggy) WM. |
Actually, the window manager could still choose to ignore the de-iconification request.
Not just GTK but raw x11 APIs too, the window manager could simply choose not to do a request, it is pretty common thing actually. |
After a window is minimized, document.hidden and document.visibilityState report respectively false and "visible". The window.is_visible function reports the same.
This seems to contradict this.
Possibly related,
window.set_minimized(false)
sems to have no effect. Instead, to unminimize a window you first have to hide it, which seems unfortunate:Electron does have a
isMinimized
method - but is not needed becauseshow
works on minimized windows.This is on Fedora Linux 34 running Gnome/Wayland.
The text was updated successfully, but these errors were encountered: