#4008

When using `move-window-to-workspace` the target workspaces `active_window_id` doesn't always reflect the its last focused window

Openchopper2000ukopened 5mo ago

More of a clarification than necessarily a bug, or maybe requiring an enhancement. When a window is moved to a workspace via move-window-to-workspace the focus options is defined as:

If true (the default) and the window to move is focused, the focus will follow the window to the new workspace. If false, the focus will remain on the original workspace.

So:

Window_id has focusfocus optionactive_window_id of target workspaceresult
truetruewindow_idfocus follows window to new workspace
truefalseunchangedfocus previous window within current workspace
falsetrueunchangedfocus previous window within current workspace
falsefalseunchangedfocus previous window within current workspace

Should the target workspaces active_window_id be set to the moved window under certain criteria? maintaining the windows list focus_timestamp order. Maybe:

Window_id has focusfocus optionactive_window_id of target workspaceresult
truetruewindow_idfocus follows window to new workspace
truefalsewindow_idfocus previous window within current workspace
falsetruewindow_idfocus previous window within current workspace
falsefalseunchangedfocus previous window within current workspace

Currently the work around would be a spawn-sh with:

  1. focus on the window to be moved
  2. move window to workspace with focus=true
  3. focus previous workspace

I can kinda see both sides, focus can be a bit ambiguous, but a bit biased due to my use case. Like many I use a stash workspace, mostly pulling back the last window I've stashed, which tends not to be the one that has focus when I go to the stash workspace. Unless using a work around which is a bit choppy with screen refreshes.

Activity

2
YaLTeR5mo ago

I know it's not entirely consistent rn, this is due to the fact that the code doesn't have a good way to do finer grained focus management. It would need a bit of design and refactoring, and I haven't done it yet because it's not a big problem

chopper2000uk5mo ago

It's not a big deal. Just thought I'd make a suggestion that might solve my edge case, make some logical sense and possibly be relatively simple to implement. Loving Niri