/watchedoverlay

Windows shell extension to mark arbitrary files as 'watched'

Primary LanguageZigBSD Zero Clause License0BSD

watchedoverlay

A Windows shell extension to mark files with a 'watched' icon, and a utility program to automatically mark things as watched by polling the recently played list of VLC media player.

Note: This is mostly to scratch my own itch, and to learn a bit about using COM from Zig. I have no real plans for this becoming anything more generally useful.

Installation

  1. Download the .zip file from Releases
  2. Unzip to wherever you'd like
  3. Run the install.bat as Administrator (right click -> Run as administrator)
  4. Restart explorer.exe, or log out/log back in, or restart your computer

Building

Note: Last tested with Zig 0.12.0-dev.1150+3c22cecee2. Pull requests that fix the build for latest master version of Zig are always welcome.

  1. Clone this repository and its submodules (git clone --recursive to get submodules)
  2. zig build dist
  3. The resulting files will be in zig-out/dist

Note that, by default, zig build dist will build everything in debug mode and use all the features of your current CPU (so it may not work on other computers). To make a more portable and faster build, you can use something like zig build dist -Doptimize=ReleaseSafe -Dcpu=x86_64 instead. If targeting versions of Windows older than 8, then -Dsingle-threaded should be used to avoid a dependency on RtlWaitOnAddress.

Overview of the source code

  • dllmain.zig has the dll entry point and exports DllGetClassObject, which is used to provide IClassFactorys for our registered CLSIDs. Also exports DllRegisterServer/DllUnregisterServer for integration with regsvr32
  • factory.zig has our IClassFactory implementation, which is used to allocate our registered IShellIconOverlayIdentifier and IContextMenu implementations
  • overlay.zig has our IShellIconOverlayIdentifier implementation, which is used to determine which items to put an icon overlay on
  • context_menu.zig has our IContextMenu implementation, which is used to add our menu item to the right click context menu
  • db.zig provides an interface to the sqlite database that stores which filepaths are marked as 'watched'
  • watcher-vlc.zig implements the polling of the VLC recently played files list and automatically marks things as watched
  • com.zig, windows_extra.zig, and registry.zig provide bindings and helpers for various Windows APIs.

Resources used