Skip to content
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

on-workspace-touched/on-workspace-redraw callback #316

Open
nikitabobko opened this issue Jul 5, 2024 · 1 comment
Open

on-workspace-touched/on-workspace-redraw callback #316

nikitabobko opened this issue Jul 5, 2024 · 1 comment

Comments

@nikitabobko
Copy link
Owner

nikitabobko commented Jul 5, 2024

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:

on-workspace-touched = 'echo %{workspace-mru-app-name} | xargs rename-workspace --tag'

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

Depends on: #245 #278

@nikitabobko
Copy link
Owner Author

nikitabobko commented Aug 14, 2024

To consider:

  • on-workspace-tree-updated
  • on-refresh (after each "refresh session")
  • on-workspace-redraw

@nikitabobko nikitabobko changed the title on-workspace-touched callback on-workspace-touched/on-workspace-redraw callback Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant