← 输入框|github.com|刷新
Skip to content
MattSenterPublic

About

Makes Cmd+H hide the last app on your Mac, so you can actually see your desktop.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CommandH app icon

CommandH

Make Cmd+H hide the last app on your Mac, so you can actually see your desktop.

English · Deutsch · Español · Français · 日本語 · 한국어 · Português (Brasil) · 简体中文 · 繁體中文


macOS has an odd rule: you can't hide the last visible app. When every other app is already hidden, pressing Cmd+H on the one that's left does nothing. The window stays put and you never get to your desktop.

CommandH is a tiny, free, open source menu bar app that fixes this. With it running, Cmd+H works the same way every time, even on the last app.

  • No permissions to grant (no Accessibility, no Screen Recording)
  • No network access, no analytics, no data collected
  • Lives in your menu bar, or nowhere at all if you prefer
  • Requires macOS 14 Sonoma or later

Contents

Install

CommandH is on the Mac App Store. That version always uses Hide the app; Show Desktop is only in the version you build yourself.

To build it from source, which takes about a minute:

  1. Install Apple's command line tools if you don't have them:
    xcode-select --install
  2. Clone this repo and build:
    git clone https://github.com/MattSenter/commandh.git
    cd commandh
    ./build.sh --install
    This builds CommandH.app, copies it to your Applications folder, and opens it.
  3. The Preferences window appears. Under System, turn on Open at login so CommandH is always ready.

That's it. Hide apps the way you normally do. When you get down to the last one, Cmd+H now hides it too.

Using CommandH

There's nothing new to learn. Keep using Cmd+H.

  • When two or more apps are showing, CommandH stays out of the way and Cmd+H behaves exactly as it always has.
  • When only one app is showing, CommandH steps in so Cmd+H still works. What happens next depends on the method you pick in Settings.

To bring a hidden app back, click its Dock icon or switch to it with Cmd+Tab, as usual.

Two ways to handle the last app

Hide the app (default) Show Desktop
What you see The app hides completely, just like Cmd+H on any other app Windows slide to the edges of the screen
Getting it back Click its Dock icon or use Cmd+Tab Press Cmd+H again, or click the app
Dock icon CommandH's icon appears in the Dock while one app or none is showing Never appears in the Dock
Best for People who want a real hide People who never want CommandH in the Dock

Why does a Dock icon appear in "Hide the app" mode? macOS only refuses to hide an app when it would leave no regular app on screen. CommandH briefly becomes a regular app (one with a Dock icon) so that your last app is no longer the last one. Regular apps always get a Dock icon, and there's no way around that. The icon goes away again as soon as two or more apps are showing. See How it works for the details.

Settings

Open the Preferences window by opening CommandH from your Applications folder (or Spotlight, or Launchpad), by choosing Preferences… from the menu bar icon, or by clicking CommandH's Dock icon while it's showing. The sidebar has five panes: Hiding, System, Privacy, Other Projects (more apps from the same developer), and About (version info and links).

CommandH Preferences window in light mode CommandH Preferences window in dark mode

Setting Pane What it does
Enabled Hiding Turns CommandH on or off without quitting it. When off, Cmd+H behaves like stock macOS.
When only one app is showing Hiding Chooses Hide the app or Show Desktop. See the comparison above.
Apps without a Hide command Hiding Lists apps where Cmd+H does nothing because they have no Hide command. Choose Add a Running App to add one, and CommandH hides it when you press Cmd+H.
Show in menu bar System Shows or removes the ⌘H icon in your menu bar. With it off, CommandH runs invisibly. Open CommandH from your Applications folder to get back to this window.
Open at login System Starts CommandH automatically when you log in. It starts quietly, without opening this window.
Quit CommandH System Actually quits the app. Closing the window (or pressing Cmd+Q) only closes the window and leaves CommandH running.
Rate CommandH About Mac App Store version only. Opens the App Store so you can rate or review CommandH.
Share CommandH Sidebar Opens the system share sheet with CommandH's App Store link. In the Mac App Store version, Rate CommandH is here too.

Settings are saved automatically and apply right away.

The menu bar menu

Click the ⌘H icon in your menu bar for quick access to the same settings.

CommandH menu bar menu with the When Cmd+H Can't Hide submenu open

  • Enabled: turn CommandH on or off.
  • When Cmd+H Can't Hide: pick Hide the App or Show Desktop.
  • Show in Menu Bar: uncheck to remove the icon. You can also hold Cmd and drag the icon out of the menu bar.
  • Open at Login: start CommandH when you log in.
  • Preferences…: open the Preferences window.
  • Quit CommandH: quit the app.

Keyboard shortcuts

While the CommandH Preferences window is in front:

Shortcut What it does
Cmd+W Closes the Preferences window. CommandH keeps running.
Cmd+Q Also closes the window and keeps CommandH running, so a stray Cmd+Q never turns it off. Use Quit CommandH to quit for real.
Cmd+H Hides CommandH like any other app.
Cmd+, Opens Preferences.

Troubleshooting

Cmd+H still does nothing on the last app. Make sure CommandH is running (open it from your Applications folder) and that Enabled is on. If you use Show Desktop, check that the Show Desktop option isn't grayed out (see below).

A CommandH icon showed up in my Dock. That's expected in Hide the app mode whenever one app or none is showing. It disappears once a second app is showing. If you'd rather never see it, switch to Show Desktop.

After hiding everything, clicking the desktop brought Finder windows back. That's normal macOS behavior: clicking the desktop switches to Finder, and switching to a hidden app shows its windows again. Hidden apps you haven't clicked stay hidden.

