Commit Graph
3112 Commits
Author SHA1 Message Date
LGUG2Z 34beecdb22 feat(wm): migrate asc and config generation primitives 2025-09-21 17:28:33 -07:00
LGUG2Z 8b9b578217 feat(wm): enrich window with info needed for rules
This commit enriches the Window struct with functions that we'll need to
be able to fetch the relevant information to implement matching rules.
2025-09-21 16:04:12 -07:00
LGUG2Z d5919112d9 feat(wm): add reaper and input event listener
This commit adds a reaper module which gets notified whenever an
AXUIElement is invalid (so far this is notified when a set_position call
on a Window fails), and an input event listener which somewhat coarsely
emits an event whenever a mouse-up or key-up is registered.

This is to handle Apple applications like Notes and Mail which don't
fire any events at all when a window is closed.

Pretty gross. Will see if this can be improved in the future.
2025-09-21 14:53:29 -07:00
LGUG2Z c45090c5c5 feat(wm): handle monitor resizes on the main thread
Got some weird behaviour when calculating the work area offset when
resuming from sleep so I bit the bullet and added an AtomicBool flag
that gets set when we need to call into NSScreen to get the correct work
area and size after a display resizes.

The flag gets checked in the same loop on the main thread which is
checking for ctrl-c signals.
2025-09-21 10:59:02 -07:00
LGUG2Z 98616c4288 feat(wm): add display reconfiguration listener
This commit adds a display reconfiguration listener which emits
notifications to a monitor reconciliator module which operates on a
background thread.

So far I'm only handling the resize notification because I have to
change the scaling when I'm recording devlogs and I don't want to have
to restart komorebi every time I do that.
2025-09-21 10:31:24 -07:00
LGUG2Z a4bc40aa5e feat(wm): add notification center listener
This commit adds a listener for the NotificationCenter of the
SharedWorkspace, which allows us to be notified of acts like new app
creation, app termination (different from app window destruction),
application hides and application unhides, among many others.

There are a lot of the AppKit notifications which can be registered with
observers on the notification center; for now I have just modeled the
AppKitWorkspaceNotification enum which seems to hold the most
interesting notifications for our use case.

NSWorkspaceDidLaunchApplicationNotification and
NSWorkspaceDidTerminateApplicationNotification are now hooked in to the
Show and Destroy WindowManagerEvents, but I still need to think about
how to hook in the events around hiding and unhiding as these are
temporary/reversible actions which operate across multiple application
windows, unlike minimize/restore which only operate on one application
window at a time.
2025-09-21 09:22:54 -07:00
LGUG2Z 160cb7202d chore(deps): cargo update 2025-09-20 16:59:07 -07:00
Csaba 8d085df1ba fix(bar): update network interface less frequently
This commit ensures that the default interface for the network widget does not update on every render of the bar.

Some people have experienced the bar being frozen and hopefully this will remediate that issue.
2025-09-20 15:59:59 -07:00
LGUG2Z 5d48a5c5b4 chore(clippy): apply latest fixes 2025-09-20 14:47:35 -07:00
LGUG2Z 539aeec965 refactor(rust): remove getset dependency 2025-09-20 14:34:19 -07:00
LGUG2Z bcfb058bc3 refactor(rust): standardize on ok_or_eyre and bail!
This commit standardizes the codebase to disallow usage of the raw eyre!
macro for creating errors, instead using ok_or_eyre() when constructing
ad-hoc errors from Result and Option types, and otherwise using the
bail! macro in response to failed boolean conditions.
2025-09-20 12:59:09 -07:00
LGUG2Z e07b464b0d chore(dev): begin 0.1.39-dev 2025-09-20 12:59:09 -07:00
LGUG2Z b7ce8c03b5 refactor(rust): standardize on ok_or_eyre and bail!
This commit standardizes the codebase to disallow usage of the raw eyre!
macro for creating errors, instead using ok_or_eyre() when constructing
ad-hoc errors from Result and Option types, and otherwise using the
bail! macro in response to failed boolean conditions.
2025-09-20 10:24:42 -07:00
LGUG2Z 63d3b4e33a fix(wm): allow closed windows to be reaped
Instead of erroring out when a window position can't be set due to the
AXUIElement no longer existing, log a warning and let the invalid
application window reaper clean it up.
2025-09-19 14:58:12 -07:00
LGUG2Z 8eb01713f2 feat(wm): handle non-observable applications
OBS Studio is not observable when starting komorebi, so this changes
Application.observe to set a new field is_observable to false if
registering the observer fails instead of erroring out.

