I wanted to hide the icons on my Mac Desktop. That was the whole requirement.
I tried three apps. All three wanted money before hiding a single folder, and
none of them let me hide only the screenshots while keeping my project folders
visible. On Windows this is right-click โ View โ uncheck "Show desktop icons."
So I built Bare: a small menu bar app with one job. Click the eye, the
Desktop is clean. Click again, everything is back.
๐ Download ยท Source on GitHub
Here's how it works, including the part I haven't solved.
Don't move the files. Flip a bit.
The obvious approach is moving Desktop items into a hidden folder. I didn't
want that: moving files breaks recent-file lists and app references, and if
the app crashes halfway, your stuff is somewhere you don't expect.
macOS already has a "hidden" flag on the filesystem: UF_HIDDEN, the same
one chflags hidden sets. Finder respects it right away, with no restart.
var st = stat()
guard lstat(path, &st) == 0 else { return false }
var flags = st.st_flags
if hidden {
flags |= UInt32(UF_HIDDEN)
} else {
flags &= ~UInt32(UF_HIDDEN)
}
return lchflags(path, flags) == 0
Two details matter here:
- Read, modify, write. Only the hidden bit changes, so any other flags on the file stay as they were.
-
lstat+lchflags, notstat+chflags. If a Desktop item is a symlink, Bare hides the link itself and never touches the file it points to.
The hidden flag doesn't protect or encrypt anything. It's only about what
Finder draws. That's exactly the scope I wanted.
"Show" has to only undo what Bare did
If you'd already hidden some files yourself, a simple "unhide everything"
would reveal them. So Bare keeps a set of the names it hid:
let ours = tracked.contains(item.name)
if item.isHidden && !ours { continue }
A hidden item that isn't in the set was hidden by someone else, so Bare skips it.
The edge case I haven't solved
Tracking by name means that if you rename a file while it's hidden, it
leaves the set, and "Show" won't bring it back. You can still find it in
Finder with โโง. and unhide it. I'd rather write this down than pretend it
doesn't happen. If you have a better idea, I'd like to hear it.
Sorting the Desktop by type
The feature I use most is "hide only screenshots." The classifier checks
aliases/symlinks, apps, folders, then screen captures, then everything else.
For screenshots it looks for the com.apple.metadata:kMDItemIsScreenCapture
extended attribute, then falls back to filename prefixes like Screenshot,
Screen Shot and Screen Recording.
New screenshots hide as they land
A DispatchSource file-system object watches ~/Desktop. Saving a file can
fire several events, so the rescan is debounced by 0.4 seconds. A new
screenshot might show for a moment before it disappears. That's the tradeoff.
A global shortcut without Accessibility permission
Most global-hotkey code asks for Accessibility access. Carbon's
RegisterEventHotKey doesn't need it, and it's still the simplest way to do
one global shortcut on macOS. The default is โโฅโH and you can record your own.
Disk icons are a different thing
Drives and servers on the Desktop aren't files, so the flag doesn't work for
them. For those, Bare flips Finder's own ShowHardDrivesOnDesktop-style
preferences, saves your original values, and relaunches Finder.
What it doesn't do
No network access, no analytics, no account, no Dock icon. It manages Desktop
visibility and nothing else. That's on purpose.
It's MIT-licensed and notarized. If you have a cleaner answer to the rename
problem, I'd love an issue or a PR:
github.com/orlandoascanio/Bare
Top comments (0)