Skip to content

didvc/screen-masking

Screen Mask

Cover parts of your Windows desktop with overlays you never have to touch.

Screen Mask puts black (or colored, or semi-transparent) rectangles over your screen to hide things: a second monitor during a call, a notification corner while recording, a panel you don't want on a screenshot. The trick is that the overlays themselves are not interactive. You shape them from a separate control window that shows a scaled, pixel-ruled map of your whole desktop.

Screen Mask control window and usage

Written in Go against the raw Win32 API. No external dependencies, no runtime, no installer. One .exe.

Why it works this way

Most masking tools make the mask draggable, so the cover and the controls end up on the same surface and fight over every click. Screen Mask keeps the cover dumb and moves all the shaping to a preview window, so a click on your desktop is never ambiguous. The full argument is in philosophy.md.

Controls

Action Result
Drag on empty canvas Create a new mask
Drag inside a mask Move it
Drag a blue handle Resize it
Right-click a mask Delete it
Click a mask (canvas or list) Select it
Del Delete selected mask
Esc Cancel the in-progress drag
Opacity slider Set the mask's alpha (8–255)
Click-through checkbox Let the mouse pass through the overlay
Color swatch Recolor the mask

Multi-monitor works out of the box. The canvas represents the full virtual screen, so masks on a monitor above or to the left of your primary display show up at negative coordinates, exactly as Windows sees them.

Install

Grab the latest screenmask.exe from the Releases page and run it. Nothing to install; it's a single self-contained executable.

Build from source

Windows-only (every source file is guarded with //go:build windows), but it cross-compiles from any host:

make build          # -> screenmask.exe (GUI subsystem, no console window)
make build-console  # keep a console attached for debugging output
make vet

Or without make:

GOOS=windows GOARCH=amd64 go build -ldflags="-H=windowsgui -s -w" -o screenmask.exe .

How it's built

The control window is a scaled preview of the virtual desktop; every mask you draw there owns one layered, top-most overlay window on the real desktop, and edits to the preview are pushed straight to that overlay.

Architecture

File Responsibility
main.go Entry point, window-class registration, message loop
win32.go Typed syscall bindings, constants, structs
app.go App state, coordinate mapping, window procedure, layout
canvas.go Left pane: hit-testing, mouse handling, drawing
panel.go Right pane: control layout, drawing, interaction
mask.go Mask model and overlay-window lifecycle
paint.go Double-buffered paint of the control window

Diagram sources live in docs/ as Typst files.

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md and the Code of Conduct. To report a security issue, see SECURITY.md.

License

Apache License 2.0. See LICENSE. If you use this in academic work, citation metadata is in CITATION.cff.

About

Cover parts of your Windows desktop with non-interactive overlays you shape from a pixel-ruled preview window. Pure Win32, no dependencies.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors