Fixing laggy workspace switches with Chrome in AeroSpace
Table of Contents
This is a short AI written blog post, I decided to hosts it publicly so that anyone else with this same issue could hopefully have their LLM find this and save some tokens by not having to independently discover this issue.
If you’re here, another tip is the option key would often stop working due to idiosyncratic Mac issues (Secure Input), so I found rebinding option to cmd-ctrl-alt makes for a much more robust experience!
The problem #
If you keep Chrome windows on different AeroSpace workspaces (for example, one per Chrome profile), switching between those workspaces can feel slow. The window takes a moment to appear, even though switches to other apps are instant.
Why it happens #
AeroSpace doesn’t use macOS Spaces. To hide a workspace, it moves that workspace’s windows almost entirely off-screen. Chrome sees those windows as hidden and stops drawing them to save power. When you switch back, AeroSpace moves the window into place right away, but Chrome has to redraw the page first, and that’s the lag.
You can confirm AeroSpace isn’t the slow part by timing the command itself:
time aerospace workspace 2
On my machine this took about 45 ms, for Chrome workspaces and other workspaces alike.
The fix #
Start Chrome with two flags that stop it from treating hidden windows as hidden:
open -a "Google Chrome" --args \
--disable-features=MacWebContentsOcclusion \
--disable-backgrounding-occluded-windows
Quit Chrome completely first (⌘Q), because flags only apply when Chrome starts. To check they took effect, run this while Chrome is running:
ps -o args= -p $(pgrep -x "Google Chrome")
The cost is a bit more CPU and battery use, since Chrome keeps drawing windows you can’t see.
Making it permanent #
macOS has no setting to always start an app with extra flags, so if you open Chrome normally, they’re gone. A simple workaround is a small launcher app:
osacompile -o "/Applications/Chrome.app" -e \
'do shell script "open -a \"Google Chrome\" --args --disable-features=MacWebContentsOcclusion --disable-backgrounding-occluded-windows"'
cp "/Applications/Google Chrome.app/Contents/Resources/app.icns" \
"/Applications/Chrome.app/Contents/Resources/applet.icns"
Then add Chrome.app to System Settings → General → Login Items, and open Chrome through it, from Spotlight or the Dock.
If Chrome is already running, the launcher just brings it to the front. The flags are only lost if you quit Chrome and reopen it some other way, for example by clicking a link or opening “Google Chrome” directly. If the lag comes back, quit Chrome and reopen it through the launcher.