Commit Graph
3112 Commits
Author SHA1 Message Date
LGUG2Z 8b4604d47e fix(border): maintain config compat with windows opts
This commit adds a 7px border offset adjustment to the BORDER_OFFSET
value wherever it is used to maintain config compatibility with komorebi
for Windows.

Windows has stupid 7px invisible borders around every app window which
have to be taken into account when setting the values for these options,
but this is not the case on macOS.

However, if we don't replicate the factoring in of those invisible
borders into our offset calculations, the same border config on Windows
and macOS looks vastly different.
2026-01-04 19:40:40 -08:00
LGUG2Z 8805fafa99 feat(bar): make explicit monitor config optional
This commit makes the monitor configuration option for the komorebi-bar
optional, defaulting to index 0.
2026-01-04 19:15:24 -08:00
LGUG2Z 1219c3d118 refactor(bar): inline defaults in schemars attrs 2026-01-04 19:08:41 -08:00
LGUG2Z c23bf462cb feat(bar): make explicit monitor config optional
This commit makes the monitor configuration option for the komorebi-bar
optional, defaulting to index 0. Additionally, the automatic work area
adjustment has been re-enabled for displays where are not built-in
Macbook displays.
2026-01-04 14:29:21 -08:00
LGUG2Z b792328676 fix(splash): show mdm workspace tenant name instead of mdm url
The WorkspaceTenantName is populated far more consistently than MdmUrl.

This commit switches to extracting that instead and passing it on to the
MDM splash screen so that users on non-corporate devices who may have
unintentionally enrolled themselves into BYOD MDM by logging into an
account a clicking "Yes" on some dark pattern pop-up have a clear
indication of why they are seeing the splash, and can take the
appropriate steps to remove the MDM profile from their system if
desired.
2026-01-04 07:33:32 -08:00
LGUG2Z a7380db47c docs(readme): add debugging instructions for people who don't know they've been mdm'd 2026-01-04 07:15:59 -08:00
LGUG2Z 086993a7c0 fix(cli): respect --bar flag in start even when no config is resolved
I think this got broken as part of the automatic Rust version syntax
upgrades which joined two if clauses together with && which should have
been kept separate.

Now, if the user gives the --bar flag to the start command, and a static
config file is not resolved, or if the static config file does not have
a bar_configurations stanza, it will fallthrough to the default
PowerShell snippet to try and start komorebi-bar without an explicit
--config flag.
2026-01-03 16:55:59 -08:00
LGUG2Z aac1e9ecf2 build(just): start using vararg build/install target variants 2026-01-03 11:39:26 -08:00
LGUG2Z 41001da1f0 refactor(bar): inline defaults in schemars attrs 2026-01-03 11:30:40 -08:00
LGUG2Z ca94a57dd5 feat(bar): render at notch level on macbooks
This commit uses raw-window-handle to access the NSWindow of the bar and
set the window level to `kCGBackstopMenuLevel` (-20), positioning the
bar behind the menu bar, and at the same level as the notch on Macbook
screens.

This approach means the bar occupies space already excluded from the
work area by the menu bar, so the automatic work area offset calculation
is no longer needed and has been commented out. (I think... Need to
validate this on regular non-Macbook external displays...)

The explicit user-configured `work_area_offset` option is preserved for
users who want more flexibility.
2026-01-03 10:13:17 -08:00
LGUG2Z 6b52e4b3a4 fix(wm): treat empty titles as unmanageable
Some apps like Raycast do dumb stuff like reporting empty strings as
titles to the system. If your app doesn't have a title, don't give it an
empty string as a title!

This commit adds an explicit string emptiness check on titles when
evaluating windows for management eligibility.
2026-01-02 15:19:14 -08:00
LGUG2Z 88a04c2078 feat(config): expose opts for titleless and tabbed applications
This commit exposes configs for titleless (i.e. MS Edge installed apps)
and tabbed (i.e. Ghostty) applications. Ghostty is no longer hard coded
as a tabbed application and should be added via config.
2026-01-02 10:21:46 -08:00
LGUG2Z 8e6aa34bbf fix(animation): disable on stacking operations
This commit disables animations on stacking operations because it's just
too much of a headache. Additionally, the borders get screwed up
sometimes on unstacking, so we'll just go nuclear and destroy and
recreate them on an unstack or unstack-all op.
2026-01-01 16:22:10 -08:00
LGUG2Z 64ee9b6e0d fix(wm): consider window count when calculating scrolling column width
This commit fixes the stupidest of stupid bugs. Column width
calculations on the Scrolling layout should take the number of windows
into account, especially when lower than the configured column count.
2026-01-01 16:10:02 -08:00
LGUG2Z 8f542b6c3b fix(wm): ensure tabbed apps are known in monocle mode
This commit ensures that we detect tabbed applications appropriately
when they are in monocle mode when handling FocusChange so that
switching tabs doesn't break monocle mode or the layout it has been
toggled on from.
2026-01-01 16:10:02 -08:00
LGUG2Z 3a7758cd60 fix(wm): preserve active tab when focusing tabbed applications
This commit ensures that when focusing back to a tabbed application, we
use the current main window element instead of the stored element which
may point to a stale tab, and we also update the stored window element
when the user switches tabs, so that borders can update correctly.
2026-01-01 16:09:59 -08:00
LGUG2Z 51e1337f40 fix(wm): consider window count when calculating scrolling column width
This commit fixes the stupidest of stupid bugs. Column width
calculations on the Scrolling layout should take the number of windows
into account, especially when lower than the configured column count.
2026-01-01 13:07:18 -08:00
LGUG2Z f46fe659ac chore(deps): cargo update 2025-12-31 18:44:14 -08:00
LGUG2Z 9b6b86cdea fix(wm): send manual move/resize end events on mouse release
The Acessibility API does not reliably fire AXWindowMoved and
AXWindowResized notifications after the mouse button is released,
causing drag-to-swap and drag-to-resize operations to fail.

