I think this is the last SocketMessage variant I'll be bringing over
before working on docs. Haven't tested this one but it should work
pretty much the same as on Windows.
This commit implements the komorebic display-index-preference command
for updating display index preferences, however the monitor
reconciliator module has not been reimplemented completely yet so these
values will not have any effect.
In implementing these two I'm diverging from how komorebi for Windows
handles these a little by tracking the window IDs of manually unmanaged
applications in a global vec UNMANAGED_WINDOW_IDS.
This is due to other changes in how Show and Destroy are handled in
komorebi for macOS which means we can't just piggy-back on those
handlers like we used to.
Instead of doing an adhoc check just against PERMAIGNORE classes, we
might as well construct a temporary Window to check the result of the
full Window.should_manage call.
This commit implements the Stop and StopIgnoreRestore SocketMessage
variants and sends them from the komorebic stop command. The ctrl-c
handler in main.rs now exits with code 130, while the Stop handlers will
exit cleanly with code 0.
This commit fixes a couple of subtle bugs. The InputEventListener will
now only emit a custom Show event if the CGEvent was a LeftMouseUp.
AXDialog subroles have been added to PERMAIGNORE_CLASSES, and an
additional check against PERMAIGNORE_CLASSES has been added in the Show
handler because apparently windows can change their roles after they are
created.
I had also missed a line to make sure we focus windows in a base case in
the FocusChange handler, which has now been added.
This commit migrates the LockMonitorWorkspaceContainer and
UnlockMonitorWorkspaceContainer SocketMessage variants, which if I'm
remembering correctly were implemented to help with functionality on the
komorebi-bar.
This commit adds in the ability for users to subscribe to notifications
via a Unix domain socket. Code was mostly just migrated from komorebi.
Tested with "nc -vklU $(komorebic datadir)/test.sock" to create the
socket and listen and then "komorebic subscribe-socket test.sock" to
subscribe for notifications.
Starting to think about documentation and adding in commands to generate
JSON schemas for the ApplicationSpecificConfiguration, SocketSchema and
StaticConfig.
schemars 0.8 > 0.9 has way too many breaking changes for me to care
about right now, let around 0.8 > 1.0. I'm happy being pinned on 0.8 for
now.
I think this is all of the config commands migrated to komorebic now.
I still need to look in to the ManageFocusedWindow and
UnmanageFocusedWindow SocketMessage variants, as well as everything to
do with monitor reconciliation, but next I think I'll focus on trying to
generate the schemas.
This commit migrates a whole bunch of interactive runtime configuration
komorebic commands and implements their corresponding SocketMessage
variants.
Largely lifted as-is from komorebi for Windows.
This commit implements a whole bunch of commands around runtime
manipulation of ignore rules, manage rules and workspace rules. Mostly
lifted straight from komorebi.
Got into a weird state after turning on my monitor where the same
window_id appeared in two separate containers on the workspace, so this
commit ensures that we always prune duplicate windows before updating
the workspace layout.
To give me a better idea of how the question for SocketMessage handling
parity is going, I have copied over the entire SocketCommand enum from
the Windows repo and commented out anything not yet implemented.
To give me a better idea of how the quest for komorebic command parity
is going, I have copied over the entire SubCommand enum from the Windows
repo and commented out anything not yet implemented.
This commit migrates a bunch of code from komorebi that deals with how
new windows should be handled according to the various floating and
container behaviour overrides.
To help test this functionality I also finished migrating the
SessionFloatRule, SessionFloatRules and ClearSessionFloatRules
SocketMessage variants.
This commit introduces a little hack to emit a WindowManagerEvent::Show
every time the input event listener callback is triggered.
This is needed because some apps like Ghostty and Safari do not trigger
any events when a tab is split out into an independent window.
To keep things a little cleaner, a new SystemNotification::Manual
variant has been added which takes a ManualNotification variant.
The idea is to be able to use one of these whenever we manually emit a
notification to the window manager event listener to hopefully save my
sanity when we have to debug something in the future.
This commit implements some fixes (still not ideal) to handle the
closing of the 1st tab of an application which uses native tabs.
When the 1st tab is destroyed, the window AXUIElement gets rendered
invalid, so we have to reap that window, and then emit our own Show
event for the tab that is becoming the new 1st tab and set that as the
window.
There is an edge case now where if this happens while the window is
floating, our emitted show event will result in that window being
integrated into the layout rather than staying tiling, but I think this
is better than having a completely janky workspace and possibly having
to restart komorebi.
This commit adds a global list of user-define-able applications which
use native tabs (I'll expose a config option for later). This is used to
improve handling of tabs.
I have tested with Ghostty and Finder. It's possible to add tabs with
cmd+t, close them with cmd+w, and also to drag them into their own
windows.
It's also possible to cmd+n to create a new window instance in Finder,
but when doing this with Ghostty, it doesn't emit an event (I think this
is a bug in Ghostty, since it works fine with Finder).
This commit adds logs written to files in the app's datadir, which can
then be tailed by the komorebic log command. temp_dir() was being weird
so I just stuck with DATA_DIR.
This commit adds window ID tracking like we do in komorebi for Windows
and fixes a bunch of bugs that were happening when a window on another
workspace was focused either via the Dock or cmd+tab, and also a bug in
workspace rules where on launch, a window would not respect workspace
rules due to another workaround that had been added to make Apple apps
work nicely.
This commit does some wrangling of the ioreg output to enrich monitors
with product names and serial number IDs, the latter of which is very
important to maintain compatibility with komorebi for Windows.
I can't get the equivalent of device and device_id on macOS, but these
are legacy things in komorebi for Windows so I think I'll leave them
out.
To verify monitor information, SocketMessage::MonitorInformation has
been implemented.
This commit implements the State, GlobalState and VisibleWindows
SocketMessage variants. These are the first of the SocketMessage
variants send by komorebic which receive a reply which is printed out to
the console.
I think the next thing to do will probably be to get the extended
display info so that the MonitorInformation variant can be handled too.
This commit migrates everything needed to get to the point where I can
load my existing Windows komorebi.json file and have the key parts
working as expected (workspace rules, manage rules, ignore rules,
floating applications etc.)
A lot of lift and shift, some wrangling things to work with the subtle
changes in this codebase, but overall I'm very happy with this.
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.
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.
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.
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.
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.
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.
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.
This commit implements the CycleFocusWindow, CycleMoveWindow, StackAll,
UnstackAll, FocusStackWindow and CycleStackIndex SocketMessage variants.
Largely a code migration from komorebi.