nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
5.51k stars 88 forks source link

Add environment variables to all callbacks #351

Open tobiasgiese opened 1 month ago

tobiasgiese commented 1 month ago

Having environment variables like AEROSPACE_FOCUSED_WORKSPACE and AEROSPACE_PREV_WORKSPACE in all callbacks would be helpful. Especially while using other tools like sketchybar for instance. Having those envs will reduce aerospace queries and will lower resource consumption.

Additionally, further environment variables would be useful. Some ideas that I have in my mind:

AEROSPACE_FOCUSED_MONITOR_ID: the current focussed monitor id AEROSPACE_WORKSPACE_MONITOR_ID: the monitor id for the workspace AEROSPACE_WORKSPACE_WINDOWS: the windows in the workspace

xref https://github.com/nikitabobko/AeroSpace/issues/230#issuecomment-2262997144

nikitabobko commented 1 month ago

I just realized that after we fix #278 there won't be a need in environment variables in callbacks

on-focus-changed = '''
    exec-async sketchybar --trigger aerospace_workspace_change "FOCUSED_WORKSPACE=$(list-workspaces --focused)"
'''

It will be as fast as environment variables because everything is executed in process right when the callback is called

But we also need to provide list-workspace --prev-focused as a replacement for AEROSPACE_PREV_WORKSPACE