This sends manual MoveEnd and ResizeEnd events from the input
event listener when LeftMouseUp is detected, ensuring these
operations complete reliably.

Resizing windows while dragging doesn't really work and has been noted
in the known-issues.md file.
2025-12-31 18:41:44 -08:00
LGUG2Z 05cd7832e8 fix(wm): process notifications from destroyed windows
When closing a window with CMD+W, the AXUIElementDestroyed notification
has an empty title. We need to add an is_destroyed override for these
AXUIElementDestroyed notifications without a title so that they can be
processed.

This commit also fixes a race condition exposed by the above fix where
the reaper thread sometimes removes the window before the reap function
tries to remove it during event processing. When this happens, we can
just ignore the error and continue instead of propagating it up and
interrupting the event processing loop until the user's next manual
interaction with another window.
2025-12-31 16:13:24 -08:00
LGUG2Z 6cef8d9ef6 refactor(schema): simplify defaults in static_config 2025-12-31 13:04:34 -08:00
LGUG2Z 49bdf41bfc refactor(schema): simplify defaults in static_config 2025-12-31 12:38:37 -08:00
LGUG2Z 6e36b81669 build(nix): add flake.nix for cross-compilation from darwin and linux
I was getting really tired of having to switch between display inputs to
different platform-specific machines to be able to make and test changes
on komorebi for Windows and komorebi for Mac.

With this commit, the `flake.nix` provides a Nix devShell and crane
build for users to make and validate changes with `cargo check`, `cargo
clippy` and `cargo build` with the Windows MSVC toolchain on Linux and
macOS.
2025-12-28 17:24:41 -08:00
LGUG2Z 27454c3186 refactor(config): pull theme structs from komorebi-themes
Centralized both KomorebiTheme and KomobarTheme in the komorebi-themes
module in komorebi for Windows.

This commit removes the duplicated references in komorebi for Mac and
just pulls in those; now we only have to update the docs in one place.

Regenerated all the schemas after pulling in the changes.
2025-12-27 22:24:07 -08:00
LGUG2Z 0758c7d900 refactor(theme): centralize theme-related code in komorebi-themes
Getting tired of making little changes in both this and the komorebi for
Mac repo - I think eventually either komorebi-themes will live in its
own repo or komorebi for Mac will be integrated here.

But for now, at least everything is defined in komorebi-themes and I
don't have to redefine any theme-related stuff in komorebi for Mac.
2025-12-27 21:58:39 -08:00
LGUG2Z f77a303b30 docs(schema): ensure every enum variant has a renderable title 2025-12-27 20:34:31 -08:00
LGUG2Z ff8c852e62 docs(schema): ensure every enum variant has a renderable title 2025-12-27 20:07:17 -08:00
LGUG2Z b421043494 docs(schema): ensure all public-facing bar config opts have docstrings 2025-12-27 14:46:29 -08:00
LGUG2Z 93bdb327f0 chore(deps): bump komorebi-themes and regen docs 2025-12-27 13:45:59 -08:00
LGUG2Z 3a81f7babb docs(schema): ensure all public-facing bar config opts have docstrings 2025-12-27 13:40:45 -08:00
LGUG2Z 3d8778a7d6 docs(schema): ensure all public-facing static config opts have docstrings 2025-12-27 12:58:46 -08:00
LGUG2Z 73ca25500b docs(config): ensure all public-facing static config opts have docstrings 2025-12-26 21:29:05 -08:00
LGUG2Z a42e809ade docs(config): encode defaults of unwrapped options into schema
This commit ensures that the various default values that the different
Option<T> config properties can be unwrapped to are encoded by schemars
so that they can be picked up by docgen.
2025-12-26 18:16:55 -08:00
LGUG2Z f290c7e037 docs(config): encode defaults of unwrapped options into schema
This commit ensures that the various default values that the different
Option<T> config properties can be unwrapped to are encoded by schemars
so that they can be picked up by docgen and nixgen.
2025-12-26 15:19:33 -08:00
LGUG2Z 4e66b46e87 docs(schema): clean up unused schema opts from windows
This commit removes some Windows-only schema opts from StaticConfig and
updates the justfile to start generating content for the new Starlight
documentation site.
2025-12-26 11:02:47 -08:00
LGUG2Z 66c5766848 feat(cli): add custom output fir for docgen cmd 2025-12-26 10:26:00 -08:00
LGUG2Z 49ac638d4e feat(cli): add custom output dir for docgen cmd 2025-12-26 09:21:48 -08:00
LGUG2Z a26728ab19 build(nix): add cargo-udeps and cargo-outdated to devshell 2025-12-24 17:20:19 -08:00
LGUG2Z 7763d679a5 feat(nixgen): initial implementation of schemars-nixgen
This crate converts JSON Schema (as generated by schemars) into
strongly-typed Nix option definitions for the NixOS module system.

