-
Notifications
You must be signed in to change notification settings - Fork 134
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
Fix floating window width increase when moving to workspace #678
base: master
Are you sure you want to change the base?
Conversation
* exwm-workspace.el (exwm-workspace-move-window): Deduct 1 pixel from `frame-pixel-width' of `old-frame' when moving a floating window to another workspace. This prevents the floating window from growing in width over repeated moves.
d3ab8fb
to
4795fad
Compare
The size of some programs may not be consistent after they are moved to another workspace. The 1-pixel offset in width is likely program-specific; some might have more, and it might also be an offset in height. The problem lies in the fact that we can't resize Emacs frames precisely according to which the size of floating X windows is calculated.
We already have a similar feature for displaying an X window on all workspaces. There are some limitations though:
Depending on how well we can resize a floating X window after moving it to another workspace, this may be the best we can get for now. |
I'm experiencing it with mpv 0.30.0, but now I'm starting to wonder if DPI differences between machines would determine whether the problem actually appears. Since the size increase is something that may not be experienced by everyone, I now don't feel comfortable making the exact change in this PR. I will experiment with setting |
OK, I just quickly tried |
Quick idea that I haven't fully thought through: if we added an I guess what I don't know is why it's currently necessary to create a new frame to host the window on a new workspace when it's clear that setting |
This is by design. In EXWM a floating X window always remembers which workspace it belongs to, or things like making it tiling would be impossible. This is more true when
This is not how things work. The property
This is only partly true. With |
Hi @ch11ng!
I noticed this issue when writing some custom window pinning logic for floating windows so that I can have a pinned
mpv
player. When you move a floating window to another workspace, its new frame has a width 1 pixel larger than on the previous workspace. If you keep moving the window between workspaces (for instance, when it's pinned), it gradually starts to get larger.The fix I'm proposing is to subtract 1 from
(frame-pixel-width old-frame)
when doing the move operation so that this pixel increase is cancelled out. I've tested this when moving both tiled and floating windows and it seems to work fine in both cases. However, you might have a better idea for how to fix this so I'm definitely open to suggestions.Side question: would you be interested in a PR to add pinned floating windows as a core feature to EXWM? Moving the pinned window after the workspace switch isn't the greatest user experience, it could be a lot smoother if was built in to the workspace switching logic.
Thanks!