In Show Desktop mode, I can still see the edges of my windows. That's how macOS's Show Desktop works. Press Cmd+H again or click a window edge to bring everything back. For a complete hide, use Hide the app.

The Show Desktop option is grayed out. Show Desktop relies on an internal macOS feature. If a future version of macOS removes it, CommandH grays the option out rather than misbehave. Hide the app keeps working.

I turned off the menu bar icon and can't find CommandH. Open CommandH from your Applications folder. The Preferences window appears, and you can turn the icon back on under System.

Open at login doesn't stay on. macOS only allows apps in a stable location to open at login. Make sure CommandH is in your Applications folder (./build.sh --install puts it there), then turn the setting on again.

The menu bar shows "CommandH" after I hide my last app. In Hide the app mode, CommandH becomes the active app after the last app hides, so its name appears in the menu bar. Click any app or the desktop to move on.

Cmd+H does nothing in one particular app. Some apps (CapCut is one) have no Hide command, so Cmd+H never worked in them. Open that app, then add it under Apps without a Hide command in the Hiding pane.

How it works

Before writing CommandH, we tested every way we could find to hide the last visible app directly. All of them fail:

Approach Result
NSRunningApplication.hide() Refused
AppleScript (set visible of process ... to false) Refused when the app is the last one showing
Accessibility (kAXHiddenAttribute) Reports success, nothing hides
Private LaunchServices (_LSSetApplicationInformationItem) Reports success, nothing hides
Carbon ShowHideProcess Refused

All of these hand off to the same check inside macOS, and that check only counts regular apps, the kind with a Dock icon. Menu bar only apps don't count. Even when the hide is forced through, macOS immediately unhides the most recently used app so that something is always on screen.

Hide the app works within that rule. When one app or none is showing, CommandH switches itself to a regular app with a 1 by 1 pixel, nearly transparent window. Your last app is then no longer the last one, so its own Cmd+H works normally, and macOS hands focus to CommandH instead of unhiding something else. When two or more apps are showing, CommandH switches back to a menu bar only app.

Show Desktop takes a different path. While the front app is the only one showing, CommandH registers Cmd+H as a global hotkey (released as soon as that stops being true) and triggers macOS's built-in Show Desktop. Outside that one case, Cmd+H goes straight to your apps.

Apps without a Hide command use the same hotkey. While an app on your list is in front, CommandH registers Cmd+H and hides that app itself. If it's the last app showing, the method you picked above takes over.

Neither method needs any permission, and CommandH never reads your screen or your keystrokes. The global hotkey only exists while one app is showing in Show Desktop mode, or while an app on your list is in front.

The whole app is under 500 lines of Swift in Sources/.

Uninstall

  1. Choose Quit CommandH from the menu bar icon or the System pane of the Preferences window.
  2. If Open at login was on, turn it off first, or remove CommandH in System Settings > General > Login Items.
  3. Drag /Applications/CommandH.app to the Trash.
  4. Optionally remove its settings:
    defaults delete com.mattsenter.CommandH

Building and contributing

./build.sh            # builds build/CommandH.app (ad-hoc signed)
./build.sh --install  # also copies it to /Applications and opens it
swift Tools/make-icon.swift   # regenerates the app icon in Resources/
python3 scripts/check-localization.py   # checks every language is complete

CommandH ships in English, German, Spanish, French, Japanese, Korean, Brazilian Portuguese, and Simplified and Traditional Chinese. A new string the app shows goes in Localization/en.lproj/Localizable.strings and every other .lproj, and a change to this README or PRIVACY.md goes in each translation too.

Path What's there
Sources/main.swift App delegate, the two hiding methods, menus
Sources/SettingsView.swift The SwiftUI Preferences window: sidebar and panes
Sources/OtherProjectsView.swift, Resources/other-projects/ The Other Projects pane and its screenshots
Sources/BuiltByCredit.swift, Sources/OutboundLink.swift The sidebar credit and copyright, and the tagged outbound links
Sources/MenuBarIcon.swift The menu bar icon, drawn in code
Localization/<lang>.lproj/ The app's strings in each language (English is the source)
README.<lang>.md, PRIVACY.<lang>.md Translated docs
scripts/check-localization.py Fails if any language is missing a string, doc, listing file or screenshot
Tools/make-icon.swift Renders the app icon
scripts/release.sh Developer ID signing and notarization for releases
project.yml, fastlane/ The Mac App Store build (sandboxed, without Show Desktop). See docs/AppStore.md
scripts/screenshots.sh Renders the App Store screenshots

Issues and pull requests are welcome.

Support the project

CommandH is free and always will be. If it saves you a little daily annoyance, you can tip me on Venmo.

Tip @MattSenter on Venmo

Venmo QR code to tip Matt Senter
Scan with your phone

A tip is a thank you. It doesn't unlock anything, because there's nothing to unlock.

Other Projects

CommandH is one of several products Matt Senter of Senternet designs, builds, and ships end to end. Here’s the rest of the lineup.

  • Despacer: Copy long commands from Claude Code and Codex, and paste them in one piece.
  • Weatherling: Rain, snow, and autumn leaves on your Mac desktop. Weather effects, not a weather app.
  • Burly: Every link, in the right browser profile.
  • Comoji: Slack-style :emoji: autocomplete, everywhere on your Mac.
  • Premail: Your inbox, defended.
  • Highwire: See beyond the headlines.
  • StockCar: A podcast of your portfolio, not the market.
  • Orgabot: Orchestrate the work, not just the agents.
  • BeeReady: Lifesaving skills, one game at a time.
  • SeedMatrix: Every variety, every trial, one clear comparison.

License

MIT. Built by Matt Senter.

About

Makes Cmd+H hide the last app on your Mac, so you can actually see your desktop.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages