hide apps in macos dock

February 12, 2023

TL;DR

It is possible to hide any application from macos dock and cmd+tab switcher. All you need to do is edit its info.plist entry.

motivation

I use iterm2 as my terminal on macos, and since I often need that window, I don’t like to depend on cmd+space and typing iterm2. It’s a lot of keystrokes. I don’t like the cost of configuring my environment (like for example using hammerspoon, which is a great tool, but is also very involved. Using cmd+tab is a no-go too. It’s error-prone and silly to be tap-tap-tap-tapping often through several windows until I reach my target. Luckily for me, there is a way in iterm to set a custom key chord to call up the window to the front. Breadcrumbs here: (iterm2->Preferences->Profiles->->Keys->[ ] A hotkey opens a dedicated window with this profile).

disillusion

That sounds great, doesn’t it? I have it set up to cmd+shift+k, right on my home row, no faff at all. Pop and there it is. There’s one big problem though. This hotkey window is a separate entity from main iterm2 application window stack, and disappears on out-of-focus. That means that every time I cmd+tab away from it, i.e. to Firefox, and cmd+tab back, I will be in focus of iterm2, the app, but the window… Is gone. That gets very frustrating very quickly.

dealing with grief

For a while I have tried a few other terminal emulators just to see if they provide similar functionality that wouldn’t be that counterintuitive, to no avail. But then I turned my attention to a different idea - what if I excluded iterm from cmd+tab menu completely?

solution

The way to solve this turned out to be incredibly simple.

  1. Find iterm in your applications folder, wherever you’ve got it (i.e. /Applications/iterm2)
  2. Open the /Contents directory and the Info.plist XML file within it
  3. Add this little kv pair: <key>LSUIElement</key><string>1</string>
  4. Restart the application

Et voila. The app is gone from cmd+tab rotation.


Written by Daniel Kaczmarczyk, a software engineer and educator. you can find me on twitter or email me at daniel.kacz@protonmail.com

a pale blue and yellow circle