This allows the wm initialization to continue instead of crashing.
2025-09-19 14:02:48 -07:00
LGUG2Z 565c6cd6f8 feat(wm): implement remaining cycle and stack cmds
This commit implements the CycleFocusWindow, CycleMoveWindow, StackAll,
UnstackAll, FocusStackWindow and CycleStackIndex SocketMessage variants.

Largely a code migration from komorebi.
2025-09-19 11:55:38 -07:00
LGUG2Z 19686d9778 feat(wm): implement various focus and move cmds
This commit implements the MoveContainerToLastWorkspace,
SendContainerToLastWorkspace, MoveContainerToMonitorNumber,
CycleMoveContainerToMonitor, MoveContainerToWorkspaceNumber,
MoveContainerToNamedWorkspace, CycleMoveContainerToWorkspace,
SendContainerToMonitorNumber, CycleSendContainerToMonitor,
SendContainerToWorkspaceNumber, CycleSendContainerToWorkspace,
SendContainerToMonitorWorkspaceNumber,
MoveContainerToMonitorWorkspaceNumber, SendContainerToNamedWorkspace,
CycleMoveWorkspaceToMonitor, MoveWorkspaceToMonitorNumber, and
SwapWorkspacesToMonitorNumber SocketMessage variants.

This is primarily a lift-and-shift from komorebi.

I still have no idea if the monitor-related stuff works as expected.

I need to figure out how to construct a light Window from a window_id to
be able to call move_to_area() when moving a container to another
monitor.
2025-09-19 11:37:09 -07:00
LGUG2Z e883f4a161 feat(wm): implement various monitor & ws focus cmds
This commit implements the CycleFocusMonitor, CycleFocusWorkspace,
CycleFocusEmptyWorkspace, FocusMonitorNumber, FocusMonitorAtCursor,
FocusLastWorkspace, CloseWorkspace, FocusWorkspaceNumbers,
FocusMonitorWorkspaceNumber and FocusNamedWorkspace SocketMessage
variants.

Largely a lift-and-shift from komorebi.

Had to implement some utility functions in MacosApi to retrieve a
monitor ID from the current cursor position.

None of the monitor-related system code has been tested on macOS since I
only have a single monitor to work with right now.
2025-09-19 11:03:30 -07:00
LGUG2Z e01fc55134 feat(wm): implement various ws config toggle cmds
This commit implements the ToggleWorkspaceWindowContainerBehaviour,
ToggleWorkspaceFloatOverride, ToggleLock, ToggleFloat, ToggleMonocle,
ToggleWindowContainerBehaviour, ToggleFloatOverride,
ToggleCrossMonitorMoveBehaviour, ToggleTiling and
ToggleWindowBasedWorkAreaOffset SocketMessage variants.

Again mostly a lift-and-shift from komorebi.

ToggleMaximizeWindow can be implemented later once I figure out how
maximized windows are handled in macOS.
2025-09-19 10:22:37 -07:00
LGUG2Z 4fc401cca8 feat(wm): implement layout cycling and flipping
Another lift and shift from komorebi to add support for the CycleLayout
and FlipLayout SocketMessage variants. Trying to get through all of the
main workspace-related interactive commands.
2025-09-19 09:49:27 -07:00
LGUG2Z c91520c531 feat(wm): implement container and focus promotion
Was going a little crazy without being able to promote a container to
the biggest tile. This is pretty much a straight lift and shift from
komorebi.
2025-09-19 09:41:14 -07:00
LGUG2Z c1cf94b23f feat(wm): implement resizing and retiling
This commit migrates the code from komorebi required to implement the
ResizeWindowEdge, ResizeWindowAxis, Retile and
RetileWithResizeDimensions SocketMessage variants, as well as the
related komorebic commands to emit those SocketMessages.
2025-09-19 09:33:56 -07:00
LGUG2Z 71adb1c0e0 feat(wm): implement basic workspace layers
This commit implements some of the basic plumbing needed to handle
SocketMessage::ToggleWorkspaceLayer and SocketMessage::ToggleFloat.

I've commented out a bunch of the raise/lower functions for now because
I haven't had time to learn about how changing z-ordering on macOS works
yet.

Even so, this is fairly functional, and it's possible to move floating
windows across workspaces, toggle the workspace layer, move floating
windows by the resize delta, and change focus between floating windows.

