Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

go-region-share

Share a rectangular region of your screen in tools that only support whole-window sharing (Teams, Meet, Zoom, …). Point the frame at any part of your desktop and share the app's window — whatever is inside the frame goes into the call.

Pure Win32 via syscall — no cgo, no external dependencies, single ~2 MB exe.

Quick install

With a Go toolchain, install the latest release straight from source:

go install -ldflags="-H windowsgui -s" github.com/oktalz/go-region-share@latest

The -H windowsgui flag is required — without it Go builds a console subsystem binary and a console window flashes up behind the app. This drops go-region-share.exe in your %GOBIN% (usually %USERPROFILE%\go\bin); the binary reports its version from the module info. Pin a specific version with @v1.2.3. For an installer with a Start Menu shortcut and uninstaller instead, see Install.

How it works

  • Main window — in idle mode shows the settings row (resolution, FPS, shadow cursor, …) on a dark honeycomb background. Click the client area to start sharing: the window turns borderless and its content becomes a live capture of the screen region beneath the frame. This is the window you pick in Teams/Meet/Zoom.
  • Recording frame — topmost hatched border around the region. The center is a real hole, so clicks pass straight through to whatever is underneath. Drag the top border to move, other borders/corners to resize. Close the frame (Alt+F4) or use the tray menu to stop sharing.
  • Self-masking — the pixels where the app's own window is visible are masked with the background pattern in each captured frame, so the capture never sees its own mirrored content (no "hall of mirrors") and the screen-share window pickers list exactly one app window.

Build

Tasks are run with Task (go install github.com/go-task/task/v3/cmd/task@latest). Run task (or task --list) to see everything:

task build        # build go-region-share.exe (trimpath, embedded icon+version)
task run          # build and run
task ci           # tidy + fmt + lint + test
task tools-install  # install pinned dev tools (gofumpt, staticcheck, govulncheck)

The Taskfile is modular: the root taskfile.yml wires in taskfile-go.yml (build/dev), taskfile-release.yml (packaging), and taskfile-tools.yml (pinned tools under ./tmp).

A plain go build -ldflags="-H windowsgui -s" . also works if you don't have Task.

Icon

The gopher logo (logo.png) is used as the exe icon, window/taskbar icon and tray icon. make-icon.ps1 regenerates app.ico from the logo, and the icon is embedded into the exe via rsrc_windows_amd64.syso, regenerated with:

go run github.com/akavel/rsrc@latest -ico app.ico -o rsrc_windows_amd64.syso

Both generated files are kept in the repo, so a plain go build picks them up.

Tray

While running, the app shows a tray icon: left-click brings the window to the front; right-click offers "Show window", "Stop sharing" and "Exit".

Install

Build the installer and run it:

task installer   # builds dist\go-region-share-<version>-setup.exe (needs Inno Setup)

The installer places the app in %ProgramFiles%\go-region-share (or per-user if elevation is declined), adds a Start Menu shortcut (Desktop shortcut optional), and registers an uninstaller in Add/Remove Programs. Released builds attach the same installer to the GitHub release — see Releasing.

Usage

  1. Start go-region-share.exe.
  2. Optionally pick a resolution (WxH, editable), FPS (default 30), and the shadow cursor checkbox.
  3. Click inside the window to start sharing; share the "go-region-share" window in your meeting tool.
  4. Drag whatever you want to show inside the hatched frame.
  5. Focus the frame (drag its border) and press Alt+F4 to stop sharing, or use the tray menu, or close the app from its taskbar entry.

Hold Ctrl+Alt while starting to skip restoring the saved window position.

HDR displays

On an HDR desktop, Chrome/Meet/Teams tone-map their window capture assuming reference white (80 nits) while Windows composites SDR content at the "SDR content brightness" level — so shared colors look washed out. This is not a capture bug in this app (its capture pipeline is byte-exact); it happens in the meeting app's capture. Best fix: disable HDR while sharing (Win+Alt+B) — the app shows this hint when HDR is detected.

The "Disable HDR on share" checkbox automates exactly that: when sharing starts and HDR is on, the app turns HDR off (DisplayConfig SET_HDR_STATE), and turns it back on when sharing stops or the app exits. If the app is killed hard while sharing, re-enable HDR manually with Win+Alt+B.

Alternatively, the HDR compensation checkbox pre-darkens the shared frame by the inverse of the monitor's SDR white boost (read live from Windows), so the meeting app's lift lands back near the source colors. It is an approximation: the local window looks dark, and the exact result depends on the meeting app's tone mapper. Takes effect when sharing (re)starts.

The small box next to the checkbox sets the compensation strength: auto (default) uses the monitor's SDR white level (e.g. 288 nits / 80 = 3.6); entering a number between 1 and 10 (e.g. 2.5, comma also accepted) overrides it — useful for fine-tuning against the meeting app's preview. Lower = less darkening. In practice Chrome's tone mapping lifts more than the raw white level suggests, so the best manual value can be well above auto (e.g. ~6 on a 288-nit setup). Checkbox and strength changes apply live, even while sharing — tune the value and watch the meeting app's presenting preview react in real time.

Multiple instances

The text box at the right end of the settings row renames the window live, so two running instances can be told apart in the taskbar and the meeting tool's window picker. The name is remembered and restored on the next launch.

You can also pre-name an instance at launch:

go-region-share.exe -title "Left screen"

A -title given on the command line overrides (and does not overwrite) the saved name — handy for shortcuts that always open with a fixed name while a plain launch restores whatever you last typed.

Settings

Stored in %APPDATA%\go-region-share\settings.json. Resolution presets are read from %APPDATA%\go-region-share\resolutions.txt.

Releasing

Releases are built with GoReleaser. Each release produces the standalone go-region-share.exe, a zip archive, checksums.txt, and a Windows installer (go-region-share-<version>-setup.exe) built with Inno Setup. The installer places the app in %ProgramFiles%\go-region-share (or per-user if elevation is declined), adds a Start Menu shortcut (Desktop shortcut optional), and registers an uninstaller in Add/Remove Programs.

Prerequisites (once): go install github.com/goreleaser/goreleaser/v2@latest and winget install JRSoftware.InnoSetup.

Build everything locally without publishing:

task release-snapshot   # or: goreleaser release --snapshot --clean

Cut a real release — push a v* tag and the release workflow runs GoReleaser on a Windows runner (installs Inno Setup, builds the exe + installer, publishes a draft GitHub release):

git tag v1.0.0
git push origin v1.0.0

Every push/PR is checked by the ci workflow (task tools-install, build, lint, test, govulncheck on windows-latest). To release locally instead of via CI:

$env:GITHUB_TOKEN = "<token>"
task release           # goreleaser release --clean

Set your GitHub owner in .goreleaser.yaml first. The installer can also be built on its own from an existing exe:

.\installer\build-setup.ps1 -ExePath .\go-region-share.exe -Version 1.0.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages