Commit Graph
22 Commits
Author SHA1 Message Date
LGUG2Z a17a39ea3b feat(bar): add storage_display_name option
This commit implements this feature as it was added in
LGUG2Z/komorebi@c84fa50fc9.
2026-03-29 15:22:29 -07:00
LGUG2Z 5a37f6357d fix(bar): avoid bobbing when switching between populated/empty workspaces
This was debugged by Lando Calrissian on Discord who submitted this text
patch. The rest of this commit message is from Lando's investigation
summary shared on Discord:

The left panel in komorebi-bar uses `Align2::LEFT_CENTER` anchor, which
vertically centers the panel content within the bar. When switching
between workspaces with windows (icons) and empty workspaces (text
labels only), the content height differed by ~1-2px, causing the
vertical center point to shift - resulting in visible "bobbing" of the
workspace indicators.

The height inconsistency occurred because:

1. `show_icons()` wrapped content in a Frame with inner_margin
2. `show_fallback_icon()` had NO Frame wrapper
3. `show_label()` had NO Frame wrapper and used default text height

Fix:

1. Wrap `show_fallback_icon()` in the same Frame with inner_margin as
   show_icons
2. Wrap `show_label()` in the same Frame with inner_margin as show_icons
3. Add `ui.set_min_height(self.icon_size.y)` to show_label to ensure the
   label has the same minimum height as icons
4. Change show_label from static to instance method (&self) to access
   icon_size

This ensures all three rendering functions produce consistent content
height, preventing the LEFT_CENTER anchor from shifting when workspace
content changes.
2026-02-16 10:17:38 -08:00
LGUG2Z 1c699ed4c4 perf(bar): reduce cpu usage by sticking to logical pixels
This was debugged by Lando Calrissian on Discord who submitted this text
patch. The rest of this commit message is from Lando's investigation
summary shared on Discord:

Every frame, the update() method checks if egui's window rect matches
the stored size_rect. The comparison code multiplied egui's outer_rect
(which is in logical pixels) by scale_factor, producing physical pixel
values (e.g., 3584x40 on a 2x Retina display). But size_rect stores
logical pixel values (1792x20). These can never match on a HiDPI
display, so every frame:

1. `size_rect != current_rect` evaluates to `true`
2. `position_bar()` is called, sending `ViewportCommand::OuterPosition`
   and `ViewportCommand::InnerSize`
3. Each `send_viewport_cmd` internally calls `request_repaint()` in egui
4. egui schedules another frame → go to step 1

Result: 120fps continuous rendering, consuming ~12% CPU.

Debugging Method:

Instrumented the code with frame counters, FPS tracking, and repaint
cause logging. Systematically disabled components (repaint thread,
komorebi notifications, widget rendering) to isolate the cause. Traced
egui's repaint causes to context.rs:3853 (send_viewport_cmd_to), then
found the size_rect mismatch firing 1112 times in 10 seconds.

Fix:

Removed the erroneous scale_factor multiplication from the rect
comparison, since outer_rect already reports in logical pixels — the
same coordinate space as size_rect.

Result:

┌────────────┬───────────┬───────────────────┐
│   Metric   │  Before   │       After       │
├────────────┼───────────┼───────────────────┤
│ CPU (idle) │ 12-13%    │ 0.0-0.1%          │
├────────────┼───────────┼───────────────────┤
│ Frames/sec │ 120       │ ~1 (timer-driven) │
├────────────┼───────────┼───────────────────┤
│ CPU spikes │ Up to 20% │ None observed     │
└────────────┴───────────┴───────────────────┘
2026-02-16 10:13:15 -08:00
LGUG2Z 0e120a7b35 fix(bar): remove the leaky docstring on left_widgets 2026-02-13 17:03:55 -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 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 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 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 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 f6bfae3103 docs(schema): avoid duplicating display format enums in bar
This commit also addresses some clippy warnings.
2025-12-23 17:07:56 -08:00
LGUG2Z 1e71cb7d92 docs(schema): publish versioned schema docs to lgug2z.com 2025-12-23 12:00:13 -08:00
LGUG2Z 1cb3327395 chore(deps): bump schemars to 1.1 and netdev to 0.40 2025-12-21 10:00:55 -08:00
LGUG2Z a03c466eed fix(bar): update the network widget in a separate thread
This commit was originally contributed as faed6ec by LGUG2Z/komorebi by
@CtByte

This commit changes the way how the default interface and network
activity is loaded by spawning a new thread on each request. This way
the main thread is not blocked by this process.

There has been instances where getting the default interface blocked the
egui ui thread, resulting in a frozen bar.
2025-11-23 11:31:24 -08:00
LGUG2Z 21321fd365 fix(bar): match default interface by name
This commit fixes a difference between netdev on Windows and macOS,
where matching needs to be done against the Friendly Name of an
interface on Windows, but against the Name on macOS.
2025-10-14 12:52:26 -07:00
LGUG2Z 82b6247371 fix(bar): don't show komorebi-bar icon in the dock 2025-10-01 14:16:36 -07:00
LGUG2Z f5a979d4b4 fix(bar): calculate margin correctly 2025-10-01 13:55:42 -07:00
LGUG2Z 75373c2174 fix(bar): load app icons for focused window widget
This commit adds the icon path to WindowDetails and then uses that path
to look up and load the icon in komorebi-bar.
2025-10-01 11:19:43 -07:00
LGUG2Z c9eeaf3999 chore(deps): bump egui and eframe to 0.32 2025-09-30 18:50:22 -07:00
LGUG2Z c3a756cbde fix(bar): don't look up window titles at runtime
Doing runtime lookups via methods on Window in komorebi-bar won't work
because the AccessibilityObserver is not serialized and sent as part of
the notifications.

Instead, the notifications now take a snapshot of WindowDetails and
embed them so they can be read directly in komorebi-bar.
2025-09-30 15:54:15 -07:00
LGUG2Z 9777c55a1f feat(bar): migrate the komorebi-bar
This commit migrates the komorebi-bar from komorebi for Windows. Mostly
lifting and shifting code, exposing stuff we need in komorebi-client
etc.

A few widgets will need to be reworked completely so they have been
removed for now.

Mouse and command stuff also needs updating a little so that has also
been removed for now.
2025-09-30 15:14:30 -07:00