Closed rastersoft closed 2 years ago
Ok, now I see it: you use it to set the size and location of the dock.
I uploaded a MR that fixes this and other things.
Yes I do use this to detect resolution or monitor changes. There are caveats here and I took a lot of time to make it work reliably: e.g. triggering the overview allows the position to be really updated, for whatever GS signals update tricks.
There is a hide/show trick to trigger the position to be updated, too...
Note that I never experienced this bug!
https://github.com/fthx/dock-from-dash/commit/f99376f179e62f06bf653fb3c1faaf6f8eed7997 I'll look at the background bug, using 'always show'. I'll see if it happens once. (Was on X11? I do always use Wayland, even for tests so I cannot see this, if applicable).
Could you tell me how to reproduce, even if it's random?
It happens sometimes when I have three maximized windows in three workspaces, I close the last window (the one in the third workspace) and switch to the second: sometimes it is triggered there.
I use wayland, BTW.
Yes I can reproduce easily now. Just open a full screen w. Go to 2nd ws. Open a new full screen w. The signal is emitted.
I have an idea to workaround this bug in GS.
The old MR did a workaround by storing the size of the workspaces and comparing the new values with the old ones.
Anyway, maybe you should also separate the show part of the resize part.
really closed this time by: https://github.com/fthx/dock-from-dash/commit/db100649d3c70491115bde25b528e5e7b38ede6c
Anyway, maybe you should also separate the show part of the resize part.
It's possible but don't forget that dock has to be triggered once to make its position really updated in all situations. I'll be happy here if there is a smarter && shorter solution, but variables and signals in GS are sometimes lazy. It has to be tested at least when plugging in/out an external monitor, e.g., switching monitors...
But you can just update the size/position and avoid showing it...
(also, remember that sometimes you need to use "connect_after" instead of "connect"...)
If a connect_after (that I never used before) do avoid to trigger the dock (with show/hide trick), I'll be happy but it needs some tests because if we go for simply remove this trigger part, it won't update position correctly in all cases. What signal should I connect_after rather than connect?
I was talking about other signals, like "realize", where if you connect using "connect", you receive it "when the widget is going to be created in screen", but if you connect using "connect_after", you receive it "immediately after being created in the screen".
In this case, I think that you should separate dock_refresh() in two functions: one from line 189 to line 203, and another from line 204 to the end, and call the first one only when the size must be updated, and the second one only when the dock has to be presented on screen.
Also, I would connect _screen_border_box_refresh() to the "allocation-changed" signal of the dock; this way, every time the dock changes its size, the border box would also change it.
https://github.com/fthx/dock-from-dash/commit/cdadc7eab277393d6c48df65d1d1bde4fd73f375 We have to check if this version is reliable, especially for screen border box update when areas do change.
Also, I would connect _screen_border_box_refresh() to the "allocation-changed" signal of the dock; this way, every time the dock changes its size, the border box would also change it.
This does not work, as far as I tested.
Yes, I don't know why, but I receive an error if I try to connect to "allocation-changed"... which is odd.
But you can connect to "notify::width" and "notify::height" to the _box element, and use that to set the width and the height of the border box. I tested it and it does work.
Could you have a look at latest code here?
I've got one issue (only one?) here:
if (settings.get_boolean('always-show')) {
this.set_position(this.work_area.x, this.work_area.y + this.work_area.height - this.height);
} else {
this.set_position(this.work_area.x, this.work_area.y + this.work_area.height);
}
(line 146)
It does not work. The dock does not appear (autohide enabled). If I do simply:
this.set_position(this.work_area.x, this.work_area.y + this.work_area.height - this.height);
instead of this 'if' statement, it works but after a workareas refresh (toggled by GS bug) the position of the dock is 'shown position', so the animation is instant and that does not look clean.
If you're ok with that, we could look at the screenbox update with signal after having solved all the others known issues?
Mmm... I think that you are forgetting that the values of width and height aren't set from the beginning, but are being updated regularly based on constraints and the size of inner elements, so precisely connecting to the notify::width and notify::height signals and calling there a function that updates the position of the dock based on the current values is the only way of ensuring that everything works as expected.
Remember that any element begins with a size of 0x0, and only when it is realized are all its children called recursively to calculate the final size.
Ok but why in this case the one-line solution:
this.set_position(this.work_area.x, this.work_area.y + this.work_area.height - this.height);
does work?
Maybe because the border box isn't set correctly...?
But it is, if I just put the single command. I'm working on signals to update screen box, following your test.
I think this one is now good: https://github.com/fthx/dock-from-dash/commit/fc66e4d5b208c5bee8d75244ca3a30b9eaf01bab
the first position of the shown dock is not correct (seen better in always show mode). That's a problem I had a long time ago, and that's why I did use a show/hide trick.
If you have a solution?
I'll test it, give me some time.
Oh, that's not ok with always mode on. I maybe think we could remove this mode...
I think that the code is quite complex... I would do the following:
This way all the code is in a single place and is easier to keep track of all the possible cases...
I'll try it today
El lun., 4 abr. 2022 9:04, fthx @.***> escribió:
Closed #35 https://github.com/fthx/dock-from-dash/issues/35.
— Reply to this email directly, view it on GitHub https://github.com/fthx/dock-from-dash/issues/35#event-6360360668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMK55OLK4AY5UFDYG7IVLVDKIBTANCNFSM5SKAMVBA . You are receiving this because you authored the thread.Message ID: @.***>
There's still a problem: if there is no window in the current workspace, clicking on an icon makes the dock disappear. Only if there is already a window of another program will the dock remain after clicking.
GS extensions server is down but i'll push this soon.
It seems to be fixed now.
I have found that the dock, sometimes, shows "randomly" without I triggering it. After several tests, I found that the problem is that the "workareas-changed" signal is emitted sometimes when a new window is added or removed, and that forces the dock to show up.
The point is that I don't understand why are you using that signal...