feat(animation): slide workspaces in and out added a workspace entry to
the duration, enabled and style options of animations in schema.json,
but not to nix/komorebi-options.nix. Add them. Nothing else in the
generated files is out of date at this point of the stack, and the
commits above it carry the same nix file.
schemars-nixgen writes the options of an object in a different order on
every run, so the file keeps its order and gets only the new options. The
lines of the result, sorted, are the lines of a fresh run, sorted.
Add a workspace animation kind. When focus-workspace switches workspaces on a
monitor, pictures of the windows that leave slide out and pictures of the
windows that arrive slide in, on an overlay of Core Animation layers. The real
windows are put away or kept waiting behind them, and the ones that arrive are
restored where the pictures end up, which fade away over them.
Dragging the edge of a window only resized its neighbours once the
button went up. They now follow the edge while it is dragged.
The window that is dragged says that it moved, and one such step waits
at most, so that the channel is not filled with the ones that come
faster than they are handled. What is laid out for a step is worked out
from the workspace as it was when the edge was taken hold of, and not
from the step before, so a drag ends the same with its steps as without
them and one that is taken back puts the neighbours back. The neighbours
are written straight into place and not animated, a window that would be
sent where it already is is left alone, and no window is asked what it
turned out to be, since one that has not settled would say that it is
wider than it will be. The apps of the neighbours are only waited for a
quarter of a second for as long as the drag lasts.
The neighbours say that they were resized, with the button down, which
would be taken for somebody dragging them, so that is dropped where it
is heard, before anything is asked of an app. That is only for as long
as the button is down, and a drag whose end was never seen, as with a
tap that was turned off, is forgotten by the next thing that is heard.
The end of a drag that was followed is the end of that drag whichever
window the event is about, and a left or top edge, which moves the
window too, is not read as a move.
A drag is now measured from the tile for an edge that has moved, when it
was seen no more than 64 pixels from it, where it used to be only for an
edge more than 32 from it, so a drag of a few pixels no longer starts
from where the window had got to. An edge that did not move is left as
it was read.
Resizing a column by its left edge pans the strip to keep the right edge
where it was, and only for the column that the strip has as active, so
the strip is made to agree about which that is first.
Both move from c6a780c to 424a937, the tip of the upstream branch that
resizes by dragging an edge with the neighbours following. The
komorebi-scrolling crate has no pin of its own and moves with
komorebi-layouts, so the three stay in step.
What changes for us is in the scrolling layout and its model. Resizing
a column by its left edge now moves that edge and pans the strip so the
right edge stays where it was, where it used to grow the column to the
right. A column counts as in view when it is within a pixel of the edge
of the screen, and filling the available width rounds down. There are
no changes to the API that komorebi calls.
That commit is on a branch that is not merged and has been rewritten
before, so this is to be moved to the SHA on master once it lands.
toggle-column-stack stacks the windows of the focused column in one
window slot, or spreads the focused stack out into a column with a
window in each slot, whichever the focused column is. A stack is what
a tabbed column already is, so this is the same thing seen from the
other side: existing stacks stay stacks, consume and expel make split
columns, and this switches either kind.
Stacking keeps the order of the windows and the one that had focus is
the one that shows. Spreading out puts the tabs in the order of the
tabs, with focus on the window that had it, and puts every window that
was out of sight where it is shown, the one that stays in its slot as
much as the ones that go to slots of their own. Focus stays on the
column while that is done, so that stacking and spreading out again
leaves the strip where it was. The column keeps its width. Heights that
its slots were given are not remembered for toggling back, which needs
more memory than a column keeps.
The stack is the stack of every layout, so cycle-stack, focus-stack-
window and stack work on it, and unstack takes the window that has
focus off into a column of its own to the right, which a test checks.
Like consume and expel it only does anything in the Scrolling layout.
The parking and restoring of windows is the code that stacks already
use, and was not seen on a screen. A test has no screen, so what would
be restored is recorded, and two tests check that every window of a
spread out stack is and that the strip stays put.
A container goes from one workspace to another by being taken out of
one and put into the other, with nothing between them that both could
be asked, so a window that was moved started again with the default
width, as did one moved to another monitor.
Taking a container out of a workspace now says what its column was
given, which komorebi_layouts::scrolling keeps, and the strip of the
workspace that has the container next finds it there the first time it
sees it, before it is made to match the list. So the window is a column
of its own as wide as the column it left, whichever way it got there,
and a window that moves on takes what it has where it is. Nothing is
remembered for a container that no strip had been asked about.
The tap that sees clicks and key presses for the reaper and for the end
of a drag was never looked after. The system turns a tap off when it is
too slow to answer and tells the callback with an event that is not an
event, which was treated as a click, and a tap that did not survive
sleep was never missed. Either way komorebi stopped noticing windows
that close without a notification and drags that end without one, with
nothing in the log.
The callback now only says that it was turned off, since anything slow
done there is what gets a tap turned off, and the main loop turns it on
again at once. Every five seconds it also asks whether the tap is there
and on, turns it on or makes it again as the answer says, and tries to
make one if there never was one, since the permission may have been
granted since. Not being able to make the tap is logged, once.
The decision is a function of two booleans with tests. That the system
really does disable the tap, and what sleep does to it, is not something
that was seen on a device.
The heights that the model can give the tiles of a column are now
reachable. Resizing a vertical edge makes the focused window taller or
shorter by half of the resize delta, as a horizontal edge does for a
column, and the others in its column share what it leaves. No window is
made shorter than 100 pixels, and retile puts heights back as well as
widths.
A window that is alone in its column fills it, so all of this does
nothing for it, and the other layouts are not affected.
The strip's tiles are the workspace's containers, in the order of the
list, so a column is a run of the list and every container still gets
one rectangle: the layout pass, latest_layout, drag and the borders are
as they were. Everything that changes the order of the containers does
it on the list, and the strip is made to match on the next pass.
- consume left|right and expel make and unmake columns of several
windows, and only do anything in the Scrolling layout for now
- focus left and right go to the neighbouring column and to the window
in it that had focus last, and up and down go between the windows of
the column and carry on to another monitor at the ends, as before
- move left and right move the whole column, and up and down swap the
window with the one above or below it, past which the list changes
- a new window goes after the last window of the focused column and
not after the focused window, so that it is a column of its own and
does not split the one it was opened next to
- the strip is no longer thrown away when the layout is not Scrolling,
so that widths come back when it is again
Heights are equal and there is no command to change them yet. A window
that is moved to another workspace or monitor starts again with the
default width.
Many apps will not make a window narrower than some width. The layout
placed the next column as if the window had the width it was given, and
so placed it on top of the window that had not.
What the arrival module has been told, the layout picks up at the start
of the next pass: a column is never narrower than the window in it
needs, plus the padding and border around it and capped at the width of
the screen, and the columns after it are placed where it ends. A limit
only ever goes up, so that a column does not bounce between two widths,
and a stack takes the widest of its windows.
With animations off the layout asks every window that it resized what
it is, with a timeout, and places everything once more if one refused.
With animations on the animator says so when a journey ends, so a
window that refuses is noticed then as well.
The model could take the full width, fill the room that the columns in
view leave, and centre a column, but nothing called it. These commands
do, the first in the scrolling-layout family that
scrolling-layout-columns started, and the others named plainly,
center-focus to match promote-focus:
- scrolling-layout-full-width
- expand
- center-focus
Each is about the container that has focus now, even if focus moved
since the last layout, and does nothing until there is a strip, or in
another layout. A column made the full width of the screen takes the
gaps into account, so that it fills the screen exactly. expand makes the
focused column as wide as it can be without moving another column out of
view, which is the full width of the screen when it is the only one in
view or when the focused column is always centred, and does nothing when
there is no room.
Nothing changes in the shared layouts crate, so Windows is not affected.
retile already forgot the resize adjustments of the layouts that are
made of splits, and the widths of the columns of the Scrolling layout
are the same kind of thing. The focused workspace of each monitor
gets its columns back to what scrolling-layout-columns gives, and the
focused column stays where it is unless it has to scroll.
The variant of retile that keeps resize dimensions keeps the widths.
A window whose top-left corner is past the left edge of the screen is
on no display, as far as CGGetDisplaysWithPoint is concerned. Looking
the display up from the corner then found nothing, and hide, the
scrolling rest and the slide back in all skipped the window without a
word. The Scrolling layout lets a column overhang the left edge, so a
column that scrolled out of view that way stayed on screen, and so did
a window of a workspace that was left while it overhung.
A workspace now takes the display from its monitor and hands it down
to Container::hide and Window::hide_on, and arrange_scrolling hands
it to hide_scrolling. A window that is parked remembers the display it
was parked on, so sliding it back in no longer looks at its target.
The lookup by position stays for callers that have no monitor, and is
total: the display under the corner when there is one, otherwise the
display with the most overlap, otherwise the nearest, and the main
display when the system reports none. Not finding a display to hide a
window on is logged as a warning, and which rest a window gets is
logged at trace.
Add a page on the Scrolling layout: how column widths work, when the
screen scrolls, what closing a window focuses, how resizing works, where
windows that are out of view go and why, and what is not done yet.
The Scrolling layout no longer shares the screen between however many
windows there are until `columns` of them exist. The count is how many
columns fit across the screen, which is how wide a new column is, so the
help says that, and not that it is the number of visible columns.
Closing a window moved focus to the container on its left, whatever had
focus and wherever the window was. A strip of columns knows better.
Focus goes back to the column that the closed one was opened next to,
with the viewport as it was, if nothing has moved focus since. Otherwise
it goes to the column that takes the closed one's place on the right. A
window that is closed without having focus no longer takes focus with
it.
The strip is told what there is just before the container goes, so that
it can answer. A workspace that has not laid out a strip yet moves focus
left as before.
A window that scrolled out of view in the Scrolling layout used to be sent
to a corner of the screen and hidden there. It now comes to rest at the
edge of the screen that it left by, with a sliver of it on screen, and
keeps its size and its height up the screen. Bringing it back is then a
matter of moving it, and it never has to be resized.
With animations on the window slides there and stays, where it used to
carry on into the corner. With animations off it is moved there at once,
so the layout behaves the same either way. Where the edge is next to
another display, and the window would be seen on it, it is still hidden
in the corner.
The marker that says a window is out of the way is now also cleared when
a window is put back without animating it. Only sliding a window in
cleared it, which was enough only while nothing set the marker unless
animations were on.
The Scrolling layout is now laid out by komorebi-scrolling instead of by
the layouts crate. A workspace in that layout keeps a ScrollingSpace next
to its containers, makes it match the containers and the focus whenever
the layout is calculated, and takes the rectangles from it. As a result:
- a window that opens gets the width of a column and no other column
changes width, where every column used to be resized to share the
viewport until there were as many as `columns`
- focusing a column that is already in view does not scroll the strip
- a column that has been resized keeps its width as windows come and go
- columns that were never resized follow the `columns` option, so
changing it, or crossing a threshold of layout_options_rules, still
lays them out again
Resizing changes the width of the focused column, by half of the delta
per edge as the other layouts do. A strip has no heights, so resizing a
height does nothing.
Windows that are partly in view keep their size and overhang the edge of
the screen, unless that would show them on another display, where they
are clamped to the work area as before.
What needs a Workspace is in the scrolling module, and what does not is
in komorebi_layouts::scrolling, which the model comes through. What only
the old Scrolling layout needed goes: the percentage override in
update(), laying the strip out again without resize adjustments in
hide(), the resize constraints, and the feedback of the unclamped
layout.
komorebi-layouts now carries the platform-free half of the Scrolling
layout: the model of a strip of columns, re-exported as
komorebi_layouts::scrolling::model, and what a host needs around it,
which is the layout options for the model, the placement of containers
in a work area, resizing a column or a tile, and the hand-over of column
records between workspaces.
The center_focused_column layout option of the Scrolling layout is one
of Never, Always and OnOverflow there, and a boolean is still read as
true for Always and false for Never. The two places here that said true
say Always, and the schema and the options for nix say so.
This is the revision of the feature/moar-scrolling branch of komorebi
that has them. It is pinned by revision until the branch is merged, and
komorebi-themes moves with it so that the repository is fetched once.
komorebi-scrolling has no license field, so deny.toml clarifies it as it
does the other crates of that repository.
The command only set the column count when the workspace had no layout
options at all, or already had scrolling options. A workspace with
options for something else (column_ratios, say) and no scrolling options
matched the second arm and was left unchanged, so the command silently
did nothing.
Move the logic to Workspace::set_scrolling_columns, which creates the
scrolling options when they are missing and keeps every other option,
and test all three cases.
The Scrolling layout works out which column is first in view from the
layout it produced last time. Workspace::update stored that layout after
clamping it to the work area, which pulls every off-screen column onto
the left edge, so the previous view always read as starting at column 0.
Once more windows were open than fit on screen, focusing left shifted the
whole strip by a column on every step instead of leaving it where it was.
Keep the layout as the algorithm produced it and feed that back for
Scrolling, both in Workspace::update and in resize_window. The clamp
becomes a function of its own so that the regression test runs the same
code as update().
An app is free to refuse a size, and many do: a window that will not get
narrower than some width stays that wide however it is asked. The animator is
the first to find out, when it looks at a window after a journey, and until now
it only re-sent the size and moved on, so a layout that places the next column
as if the window had the width it was given places it on top of the window that
did not.
The arrival module is new here. It is where whatever finds out that a window is
wider than it was told to be says so, from any thread and without the lock of
the window manager, for a layout to pick up the next time that it runs.
Say what every verification found to it, which keeps the windows that
turned out wider than they were told to be for the layout to pick up, and
forgets those that have taken their size since, so it is said every time and
whatever the answer. That includes the last attempt, where the window is looked
at again after it was last told to take its size, as nothing verifies it after
that and the attempts are given up on.
This is said from where the frame is read, not carried out of the state machine,
which has no business with anything global.
take_unfinished only knew about a journey that was to go on to somewhere else
afterwards and never got there. A window that slides out of view in the
Scrolling layout rests where it slid to and has nowhere to go afterwards, so a
slide that was cut short went unnoticed, and the window was left partly in view.
Count every journey that ends other than by the window being found where it was
sent: one that was grabbed or taken over, given up on because the app stopped
answering or the window was gone, or that never got to where it was sent in the
verifications that follow. A journey that settles is not cut short, and nobody
has to ask for the news to be kept within bounds.
Describe the duration, style and fps options, per-animation settings, and what
to expect from the animator: windows stay in step with each other, apps that are
slow to resize are sent sizes less often, and a window that is grabbed is let
go of.
Windows that scroll out of view were hidden with an instant jump to a corner of
the screen, and animated back in diagonally across it. With animations on, slide
them out sideways to the edge of the screen they left by, at the same height,
and park them in the corner once they are out of sight; and put a parked window
back at that edge before it slides in, so that it comes from where it left.
Windows that would be seen on a neighbouring display on the way fall back to the
instant hide, and a window that is stopped on its way out is hidden again rather
than left in view.
Without animations nothing changes.
hide, restore and the direct position and size writers wrote to a window while
an animation thread kept writing frames to it. Take the window over first, which
stops its animation and waits for what is already on its way to land, so that it
cannot land on top of what the caller writes next.
A window that is hidden while it is on its way somewhere is now restored to
where it was going, rather than to wherever it happened to be at the time.
The moves and resizes the animator makes are reported back to us like any
others. They used to be avoided by removing and re-adding the AX observers
around every animation, which cost four AX calls a window and still let some
through. Recognise them instead: a notification for any window of an app we are
moving, or have moved in the last 300ms, is an echo and is swallowed. With the
mouse down it is only taken for somebody grabbing the window, and the animation
let go of, if the window's origin is nowhere we put it, so that apps which snap
or clamp their size are not mistaken for a drag.
Once an app has had a window animated, the move and resize notifications that
arrive while the mouse is up are also throttled per window, so that an app that
will not stop reporting cannot fill the event channel and cost the window
manager real events such as focus changes.
Borders no longer ask a window where it is while it is being animated, as the
animator moves them. A drag cancels the animation of the window being dragged,
and what is known about a process is forgotten when it terminates, as a new
process may be given the same id.
Every animated window used to get a thread of its own that slept between frames,
so neighbouring windows moved out of step, a retarget had to wait for the old
thread to notice (a 125ms poll), every frame wrote both the position and the
size, and the app-side animation guard was applied to the window element, where
AXEnhancedUserInterface does not live, instead of the application element.
Move windows with the animator instead, and remove the thread-per-window engine
and the render dispatcher. Stacking operations suspend animations with a guard
instead of swapping the global flag, which was left off for good if the
operation failed, and the animator is shut down before the daemon puts every
window back where it found it.
The configuration is untouched: enabled, duration, style and fps, global or per
animation, are read exactly as before, and nothing is added to it. An fps of 0
no longer panics.
Run the state machine on one frame thread that steps every animated window on
the same clock, and hand the writes to a lane per app, which make them side by
side. The frame thread never talks to an app, and a frame is only started once
the last has been applied to every moving window, so that neighbouring windows
stay on the same frame and the gaps between them do not open and close. An app
that takes longer than a frame is not waited for.
Also expose the pieces the window manager needs around it: animation::motion_for
to read the configured duration and style for a kind of animation, and
animation::suspend to skip animations for as long as an operation runs, which
unlike turning the global setting off and on again puts everything back when the
operation fails part of the way through.
Nothing uses it yet.
Borders follow a window through their own AX observer, which asks the window
where it is over AX on the main thread for every notification, so a border lags
a window that is being moved a frame at a time. Add a way to hand a border the
frame a window has just been moved to instead, batched onto the main thread
once per turn with only the latest frame of each window applied.
The border state is held by the border thread while it creates borders, which
it does by waiting for the main thread, so it is only ever tried, never waited
for, from there; frames that find it busy are put back and tried again.
An app that moves its own windows, or is moved faster than it can report, can
send a notification for every frame, and the window manager's event channel is
small. throttle lets one through per window per interval. stats keeps just
enough of how an animation burst went to answer why it felt slow from the log:
how regular the frames were, and how long the apps took to apply them.
Keep the bookkeeping of an animation free of threads, clocks and macOS APIs, so
that it can be tested with a fake clock. step holds the maths, and tracks knows
which windows are in flight, where each is, where it is going, and what has to
be written to it next, in whole-frame steps that are handed back as commits for
a runtime to carry out:
- retargeting a window overwrites its target and carries on from where it is
- only the dimension that changed is written, and an app that is slow to apply
a size is sent them less often, so that it keeps moving in between
- where a window was last put is remembered, so that a window can be animated
without asking it where it is
- a finished window is verified, and re-sent if the app ignored the move
- work that is never reported on is given up on after a few seconds
- the notifications our own writes cause are recognised as echoes, by window
and by process, unless the mouse is down and the window's origin is nowhere
we put it, in which case somebody has grabbed it
AXEnhancedUserInterface makes an app animate every move and resize it is asked
to make over AX. It belongs to the application element, not to a window, and it
is shared by all of an application's windows, so turning it off has to be
reference counted per process, with the last window to finish putting it back.
Almost no app has it on, so an app that has been seen not to is left alone for
a while without being asked again.
Also add a messaging timeout helper, so that an app that has hung cannot hold a
caller for several seconds, and expose the application's own element.
notify_on_error needed a whole Window to decide whether a failed write meant
that the window was gone, but only used its id and its element. The tabbed
application check was also subsumed by the validity check that follows it: a
window whose element still answers is never reaped. Add notify_if_gone, which
takes just the id and the element, for writers that do not have a Window,
and have notify_on_error call it.
Workspace::update asked every window where it was, which is a round trip to
the app that owns it, before deciding what to do with it. The answer only
matters for a window that the layout would put entirely out of view, so ask
only then.
Bring the generated files back in line with the code on master.
- schema.json: add monocle_focus_behaviour and the MonocleFocusBehaviour
definition. schema.asc.json and schema.bar.json were already current.
- nix/komorebi-options.nix: add the monocle_focus_behaviour option.
nix/komorebi-bar-options.nix was already current.
- docs/cli: add the pages for layout-ratios, monocle-focus-behaviour,
permissions and toggle-monocle-focus-behaviour. Update 19 pages for
the --bar flag of enable-autostart, the per-value help of enum
arguments and reworded help text. Re-wrap 4 pages whose text did not
change.
How the files were made:
- schemars-nixgen writes the properties of an object in a different
order on every run, so the files are not regenerated whole. Only the
new option is added; the rest of a full run was checked to be the same
lines in another order.
- docgen on master writes a bare fence with no heading and "Usage: name",
where the pages in docs/cli have a "# name" heading and "Usage:
komorebic name". The pages keep the format they have.
- Pages are wrapped at 100 columns, the width docgen uses when it does
not write to a terminal, instead of the width of the terminal the old
pages were made in.
komorebi focuses one window of an application next to another of its
windows, and the application can be slow to say that window is the one
focused, or not say it at all. The border was decided on what the window
server reported, still the other window, so the focused window had none.
Count the window in the focused container as the one with the focus when
the window the window server reports is another window of the same
application that komorebi manages. The decision is a function with tests,
and the border manager traces what it decided for each container.
An application that comes to the front names its main window, which is
not necessarily the one komorebi focused. When it is another of the
application's windows, komorebi took it as a request to go there:
- parked on another workspace, the workspace reconciliator switched to
that workspace, so a focus command between windows of one application
changed workspace;
- beside the focused window on the workspace that is showing, its
container took the focus back, so the window komorebi had just focused
lost it.
Do neither when the notification is the application coming to the front
and one of its windows is the focused one here. Choosing a window of the
application is said with AXMainWindowChanged and is still followed. The
decisions are functions with tests.
Closing a laptop lid with an external display attached swaps one display
for another, so the monitor count is unchanged and the reconciliator
logged "reconciliation not required" while komorebi kept laying windows
out on the old display's work area. Compare the serial numbers as well as
the count and hand the unplugged monitor's workspaces to the display that
took its place.
The workspaces that are not showing kept the work area of the old display
too, so they were put away on a display that was gone and their windows
stayed in view. Refresh the work area of every workspace before putting
them away, and let a window that cannot be hidden not leave the ones
after it in view.
Resize notifications matched monitors by display id, which changes when a
display is reconnected, so they never updated anything and then re-laid
out the focused workspace once per device. Match by serial number, and
only re-lay out when a known monitor changed.
When an application on a hidden workspace came to the front, its focus
was not followed to its workspace, and when it was, the window that came
to the front was not the one that ended up focused.
Follow the notification to its window when the application has no main
window to ask for, say when that was needed, and focus the container of
that window before the reconciliator loads the workspace, instead of
the one the workspace last had focused. The stale focus check then
agrees with where focus went.
A notification that an application came to the front is not followed
while another application is in front. That is right when komorebi has
since moved on to another, and it is also all there is to see when the
window server refused to bring the application to the front at all, in
which case focus moves in komorebi and nowhere else. At debug level it
was left out of the log by default, so the only trace of that refusal
was in the OS log. Make it a warning.
Focusing a window activated its application with NSRunningApplication,
which from a background process reaches the window server as a request
stamped with the time komorebi started. Once the user has typed or
clicked since, the window server turns it away as expired ("Rejecting
expired request") and the application that was in front stays there:
focus moves in komorebi, the border, which only marks the window that
has the keyboard, stays unfocused, and the keys keep going to the
terminal that `komorebic focus` was run from.
Ask the window server directly first, with the request marked as the
user's, which is what clicking a window does. The two private symbols
it takes are looked up when first wanted and not linked, so that macOS
taking one away leaves komorebi starting and focusing as it did, with
one warning. A window server that refuses three times in a row is not
asked again, and a process without a serial number is left to the
usual way without counting against it.
Switching workspace hides the windows of the others and restores the
windows of the one that is wanted, one window at a time, each through
the accessibility API and each as slow as the app it belongs to. The
handler took 260 to 430 ms in a recording, and frames taken in the
middle of it show both workspaces on screen together: with Zed and Zen
gone, two WezTerm windows from the old workspace still up and Beeper
and Discord from the new one not there yet.
Workspace::update already batches its window moves with SLSDisableUpdate
and SLSReenableUpdate so that they appear together. Hiding and restoring
did not. BatchedUpdates holds the screen back until it is dropped, which
an early return does too, so an error cannot leave it frozen, and
load_focused_workspace keeps one for the hiding and the restoring. The
wallpaper, which can generate a theme, is put up after it is dropped,
which is why Workspace::restore is split into the windows and the
wallpaper. restore does what it did.
The screen does not change at all for as long as it is held, which is
now the length of the switch. How the private SkyLight calls behave
when it is held for that long, and whether it is long enough to notice,
was not tried on a screen.
komorebi brings an app to the front with activateWithOptions and then
hears about it from NSWorkspace and the accessibility API some time
later, 0.8 to 1.7 s in a recording, by which time it has often brought
another app to the front. The FocusChange handler took every such
notification at its word, which had two effects:
- focus moved back to the app that had had it, so Left, Left landed on
the window in between rather than the one two along
- the app of a window on a workspace that is not showing made the
workspace reconciliator switch to that workspace, which undid a
workspace change that had been asked for a moment earlier
The handler now asks which app is in front and does not follow a
notification about any other. The last notification that is followed
is always about the app that really is in front, so the state ends up
where the system is. Notifications about an app that is not in front
still go through the rest of the handler, and nothing is ignored when
the accessibility API will not say what is in front.
Found in a recording of the installed build at db1c18b. That the
notifications are late and that the OS front process had moved on was
read off the OS trace; the change itself is tested only for the
decision, and was not tried on a screen.
Dragging a tile's edge was unreliable: long drags were dropped, the
divider next to a different window drifted by a few points, and in
recordings made with komorebi-recorder a drag to the left shrank the tile
instead of growing it. This fixes the causes that were found there.
Resize bounds: bump komorebi-layouts and komorebi-themes to
LGUG2Z/komorebi@f08aa55, where DefaultLayout::resize only accumulates and
no longer refuses any adjustment larger than half of the container's own
size. resize_window now grants the largest amount that keeps every tile
at least a tenth of the work area (or as large as it already is), found
by bisection, instead of all or nothing. Keyboard resizing goes through
the same path. RUSTSEC-2024-0449 is ignored in deny.toml, as upstream
does in the same bump.
The dragged container: ResizeStart records the rect of the dragged window
once, since AXWindowResized fires again all through a drag, and ResizeEnd
hands it to the new WindowManager::resize_by_drag along with the rect the
window ended in. That resizes the container of the dragged window instead
of the focused one, for each edge that moved, instead of guessing the
edges from the difference to latest_layout (which made apps that snap to
a grid of cells resize edges that nobody touched).
Where the drag began: AXWindowResized is first reported after the edge
has moved, and handlers run one at a time, so the rect recorded as the
start can already be 22 points into the drag, or be the rect the drag
ended in. An edge that ended up more than 32 points from its tile is
measured from its tile edge; every other edge from the recorded start.
The reaper: it re-tiled the focused workspace on every mouse-up and
key-up to find windows that had gone away. That ran as soon as the button
went up, ahead of the ResizeEnd queued behind slower handlers, so the
window was back on its tile when ResizeEnd read where it had been dropped
and the drag was measured backwards. It now only looks for windows that
no longer exist and reaps them, without moving any window.
The tests reproduce each of these, including the numbers from the
recordings: a first step of 22 points, a drag already over when it was
first seen, and a mouse-up that must leave the layout alone.
LGUG2Z/komorebi@5f629e1 made directional focus cycle the monocle
container in the underlying ring. Useful on a single monitor, but
undesired when focusing across monitors — the focus stays trapped on the
monocle workspace instead of crossing the boundary.
This commit adds a new top-level monocle_focus_behaviour option with two
variants, Cycle (the post-5f629e1f behaviour) and NoOp (the pre-5f629e1f
behaviour, now the default), along with a ToggleMonocleFocusBehaviour
socket message and corresponding komorebic subcommands to flip between
them at runtime.