Skip to content

Implement layout sticky for floating windows#2083

Open
KaiExec wants to merge 1 commit into
nikitabobko:mainfrom
KaiExec:feature/layout-sticky
Open

Implement layout sticky for floating windows#2083
KaiExec wants to merge 1 commit into
nikitabobko:mainfrom
KaiExec:feature/layout-sticky

Conversation

@KaiExec

@KaiExec KaiExec commented May 5, 2026

Copy link
Copy Markdown

See commit message for details.

PR checklist

  • Explain your changes in the relevant commit messages rather than in the PR description. The PR description must not contain more information than the commit messages (except for images and other media).
  • Each commit must explain what/why/how and motivation in its description. https://cbea.ms/git-commit/
  • Don't forget to link the appropriate issues/discussions in commit messages (if applicable).
  • Each commit must be an atomic change (a PR may contain several commits). Don't introduce new functional changes together with refactorings in the same commit.
  • ./test.sh exits with non-zero exit code.
  • Avoid merge commits, always rebase and force push.

Failure to follow the checklist with no apparent reasons will result in silent PR rejection.

@grazzolini

Copy link
Copy Markdown

I have tested this branch with a local debug build and it works. However, I have one small suggestion:

Most of the time, the windows that need sticky, are also already started as floating. So, I would suggest that macWindow.isSticky when used to match a window using [[on-window-detected]], only applies sticky to windows of that app that are floating. Otherwise if you have multiple windows of the same app, but some aren't floating, it applies to all.

Other than that, this works awesomely.

@KaiExec
KaiExec force-pushed the feature/layout-sticky branch from 2dc78b5 to 803164a Compare May 8, 2026 09:30
@grazzolini

Copy link
Copy Markdown

Perfect, now I can do:

[[on-window-detected]]
if.app-id = 'com.app.example'
run = ['... other commands ...', 'layout sticky']

And the AeroSpace automatically applies sticky to any floating window from that app.

@nikitabobko What does this PR need to get in? Tests?

vitorebatista added a commit to vitorebatista/AeroSpace that referenced this pull request Jun 2, 2026
Adds a `sticky` layout subcommand that toggles a per-window `isSticky`
flag. Sticky floating windows stay visible on non-visible workspaces
(unhidden from the corner) and aren't auto-refocused away by the focus
cache when they live on a different workspace than the focused one.

Adds parse tests for the new `sticky` layout subcommand.

Ports nikitabobko#2083

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@KaiExec
KaiExec force-pushed the feature/layout-sticky branch from 803164a to 7b01b37 Compare June 15, 2026 06:15
Sticky floating windows remain visible across all workspace switches
without following the active workspace. Clicking a sticky window does
not trigger a workspace switch.

Implementation:
- Add .sticky case to LayoutDescription enum in LayoutCmdArgs
- Add isSticky property to MacWindow
- In LayoutCommand: applying .sticky auto-floats the window and sets
  isSticky = true; applying any other layout clears isSticky
- In layoutWorkspaces() in refresh.swift: skip hideInCorner for sticky
  windows, and explicitly unhide them after visible workspaces are laid out
- In updateFocusCache(): prevent workspace switching when a sticky
  window receives native focus

Usage:
  layout sticky          # toggle sticky (auto-floats if needed)
  layout sticky tiling   # toggle between sticky-float and tiling

Closes nikitabobko#2
@KaiExec
KaiExec force-pushed the feature/layout-sticky branch from 7b01b37 to 4394146 Compare June 15, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants