·10 min read
DiskDesk: a Windows desktop on any drive, built with Python and COM
DiskDesk is a second Windows desktop that lives on a drive you choose. You install it, pick a disk, and it gives you a full desktop bound to <Drive>:\Desktop instead of the usual user Desktop folder. It is one full-screen window that sits above the real desktop and below your normal windows. I am its only developer.
I wanted it to feel like the real thing, so I set one rule early: where Windows already has an API for something, call it. Do not imitate it.
- Role
- Creator and sole developer
- Period
- Sep 2026 to Sep 2026
- Status
- Released v1.0.0
- Stack
- Python, Qt, ctypes, pywin32, COM, PyInstaller, Inno Setup
The challenge
A fake desktop is easy to build and easy to spot. A file grid with a hand-made right-click menu of "Open, Copy, Delete" feels wrong within a minute, because the real menu has your installed apps in it, Send to, Open with and New. Reproducing that by imitation means chasing every shell extension forever. Using the real shell means calling COM interfaces that the usual Python bindings only half cover.
The second challenge is that this is a program people install and keep running. It needs to update itself without questions, upgrade in place, and ship from a pipeline I trust.
My responsibility
DiskDesk is solely mine. From the repository I owned:
- The Qt window and views (
window.py,view.py), including multi-monitor spanning, stacks, pages and the auto-organize rules. - The COM layer for menus (
shellmenu.py), thumbnails (thumbs.py) and file operations (winapi.py). - The installer (
installer/diskdesk.iss) and the PyInstaller spec for the portable exe. - The release workflow on GitHub Actions and the in-app updater (
update.py). - The README, including its "Windows only" section.
How I approached it
The idea
Nothing is migrated, copied or synchronised. Your Windows desktop stays as it was. DiskDesk creates its own folder on the disk you pick and shows that. It does not replace explorer.exe, so the taskbar, Start menu and Win+D keep working. The window is a Qt frameless tool window with the "stays on bottom" hint, which puts it between the wallpaper and everything else.
Qt.WindowType.FramelessWindowHint
| Qt.WindowType.WindowStaysOnBottomHint
| Qt.WindowType.ToolThe right-click menu that came up empty
The right-click menu was the hardest part. I wanted the same menu Explorer shows, including whatever your installed apps add to it. That means IContextMenu, and the catch is in the docstring at the top of shellmenu.py: pywin32 exposes IContextMenu but not IContextMenu2 and IContextMenu3. Without those two the shell never fills its dynamic submenus, so New, Send to, Open with and every extension that builds its menu on demand come up empty.
So I dropped the wrappers. The COM layer is a minimal pointer class that reads the vtable and calls slots by index:
def _slot(self, index: int, restype, argtypes):
vtable = ctypes.cast(self.ptr, POINTER(POINTER(c_void_p)))[0]
return ctypes.WINFUNCTYPE(restype, c_void_p, *argtypes)(vtable[index])That alone is not enough, because the shell fills those submenus by sending window messages to the menu's owner. handle_menu_msg tries IContextMenu3 first and falls back to IContextMenu2, and a hidden host window (DiskDeskShellMenuHost) with its own window procedure forwards the menu messages to whichever menu is active. The menu is rebuilt on every right-click, so an app installed a minute ago shows up with no restart.
Two menus get merged: the target folder's own menu, whose commands act on the DiskDesk folder (New, Paste, extensions), and entries only the real desktop offers, like Display settings and Personalize, read live from the desktop shell folder. Folder-scoped verbs are never taken from the desktop menu. If they were, Paste would act on the user's real Desktop folder instead of the DiskDesk one.
There are two styles in settings. Classic is the full native Win32 menu, identical to "Show more options". The Windows 11 style is a compact rounded menu that DiskDesk draws itself from the shell's items, with a Show more options entry that opens the classic one. Shift plus right-click always gives the classic menu with extended verbs.
| Style | Drawn by | Notes |
|---|---|---|
| Classic | native Win32 menu | identical to "Show more options" |
| Windows 11 | DiskDesk, from the shell's items | compact and rounded, with a "Show more options" entry that opens the classic menu |
Thumbnails and file operations
Thumbnails come from IShellItemImageFactory, the same bitmaps Explorer shows for images, video, PDF and documents. The fetch blocks, so it only runs on worker threads, and results go into an LRU cache with a disk cache behind it, keyed by size and file version, so a restart repaints instantly and an edited file re-renders by itself.
hr = shell32.SHCreateItemFromParsingName(
w.LPCWSTR(path), None, byref(IID_IShellItemImageFactory), byref(ptr))File operations all go through SHFileOperationW, not shutil, which gets you the Recycle Bin, the Explorer progress dialog, name collision prompts and system undo for free. The API wants a double-null-terminated list of paths, so a helper packs them:
def _packed(paths) -> str:
"""Shell APIs want a double-null-terminated list of paths."""
return "\0".join(str(p).replace("/", "\\") for p in paths) + "\0\0"The clipboard follows the same idea: cut, copy and paste interoperate with Explorer, including the Preferred DropEffect flag, so a cut here pastes as a move there.
- 01
Memory LRU cache
a hit returns immediately
- 02
Disk cache
keyed by size and file version
- 03
Shell call on a worker thread
IShellItemImageFactory blocks, so never the UI thread
- 04
Keep the result
a restart repaints instantly
Stacks, pages and rules
On top of the Explorer parity I added things I wanted on my own desktop. Stacks group icons by type or date, each group collapsing to one icon with a count badge. Pages let several folders share one desktop, switched with Ctrl+Tab, each with its own icon layout. Auto-organize files new arrivals away by wildcard rules like *.zip to Archives, and every move is undoable with Ctrl+Z. Matching is plain fnmatch, and the move goes through the same shell wrapper as everything else:
if pattern and folder and fnmatch.fnmatch(lowered, pattern):
return folder- 01
New file arrives
in the DiskDesk folder
- 02
Match the rule
fnmatch on the lowercased name
- 03
Move through the shell
SHFileOperationW, like every other operation
- 04
Undo on demand
Ctrl+Z reverts the move
With "Span every monitor" on, the window covers the union of all screens, a loop over Qt's screens that also re-fits on display and DPI changes:
area = QRect()
for screen in QGuiApplication.screens():
area = area.united(screen.availableGeometry())
self.setGeometry(area)It stays fast because listing, icon extraction and change watching are done by QFileSystemModel on Qt's C++ side, items have a uniform size, the wallpaper is scaled once per resize and cached, and layout is written to disk only on drop, align and quit.
The updater that must never ask a question
DiskDesk updates itself from GitHub releases, and I wanted that to be unattended. update.py figures out how the copy was started: installed, portable or from source. An installed copy runs the installer with /SILENT /SUPPRESSMSGBOXES /NORESTART /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS. A portable copy cannot overwrite its own running exe, so it writes a one-shot swap.cmd that waits for DiskDesk to exit, moves the files and relaunches.
Then I found a hole in the installer. Uninstalling ran a prompt asking whether to remove settings and the saved icon layout, and an upgrade runs the uninstaller silently. On Sep 2, 2026, minutes after the release, 410f9f2 fixed it: the prompt now runs only when the uninstall is not silent. The comment says it directly: a silent uninstall, which is also how an unattended update runs, must never stop for a question, so settings are left in place.
if (CurUninstallStep = usPostUninstall) and not UninstallSilent thenI should be honest about where that fix lives. It came after the only release, so v1.0.0 does not contain it, and the repo has no later tag yet.
Releases from tags, and three commits in two minutes
Releases are built by GitHub Actions. Pushing a tag that starts with v builds the portable exe with PyInstaller and the installer with Inno Setup on a Windows runner, then attaches both to the release. Before building, the workflow compares the tag with __version__ in diskdesk/__init__.py and fails if they differ, so a build cannot claim the wrong version.
The first run needed two fixes, and the timestamps show how fast. The first commit 1f46004 landed at 04:07 on Sep 2. At 04:08 3b8509f changed the release step to upload to an existing release when a tag was pushed by hand or a run was repeated, using gh release upload --clobber instead of always calling gh release create. At 04:09 ce2fe5b quoted the Program Files (x86) path for pwsh by switching to ${env:ProgramFiles(x86)}. The v1.0.0 release was published right after, with DiskDesk-Setup-1.0.0.exe and DiskDesk-Portable-1.0.0.exe attached.
git tag v1.1.0 && git push origin v1.1.0Project journey
All four commits landed on the same morning, and the release followed within minutes.
Sep 2026
First commit
1f46004: DiskDesk 1.0.0 with the shell layer, installer and updater
Sep 2026
Release workflow fix
3b8509f: reuse an existing release when a tag is pushed by hand
Sep 2026
CI path fix
ce2fe5b: quote the Program Files (x86) path for pwsh
Sep 2026
v1.0.0 published
portable exe and installer attached to the GitHub release
Sep 2026
Silent uninstall fix
410f9f2: never prompt during a silent uninstall
Beyond the launch
The history ends the day it starts, so there is not much to report. After v1.0.0 the only commit is 410f9f2, the silent-uninstall fix, which is not in a tagged release yet. What the README states openly as limits: DiskDesk is Windows only, and on purpose, and it does not include the taskbar, Start menu, virtual desktops, window snapping or the desktop peek gesture, because those belong to the shell and not to a desktop window. A Linux or macOS port would need a native equivalent for each shell module before the rest of the app could even start. I would rather say that than pretend Qt makes it portable.
The outcome
DiskDesk exists as a public repository with a v1.0.0 release, an installer and a portable exe, a daily in-app update check, and a release pipeline that guards its own version number. The main lesson for me: when the OS already does the hard part, the work is in the glue. Most of DiskDesk is careful ctypes calls, thread handling and caching around things Windows already knows how to do.
Evidence
- Repository: ddatunashvili/DiskDesk
- Release: v1.0.0
- Commits relied on:
1f46004,3b8509f,ce2fe5b,410f9f2 - Files:
diskdesk/shellmenu.py,diskdesk/thumbs.py,diskdesk/winapi.py,diskdesk/rules.py,diskdesk/window.py,diskdesk/update.py,installer/diskdesk.iss,.github/workflows/release.yml,README.md - Windows shell documentation and Qt documentation
Not verified: I did not benchmark the "stays fast" claims, which come from reading the code and README. I did not test the Windows 11 style menu against every shell extension, and I did not run the silent update path end to end for this post.
#python#windows#qt#com
Keep reading
Have a project in mind?