1
2
3
4
5
6
7
8
9
# Virtual desktop plugin
The host reads `:vd goto-desktop 2`, `:vd move-to-desktop 2`, `:vd pin-app`, `:vd unpin-app`, or `:vd app-pin-status`, loads `plugins/vd/plugin.dll` **once**, and calls its `sxhkd_plugin_invoke` export on each keypress. `plugins/vd/plugin.c` owns the action names, argument validation, foreground `HWND` lookup and focus tracking. `libs/virtualdesktopaccessor/VirtualDesktopAccessor.c` calls the undocumented Windows COM interfaces; no shell or child process runs for these actions. After a move, focus falls back to the first visible, titled window found on the current desktop (the original project's focus policy); this may not be the window you last used.
Config desktop numbers are **1–10** (`0` also means 10); the DLL internally uses zero-based indices. Build with `busybox make` from an x64 Visual Studio Developer Command Prompt at the repository root, which builds this DLL at `plugins/vd/plugin.dll`. Keep this directory layout relative to `dwhkd.exe` and include the original [MIT notice](../../libs/virtualdesktopaccessor/LICENSE.txt) when distributing it.
The generic host/plugin ABI, rules for adding your own plugin, and error handling are documented in the [top-level README](../../README.md#plugins). The plugin's version and `invoke` exports use [`plugin.h`](../../plugin.h). The DLL also exports the library's low-level naming, pinning, notification, and desktop-management APIs. The `:vd` adapter exposes the five actions above. App-pinning actions use the foreground window and show no UI. `app-pin-status` returns 0 only when the app is pinned; add a separate user-defined notification command if you want feedback. The host does not depend on the library export names.
This plugin currently targets **Windows 11 24H2 build 26100.2605 or later**. The interface layouts are undocumented and may change after Windows updates. See the [C library's notes and smoke tests](../../libs/virtualdesktopaccessor/README.md). The COM layout and export behavior were adapted under MIT from [Ciantic/VirtualDesktopAccessor](https://github.com/Ciantic/VirtualDesktopAccessor).