I ended up moving the window restore positions to a global map because
storing/updating this kind of state on the Window properly will be a
pain because hide/restore now require mut self refs and that leads to
needing to clone sometimes.
2025-09-19 08:51:30 -07:00
LGUG2Z 5edbd64e65 feat(wm): implement window based work area offsets
I can't use monocle mode without this feature. Migrated all the relevant
code over from komorebi. Values are hardcoded to now for my preferences.
After I bring over the rest of the Workspace stuff I should look at
bringing in the static config.
2025-09-18 17:28:01 -07:00
LGUG2Z 558a1578c8 feat(wm): implement monocle containers
This commit migrates the code around Monocle containers from komorebi
and implements everything needed to handle SocketMessage::ToggleMonocle
in the wm and send the SocketMessage from komorebic.

I think I should spend time implementing as many Workspace features as I
can before I turn my attention to anything else, because hunting for
where to re-introduce the monocle code I had previously omitted to get
everything compiling was quite tedious and I'm sure I've probably missed
things.
2025-09-18 17:14:24 -07:00
LGUG2Z 061d7e3e73 feat(wm): add basic workspace switching support
This commit migrates the code needed from komorebi to implement basic
workspace support.

The FocusWorkspaceNumber, MoveContainerToWorkspaceNumber and
SendContainerToWorkspaceNumber SocketMessage variants have been
implemented in process_command, and the commands to emit those
SocketMessage variants have been added to komorebic.

I took a stab at improving the code for hiding the windows by moving
them as off-screen as possible by taking inspiration of Aerospace's
approach of trying to leave only 1px of them visible.

Right now this always looks to put the hidden windows off-screen on the
left side of the screen.
2025-09-18 16:45:43 -07:00
LGUG2Z 92701d902d feat(wm): add basic stacking support
This commit adds support for the StackWindow, UnstackWindow and
CycleStack SocketCommands. The code is largely just migrated from
komorebi.

It looks like there isn't a public API which can be used to hide
individual windows, either via AXUIElement or something constructed
using the window id.

For now I'm just moving the stacked window off the screen and this works
well enough. I also added some cleanup which ensures that when the
process exits, windows which are off-screen will be restored to their
last known position.
2025-09-18 15:43:49 -07:00
LGUG2Z 4f6267b56e feat(wm): add basic window manager event handling
This commit adds a WindowManagerEvent enum and a channel to send and
receive variants of it on.

The skeleton of process_event has been migrated from komorebi and a few
basic implementations of handlers for core events like FocusChange,
Show, Destroy, Minimize and Restore have been added.