The primary motivation was to generate NixOS module options for komorebi
and komorebi-bar configurations, allowing users to write type-checked
Nix configurations that map directly to the JSON config files expected
by those applications.

Some high level notes on the implementation:

* Handles all common JSON Schema patterns including primitives, arrays,
  objects, enums, refs, oneOf/anyOf/allOf, and nullable types
* Detects and correctly generates externally-tagged unions (Rust's
  default serde enum representation) as submodules with optional fields
* Detects internally-tagged unions and mixed enum+object unions
* Generates let bindings for frequently-used type definitions to avoid
  repetition in the output (e.g., large enums like Base16Value)
* Uses topological sorting to generate type bindings in dependency order,
  ensuring nested refs are deduplicated correctly
* Handles patternProperties for index-based configuration patterns
2025-12-24 17:20:16 -08:00
LGUG2Z b51eb8aab2 feat(nix): add nix-darwin module
This commit adds a nix-darwin module for komorebi and komorebi-bar,
exposed via `darwinModules.default` and `darwinModules.komorebi`.

The module provides the following options:

* `services.komorebi.enable`: enables the komorebi launchd agent
* `services.komorebi.config`: typed Nix configuration (defaults to example
  config)
* `services.komorebi.configFile`: path to a JSON config file (validated
  against schema)
* `services.komorebi.logLevel`: log verbosity level
* `services.komorebi.applicationSpecificConfiguration`: fetches
  app-specific configs from remote GitHub repositories at pinned
  revisions

* `services.komorebi-bar.enable`: enables komorebi-bar launchd agent(s)
* `services.komorebi-bar.bars.<name>`: named bar instances, one per
  monitor
* `services.komorebi-bar.bars.<name>.config`: typed Nix configuration per
  bar
* `services.komorebi-bar.bars.<name>.configFile`: path to a JSON config
  file per bar

The applicationSpecificConfiguration option supports multiple sources,
allowing users to combine the upstream default from
LGUG2Z/komorebi-application-specific-configuration with their own
personal overrides from other repositories.

When configFile is specified, the JSON file is validated against the
flake's version of the schema before being passed to the binary.

A new flake check, `darwin-module-validation`, validates the module
options and exercises the configFile validation against the example
JSON files loaded into `komorebic` for the `quickstart` cmd.
2025-12-24 17:18:44 -08:00
LGUG2Z 23aca28267 build(nix): add generated module opts and validation
This commit adds NixOS module option generation for komorebi and
komorebi-bar configurations, along with a nix and JSONSchema validation
test harness that runs as part of `nix flake check`.

`schemars-nixgen` (same as `schemars-docgen`, not sure if I'm gonna
release this...) generates strongly-typed Nix option definitions from
the generated JSONSchema files, allowing users to write type-checked Nix
configurations that map directly to the config files.

This will eventually be plugged into a nix-darwin module which I have
yet to start writing.
2025-12-24 17:18:41 -08:00
LGUG2Z 6c575126ad perf(animation): hide scrolling windows to nearest edge
This commit improves the scrolling layout animation by dynamically
choosing the window hiding position based on which side of the viewport
the window is scrolling out of.

Previously, all hidden windows went to the same corner (based on the
global window_hiding_position setting), causing jarring animations when
windows scrolled back into view from the opposite side of the screen.

