Skip to content
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

Lose zoom when deactivated #188

Open
aljustiet opened this issue Sep 26, 2024 · 18 comments
Open

Lose zoom when deactivated #188

aljustiet opened this issue Sep 26, 2024 · 18 comments
Assignees
Labels

Comments

@aljustiet
Copy link

I use Hyprland on Arch BTW. And when I change the active window, the swayimg loses the zoom value. Can I change this behavior using the config file, or is it a bug?

@aljustiet aljustiet changed the title lose zoom when deactivated Lose zoom when deactivated Sep 26, 2024
@artemsen
Copy link
Owner

This was a bug that I fixed some time ago.
What version of swayimg are you using?
Is the issue reproducible in the latest release (v3.2)?

@aljustiet
Copy link
Author

This was a bug that I fixed some time ago. What version of swayimg are you using? Is the issue reproducible in the latest release (v3.2)?

3.2-2

artemsen added a commit that referenced this issue Sep 28, 2024
Relates to #188.

Signed-off-by: Artem Senichev <[email protected]>
@artemsen
Copy link
Owner

Maybe Hyprland resizes the window when focus is lost, which causes the scaling to reset. I can't reproduce it in Sway WM.
Anyway, I added an option to disable this behavior. Please let me know if this helps.

@aljustiet
Copy link
Author

Maybe Hyprland resizes the window when focus is lost, which causes the scaling to reset. I can't reproduce it in Sway WM. Anyway, I added an option to disable this behavior. Please let me know if this helps.

I reinstalled swayimg with swayimg-git. And now it doesn't reset zoom when focus is lost, but it launches with non-fit scale

@artemsen
Copy link
Owner

Please, attach your config file for the swayimg.
I tried with these options and it works for me:

[viewer]
resize_reset = no
scale = fit

@aljustiet
Copy link
Author

aljustiet commented Sep 28, 2024

Please, attach your config file for the swayimg. I tried with these options and it works for me:

[viewer]
resize_reset = no
scale = fit

I have this swayimgrc.
I tried to remove all lines except these two that you sent, but still the image doesn't launcher fit.

@artemsen
Copy link
Owner

It looks like there is some specific in Hyprland.
May be I will install it in VM a little later.

@artemsen artemsen self-assigned this Sep 28, 2024
artemsen added a commit that referenced this issue Sep 29, 2024
Reverts commit b0426a3.

Relates to #188.

Signed-off-by: Artem Senichev <[email protected]>
@artemsen
Copy link
Owner

I think I figured out what the problem was.
Hyprland opens window with animation, it smoothly increases window size.
If we ignore resize events, the fit scale will be calculated only for the first call (for small window size).
Sorry, I don't see a way how to fix this.

@aljustiet
Copy link
Author

Please, attach your config file for the swayimg. I tried with these options and it works for me:

[viewer]
resize_reset = no
scale = fit

Issue came back. The zoom is lost when I change the active window.

@aljustiet
Copy link
Author

I have this output: WARNING: Unknown config parameter "resize_reset = no" in section "viewer"

@artemsen
Copy link
Owner

I removed this parameter because it doesn't work as intended.

@aljustiet
Copy link
Author

I removed this parameter because it doesn't work as intended.

Is there an alternative to that?

@artemsen
Copy link
Owner

No. I don't know how to handle Hyprland's game with window resizing.

@vaxerski
Copy link

WAYLAND_DEBUG=1 of swayimg when this bug happens would help narrow down the problem

@artemsen
Copy link
Owner

WAYLAND_DEBUG=1 of swayimg when this bug happens would help narrow down the problem

It's not actually a bug, but Hyprland specific behaviour: window animation is based on resize, so it is not possible to determine when resize complete.

@vaxerski
Copy link

the client should not see or care about that, though. The moment the animation starts, you get a resize event to the target size. From the client POV, there is no animations.

@artemsen
Copy link
Owner

the client should not see or care about that

This is how swayimg works.
But when Hyprland's window loses focus, it decreases in size, so the image is adjusted to the new size. This is the problem described in the topic. There is no way to tell whether the user has reduced the size of the window or whether it has changed as a result of animation.

@vaxerski
Copy link

it shouldn't, that's why I asked for WAYLAND_DEBUG logs. Unless the user has some windowrule set for unfocused windows that would change their geometry, it shouldn't be re-sent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants