Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Previous workspace is forgotten or cycles too far

Open proycon opened this issue 1 year ago • 3 comments

This applies to when binds:allow_workspace_cycles is set to false:

The workspace previous command is not working as I'd expect. I'm using the master layout (though the code seems to generically apply to all) and I would expect workspace previous always to return to the previous workspace (the one I was on before switching), effectively allowing me to toggle between my last two workspaces indefinitely. Instead, I find that cycling to the previous workspace is no longer possible after I used it once.

observed behaviour:

workspace 1 -> ok
workspace 2 -> ok
workspace 3 -> ok
workspace previous -> takes me to 2, ok
workspace previous -> takes me to 1, not ok, I have allow_workspace_cycles disabled
workspace previous -> takes me to 3 (why now?)
workspace previous -> no action, keeps me at 3
.. stuck at 3..

expected behaviour:

workspace 1
workspace 2
workspace 3
workspace previous -> takes me to 2
workspace previous -> takes me to 3
workspace previous -> takes me to 2
workspace previous -> takes me to 3
..repeat ad infinitum..

Note:

Though all of this is on a single monitor, I do run a multi-monitor setup with workspace 10 (and only 10) on the second monitor. I haven't switched to it in the above tests but can't rule out that multi-monitor is somehow a factor in this bug.

proycon avatar Dec 12 '22 17:12 proycon

Whether this is a bug depends ons the intended behavior of previous. My intuition would be similar to yours, but it seems to play back through a list of former active workspaces, rather then cycle back and forth between previous and current. Which might be intended?

bklaase avatar Dec 24 '22 10:12 bklaase

idfk what was intended, this feature was a pr

vaxerski avatar Dec 24 '22 13:12 vaxerski

It seems the current behavior is thus:
When switching to a workspace, the workspace switched towards remembers the workspace being switched from. Except when using workspace, previous. I'll have a look in the code if this is indeed the case. And we could talk about what people might expect?

current behavior is something I have never seen before, but it is also somewhat interesting. When enabling allow_workspace_cycles, you can manually walk through a set of workspaces (e.g. 1,2,5) and it will keep cycling through those. Perhaps useful for some strange repetitive workflow.
Empty workspaces of course don't work, since they won't remember anything. But that makes perfect sense.

bklaase avatar Dec 24 '22 13:12 bklaase

is there anyone that wants this behavior? I don't find it particularly useful. it could be easy to remove.

devil-may-c0de avatar Jan 10 '23 08:01 devil-may-c0de

@devil-may-c0de, i am with @proycon. this behavior is very useful, specially when you're writing code. i use laptop. i use different workspace for different tasks. for example, one for email/messangers , one for IDE and one for browser. when i am writing code, i have to switch between IDE and Browser workspace. i don't want to go through all opened window when i am working. so, simply switch between two most recent active workspace is must have feature.

shaeinst avatar Jan 10 '23 14:01 shaeinst

@devil-may-c0de, i am with @proycon. this behavior is very useful, specially when you're writing code. i use laptop. i use different workspace for different tasks. for example, one for email/messangers , one for IDE and one for browser. when i am writing code, i have to switch between IDE and Browser workspace. i don't want to go through all opened window when i am working. so, simply switch between two most recent active workspace is must have feature.

I think he was talking about what bklaase said. Did anyone fix it / found the solution ?

VAISHAKH-GK avatar Jan 10 '23 14:01 VAISHAKH-GK

https://github.com/hyprwm/Hyprland/blob/c0c7c12bb907ea8cdc6e17653cddb3691102beac/src/managers/KeybindManager.cpp#L644-L646 It does seem intentional.

devil-may-c0de avatar Jan 10 '23 17:01 devil-may-c0de

Ah, forgot about this one :D. yeah, found that too, and thought about contacting the original PR contributer, but then I concidered that there is always going to be *somewhat * unexpected behavior, because the current previous functionality is dependent on state kept in the workspace... which gets destroyed when it's empty, resulting in no way back after a round trip... etc.

but perhaps that doesn't matter.

The sane thing to do, seems to remove that check

bklaase avatar Jan 10 '23 18:01 bklaase

by the way if you want it to work as it works now, just do this:goto m, n, m, n from then on previous will move back and forth between those two.

bklaase avatar Jan 10 '23 18:01 bklaase

can confirm removing the checks produces expected behavior with the latest release source. also works on empty workspaces

devil-may-c0de avatar Jan 10 '23 18:01 devil-may-c0de

makes sense. after thinking about it; prev workspace is set when going to a new ws. and at that time, it's recreated

bklaase avatar Jan 10 '23 21:01 bklaase