The proposal is to introduce on-workspace-touched callback. When the workspace is updated in any way (focused changed to/from the workspace, children are attached/removed, name/tag is changed (oh,fuck, see below))
It'd require introduction of workspace-mru-app-name interpolation variable ("MRU" stands for "most recently used")
Alternative names:on-workspace-used (similar to "MRU"), on-workspace-updated (Does "focusing the workspace" update it?)
Alternative. Allow interpolation variables directly inside rename-workspace? rename-workspace --tag %{workspace-mru-app-name}. Then, for the consistency, they should be allowed in literally all commands. workspace %{next-workspace}, focus --window-id %{left-window-id}, etc. jeez
Problem. Any command run inside the callback will probably change the workspace again. rename-workspace changes the workspace, which leads to infinite loop.
Possible solutions:
More fine-grained callback. on-workspace-children-changed (sounds too specific. Is it useful in general case?)
Detect changes from the callback itself, and don't retrigger recursively. Sounds the most promising
Don't do anything with this problem. Assume that the script inside is idempotent, which will cause recursion only once I completely dislike it. At least because commands need to make sure no to call the callback if they detect that they noop
The proposal is to introduce
on-workspace-touched
callback. When the workspace is updated in any way (focused changed to/from the workspace, children are attached/removed, name/tag is changed(oh,fuck, see below))Use case:
It'd require introduction of
workspace-mru-app-name
interpolation variable ("MRU" stands for "most recently used")Alternative names:
on-workspace-used
(similar to "MRU"),on-workspace-updated
(Does "focusing the workspace" update it?)Alternative. Allow interpolation variables directly inside
rename-workspace
?rename-workspace --tag %{workspace-mru-app-name}
. Then, for the consistency, they should be allowed in literally all commands.workspace %{next-workspace}
,focus --window-id %{left-window-id}
, etc. jeezProblem. Any command run inside the callback will probably change the workspace again.
rename-workspace
changes the workspace, which leads to infinite loop.Possible solutions:
on-workspace-children-changed
(sounds too specific. Is it useful in general case?)Don't do anything with this problem. Assume that the script inside is idempotent, which will cause recursion only onceI completely dislike it. At least because commands need to make sure no to call the callback if they detect that they noopDepends on: #245 #278