Now windows scrolling off the left edge hide to the bottom-left, and
windows scrolling off the right edge hide to the bottom-right. This
ensures windows animate back in from the side they scrolled out to.
2025-12-24 08:53:20 -08:00
LGUG2Z 39749acd84 chore(deps): update dependencies.json 2025-12-24 08:36:22 -08:00
LGUG2Z b922dc3faa refactor(nix): bring shell directly into flake and pin cargo 2025-12-24 08:36:18 -08:00
LGUG2Z 6a7836067b chore(deps): cargo update 2025-12-23 20:19:57 -08:00
LGUG2Z a56f2b42d4 docs(schema): remove custom layout and stackbar refs
This commit removes references to custom layouts and the stackbar as
these are end-of-life komorebi for Windows features which are not being
ported.
2025-12-23 20:07:46 -08:00
LGUG2Z a8a8c2dade perf(animation): suppress observer notifications during animations
This commit prevents the event channel from being flooded with
AXWindowMoved and AXWindowResized notifications during window
animations.

Previously, every frame of an animation would trigger macOS
accessibility notifications, which were then converted to MoveEnd and
ResizeEnd events. With a 60 FPS animation, this meant ~15 events per
window per animation, quickly filling the bounded channel (capacity 20)
and causing "channel is full; dropping notification" warnings.

The fix removes kAXWindowMovedNotification and kAXWindowResizedNotification
from the window's observer in pre_render() before the animation starts,
then restores them in post_render() after the animation completes. This
stops notifications at the source rather than filtering them later.
2025-12-23 20:07:40 -08:00
LGUG2Z af77e2c944 perf(deps): minimize objc2 cargo features to reduce build time
This commit optimizes the objc2 dependency tree by disabling default
features and enabling only the minimal set of features actually used
by the codebase. This reduces compilation time and dependency bloat.

I was meant to do this earlier but during the initial implementation it was
easier to just pull in everything. Now that we are getting ready for a public
release it's time to improve on this.

I ended up:

* Removing unused direct dependencies:
  - objc2-core-services
  - objc2-core-video

* Setting `default-features = false` on all objc2 crates and added only
  the specific features required for the types and methods used

* Updating objc2, objc2-app-kit, objc2-foundation,
  objc2-application-services, objc2-core-foundation, objc2-core-graphics,
  and objc2-quartz-core with minimal feature sets

After all those changes, the following transitive dependencies are no longer
pulled in: objc2-metal, objc2-core-image, objc2-core-data, objc2-cloud-kit,
objc2-core-text, and loads of unused Foundation/AppKit class bindings.

Some before and after numbers:

| Metric                          | Before  | After   | Change   |
|---------------------------------|---------|---------|----------|
| objc2 dep lines (komorebi)      | 84      | 50      | -40.5%   |
| objc2 dep lines (komorebi-bar)  | 91      | 59      | -35.2%   |
| Dependency tree (komorebi)      | 973     | 917     | -5.8%    |
| Dependency tree (komorebi-bar)  | 1181    | 1131    | -4.2%    |
| Clean build time                | 3m 05s  | 2m 21s  | -23.8%   |

The almost 24% reduction in clean build time is a big win!
2025-12-23 19:38:11 -08:00
LGUG2Z f42457e2e8 feat(animation): add window movement animations
This commit adds window movement animations to komorebi for macOS,
maintaining configuration API compatibility with komorebi for Windows.

The animation system is adapted from the Windows implementation but uses
macOS-specific APIs for screen update batching and accessibility
control, and borrows heavily from the implementation details of
animations in rift.

In order to have decent performance, there are some calls to private
APIS. For this reason, the animation feature will be marked as "UNSAFE".

UNSAFE features should be expected to break between major operating
system updates, and depending on which way I want to go, may only
support one major macOS version at a time (i.e. they will not have a
backwards compatibility guarantee with previous versions of macOS).

This currently look awful when used with the Scrolling layout, but looks
relatively good with other layouts. As with Windows, the animations
when two windows of very different sizes change position aren't great.

Some high level notes on the implementation:

* Uses the private SkyLight framework for screen update batching via
  SLSDisableUpdate/SLSReenableUpdate - these APIs prevent visual flicker
  by compositing all window position changes at once rather than updating
  each window individually during layout operations
* AnimationEngine runs animations in background threads with frame-based
  timing, supporting cancellation when new animations are triggered for
  the same window
* MovementRenderDispatcher implements the RenderDispatcher trait to
  interpolate window positions using configurable easing functions
* All 30+ easing styles from the Windows implementation are supported,
  including standard CSS-style functions and CubicBezier for custom curves
* Enhanced User Interface (AXEnhancedUserInterface) is temporarily
  disabled during window positioning operations for better performance
* The Transparency animation prefix is not supported on macOS as there
  is no equivalent to the Win32 transparency feature

This feature is off-by-default and can be enabled in the static config
or via komorebic commands (animation, animation-duration, animation-fps,
animation-style).
2025-12-23 19:04:33 -08:00
LGUG2Z ac56590791 chore(clippy): address warnings 2025-12-23 17:19:00 -08:00