Due to the way the window observers work, in komorebi for Mac we'll need
to keep track of minimized Windows so that we don't drop their observers
(otherwise we won't receive a notification when they are restored).

Most of the code added in this commit around modifying state in response
to these events has been migrated from komorebi.
2025-09-18 11:12:27 -07:00
LGUG2Z df9ceee17e feat(wm): migrate ipc and impl basic socket messages
This commit migrates another bunch of code from komorebi to start
implementing inter-process communication using Unix domain sockets.

For this commit a small subsection of the SocketMessage with maximum
utility has been migrated: FocusWindow, MoveWindow, ChangeLayout, and
TogglePause.

This includes migrating their handlers in process_command, and setting
up a UnixListener when creating a WindowManager instance.

To be able to test this functionality I also implemented a basic
skeleton of komorebic and migrated the komorebi-client library.

There are some random fixes included here now that we are listening to a
UnixListener on a separate thread, which includes wrapping structs from
the objc2 crate which don't have Send and Sync implemented, so that they
can be implemented in the komorebi lib.

I also took the time to figure out how to calculate a monitor's work
area size, excluding the dock and the menu bar, and started to split out
Workspace and Monitor into their own modules.

It looks like a lot of changes but most if this is just pulling in stuff
from the Windows implementation.
2025-09-17 16:18:06 -07:00
LGUG2Z b6d19e6a12 feat(wm): migrate workspace and layout code
This commit migrates big chunks of code from komorebi for Windows which
deal with state related to the Workspace struct, Layouts and the
Arrangement trait.

Layout remains an enum, but only the Layout::Default variant with
DefaultLayout has been migrated because there are no plans to support
EOL features in komorebi for Mac (custom layouts).

The code for updating the layout in main.rs has been moved to
Workspace.update, which is now called from main.rs instead.

As part of this initial migration of code, this project has been
restructured a little to match the layout of komorebi for Windows to
minimize my own confusion.
2025-09-17 13:31:39 -07:00
LGUG2Z 326c419666 feat(wm): add initial skeleton of wm state and initialization 2025-09-17 09:07:45 -07:00
LGUG2Z a2b0207c28 feat(wm): add core graphics api wrapper module 2025-09-16 18:10:03 -07:00
LGUG2Z 2b99a68ed8 feat(wm): initial commit 2025-09-16 16:53:11 -07:00
LGUG2Z ffa76ea28c chore(release): v0.1.38 v0.1.38 2025-09-12 17:36:04 -07:00
Lucas de Linhares 2c00d79968 perf(cargo): add release-opt profile 2025-09-12 17:05:24 -07:00
LGUG2Z 78177af6b8 docs(mkdocs): run docgen, depgen and jsonschema targets 2025-09-09 08:56:29 -07:00
dependabot[bot] 86e0d40828 chore(deps): bump actions/github-script from 7 to 8
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-08 10:03:38 -07:00
LGUG2Z 48f6ac8964 chore(deps): cargo update 2025-09-08 08:17:40 -07:00
omark96 1db572f789 feat(wm): implement Clone for State, Notification and NotificationEvent
This implements Clone for State, Notification and NotificationEvent to allow for the use of these
types in Rhai scripts.
2025-09-02 07:53:36 -07:00
1337cookie 3dad77533b feat(bar): add config opts for ro and removable disks
This lets the user enable or disable showing removable or read only
disks in the komorebi-bar storage widget.

Removable disks are set to show by default.

Read-only disks are set not to show by default. Having windows sandbox
installed displays a very long read only disk which could be problematic
for new users.
2025-09-01 15:15:41 -07:00
omark96 f40fb9a251 feat(wm): add config option to set tiling
This commit adds the option to set whether a workspace should be tiled or not by default. It retains
the default behaviour of komorebi, but adds the option to set a workspace to not be tiled by
default, but still be able to change the default layout for that workspace.
2025-09-01 15:04:59 -07:00
omark96 b4e16e43e9 feat(cli): change quickstart to prompt user before writing files
This commit makes it so the quickstart command first checks for the existence of the config files.
If they don't exist it writes them, if they do exist it prompts the user to whether or not they want
to overwrite the existing files. Lastly it prints the full path to the files that were written. This
is to prevent users from accidentally overwriting their configs as well as making it clearer where
komorebi places the config files for new users.
2025-09-01 15:03:48 -07:00
LGUG2Z 4c2e8ff6d2 chore(deps): cargo update 2025-09-01 15:03:09 -07:00
Jerry Kingsbury c879aae1e7 test(wm): monocle on and off on nonexistent container
Created a test that tests moving a nonexistent container to monocle and
retreiving a nonexistent container from monocle. The test ensures we
receive an error when attempting to use monocle_on or monocle_off when a
container doesn't exist.
2025-08-27 18:05:07 -07:00
Jerry Kingsbury 7e87e83189 test(wm): toggle monocle on nonexistent container
Created a test to test toggle monocle when a container doesn't exist in
the monitor. The test ensures that we receive an error when attempting
to call toggle monocle when a monitor doesn't contain a container.
2025-08-27 18:05:07 -07:00
Jerry Kingsbury aae9338f66 test(wm): toggle maximize a nonexistent window
The test ensures that we receive an error when attempting to toggle
maximize a window that doesn't exist.
2025-08-27 18:05:07 -07:00
Jerry Kingsbury f68a709f1d test(wm): float nonexistent window
Created a test to test trying to float a nonexistent window. The test
ensures that we receive an error when trying to float a window in an
empty container
2025-08-27 18:05:07 -07:00
Jerry Kingsbury c76846ac63 test(wm): cycle windows in an empty container
Created a test to test cycling windows in an empty container. The test
ensures that when attempting to cycle windows in an empty container it
will push out an error.
2025-08-27 18:05:07 -07:00
Jerry Kingsbury b29dd8b1d1 test(wm): remove nonexistent window from container
Created a test that tests removing a nonexistent window from a
container. The test creates a monitor containing an empty container and
attempts to remove a window from the container. The test ensures that
the result is an error when calling remove_window_from_container.
2025-08-27 18:05:07 -07:00
omark96 59c3c14731 feat(config): add work-area-offset per workspace
This commit adds the option to set 'work_area_offset' per workspace. If
no workspace work area offset is set for that workspace it will instead
use the value of the globals.work_area_offset for that workspace.

This commit adds a command to set the work area offset of a workspace
given a monitor index and a workspace index.
2025-08-27 18:05:07 -07:00