-
Notifications
You must be signed in to change notification settings - Fork 19
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
[FEAT] Better scratchpad window slide animation. #154
Comments
This means an additional call on each hide right... |
If a windows has fromTop animation, then get x value from |
Isn't it what is already happening, the scratchpad moving out of the monitor? Can you share your configuration and use case so I better understand? |
Are other users experiencing this kind of issue? |
@fdev31 I implemented the solution myself and here is the before and after: Before: Before.mp4After: After.mp4 |
This is the solution, but it has one problem, it does not account for monitor scale, i have 1.2 monitor scale(1600x1000) based on 1920x 1200; therefore the original monitor dimensions are taken instead of scaled making the animations fast for
|
@fdev31 Now the code also takes monitor scale into account. I think you should make a commit if eveything works correctly.
|
Hi! One more important remark: it's broken at least when the scratchpad is animated "fromright". I am currently facing some family challenges and don't have much (brain) time for hobbies, I believe more tests are needed before implementing such change (preserve_aspect = true, and the 4 different animations + "not animated" config). If it looks like no more regression is found, we can consider merging it. async def get_offsets(self, scratch: Scratch, monitor: MonitorInfo | None = None) -> tuple[int, int]:
"""Return offset from config or use margin as a ref."""
offset = scratch.conf.get("offset")
if monitor is None:
monitor = await get_focused_monitor_props(self.log, name=scratch.forced_monitor)
rotated = is_rotated(monitor)
aspect = reversed(scratch.client_info["size"]) if rotated else scratch.client_info["size"]
if offset:
return cast(tuple[int, int], (convert_monitor_dimension(offset, ref, monitor) for ref in aspect))
mon_size = tuple(
int(m / monitor["scale"]) for m in ([monitor["height"], monitor["width"]] if rotated else [monitor["width"], monitor["height"]])
)
win_position = apply_offset((monitor["x"], monitor["y"]), scratch.meta.extra_positions[scratch.address])
win_size = convert_coords(scratch.conf.get("size"), monitor)
scaled = []
if get_animation_type(scratch) in ["fromtop", "fromright"]:
for v1, v2 in zip(win_position, win_size, strict=True):
scaled.append(v1 + v2)
else:
scaled = [m - w for m, w in zip(mon_size, win_position, strict=True)] |
Did you try setting 'margin' manually? This code breaks too many things but I think you can achieve the same with a custom margin.... |
FYI I had to make some fixes (turned to be simplifications) to get the 4 animations working, but it's dropping "margin" support... I guess the default values are not fitting your setup, but on my desktop setup this patch looks really bad: async def get_offsets(self, scratch: Scratch, monitor: MonitorInfo | None = None) -> tuple[int, int]:
"""Return offset from config or use margin as a ref."""
offset = scratch.conf.get("offset")
if monitor is None:
monitor = await get_focused_monitor_props(self.log, name=scratch.forced_monitor)
rotated = is_rotated(monitor)
aspect = reversed(scratch.client_info["size"]) if rotated else scratch.client_info["size"]
if offset:
return cast(tuple[int, int], (convert_monitor_dimension(offset, ref, monitor) for ref in aspect))
win_position = apply_offset((monitor["x"], monitor["y"]), scratch.meta.extra_positions[scratch.address])
win_size = convert_coords(scratch.conf.get("size"), monitor)
scaled = [v1 + v2 for v1, v2 in zip(win_position, win_size, strict=True)]
return cast(tuple[int, int], scaled) |
A custom offset could be better.... please test if this can fix your setup or if there is a need to find another solution. |
The above code works but only for fromTop and fromLeft |
Yes. I find pyprland scratchpad implementation to be far more sluggish than Hyprlands default togglespecialworkspace. |
@JunaidQrysh any feedback on the usage of the existing configuration options ? (offset, margin, ...) @Sneethe not surprising that something doing multiple IPC calls to get information before toggle the workspace takes more time than just toggling the workspaces. So comparing X calls + 1 to "just one call" isn't really a fair comparison and will never be the same. In case your system is really slow, some tricks may improve the response time, check https://hyprland-community.github.io/pyprland/Optimizations.html#pypr-command for that matter, maybe it makes a difference on your system. But again, scratchpads implementation is far more complex than a single togglespecialworkspace call and requires multiple interactions with hyprland API. |
@fdev31 i think offset and margin are fine, but can your share your hyprland animation config, i dont understand why the code is broken on your setup, do you have multiple monitors? I am still daily driving my own pypr build with zero issues but more smooth experience. |
hum, I think this is really an offset thing... it's only affecting hide and just makes it hide "way more far" than the current code which uses the window height. With your code, I tried this config on the 4 animation types (to see that half were broken/ animating in the wrong direction):
and the hyprland anim config:
|
@fdev31 it tested the above code with your animations and your exact pypr config it still works flawlessly in all animations. |
Maybe I made some mistake when I tested it, I'll give it another try.... but this is breaking compatibility with the margin fallback, probably not a big deal. |
@fdev31 So i tested the same code with all monitor rotations and it worked BUT you MUST kill pypr & all scratchpads if you change monitor rotation in hyprland config. I think that's why you saw weird animations. |
That's an interesting feedback, maybe some caching issue.
Thank you for the tests, I'll look at it in a week or two Given my current
activities.
Le mar. 14 janv. 2025, 18:56, JunaidQrysh ***@***.***> a
écrit :
… @fdev31 <https://github.com/fdev31> So i tested the same code with all
monitor rotations and it worked BUT you MUST kill pypr & all scratchpads if
you change monitor rotation in hyprland config. I think that's why you saw
weird animations.
—
Reply to this email directly, view it on GitHub
<#154 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB2IHXV5OJFG4XBRNITOXD2KVFVXAVCNFSM6AAAAABSVAXMHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJQG4ZDIOBXGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I added it to the main branch, basic tests showed ok but I didn't test rotation (also combined with scale). EDIT: not making any release now, but will in a couple of weeks maybe after I can run better tests. Hoping having it on git will raise some eventual issues before that... |
Currently the scratchpad window moves some pixels determined by the default offset value, then moves to special workspace which make the animation feel cutoff.
It will be better to move the whole window out of the monitors edge then move it to the special workspace.
I think the solution is to get the respective
at:
andsize:
values from hyprctl command and add them for the default offset value.The text was updated successfully, but these errors were encountered: