Skip to content

Always on top: Add transparent support for on topped window #44815

Merged
vanzue merged 14 commits intomainfrom
dev/vanzue/aat-transparent
Jan 29, 2026
Merged

Always on top: Add transparent support for on topped window #44815
vanzue merged 14 commits intomainfrom
dev/vanzue/aat-transparent

Conversation

@vanzue
Copy link
Contributor

@vanzue vanzue commented Jan 20, 2026

Summary of the Pull Request

Transparency support (best-effort)

Not every window can be made transparent. Transparency is applied on a best-effort basis and depends on how the target app/window is built and rendered.

When it may not work

  • Windows with special rendering pipelines (e.g., certain hardware-accelerated / compositor-managed surfaces).
  • Some tool/popup/owned windows where the foreground window isn’t the actual surface being drawn.

How it works (high-level)

  • Resolve the best target window (preferring the top-level/root window over transient children).
  • Apply Windows’ standard layered-window alpha mechanism (per-window opacity) to adjust transparency.
  • When unpinned, Restore the original opacity/state when possible.

If transparency doesn’t change, it means the window doesn’t support this mechanism in its current configuration.

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

always.on.top.transparency.support.for.window.mp4
image

@github-actions

This comment has been minimized.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds transparency adjustment support to the Always on Top module, allowing users to dynamically adjust the opacity of pinned windows using keyboard shortcuts (modifier keys + '+' or '-'). The implementation includes shared transparency utilities in common/utils/window.h that are reused by both AlwaysOnTop and FancyZones modules.

Changes:

  • Added transparency adjustment hotkeys (modifier + '+' for increase, modifier + '-' for decrease) with 20%-100% opacity range
  • Created shared window transparency utilities in common/utils/window.h for applying and restoring transparency
  • Refactored FancyZones (WindowDrag and WindowMouseSnap) to use the new shared transparency utilities
  • Added UI documentation and sound effects for transparency adjustments

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Updated activation shortcut description and added transparency adjustment documentation
src/settings-ui/Settings.UI/SettingsXAML/Views/AlwaysOnTopPage.xaml Added transparency info card to settings UI
src/modules/alwaysontop/AlwaysOnTopModuleInterface/dllmain.cpp Extended hotkey registration to support 3 hotkeys (pin, increase/decrease opacity) and added event handles
src/modules/alwaysontop/AlwaysOnTop/Sound.h Added new sound types for opacity changes and removed unused member
src/modules/alwaysontop/AlwaysOnTop/SettingsConstants.h Added trailing comma to enum (style change)
src/modules/alwaysontop/AlwaysOnTop/Settings.h Added transparency range constants (min 20%, max 100%, step 10%)
src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.h Added transparency methods and window state tracking structures
src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.cpp Implemented transparency adjustment logic, window resolution, and state management
src/common/utils/window.h Added shared transparency utilities (MakeWindowTransparent, RestoreWindowTransparency)
src/common/interop/shared_constants.h Added event name constants for opacity increase/decrease events
src/modules/fancyzones/FancyZonesLib/WindowMouseSnap.h Refactored to use WindowTransparencyProperties structure
src/modules/fancyzones/FancyZonesLib/WindowMouseSnap.cpp Simplified to use shared transparency utilities
src/modules/fancyzones/FancyZonesLib/WindowDrag.h Refactored to use WindowTransparencyProperties structure
src/modules/fancyzones/FancyZonesLib/WindowDrag.cpp Simplified to use shared transparency utilities

vanzue and others added 4 commits January 20, 2026 16:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@vanzue vanzue requested a review from niels9001 January 21, 2026 06:22
@github-actions

This comment has been minimized.

@github-actions
Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

Unrecognized words (1)

Metacharacter

These words are not needed and should be removed ROOTOWNER

Some files were automatically ignored 🙈

These sample patterns would exclude them:

^src/modules/powerrename/unittests/testdata/avif_test\.avif$
^src/modules/powerrename/unittests/testdata/heif_test\.heic$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:microsoft/PowerToys.git repository
on the dev/vanzue/aat-transparent branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/21430389029/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Warnings ⚠️ (1)

See the 📂 files view, the 📜action log, or 📝 job summary for details.

⚠️ Warnings Count
⚠️ large-file 2

See ⚠️ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@vanzue vanzue merged commit 6d4f56c into main Jan 29, 2026
21 checks passed
yeelam-gordon pushed a commit that referenced this pull request Jan 31, 2026
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
Transparency support (best-effort)
> Not every window can be made transparent. Transparency is applied on a
best-effort basis and depends on how the target app/window is built and
rendered.

## When it may not work
* Windows with special rendering pipelines (e.g., certain
hardware-accelerated / compositor-managed surfaces).
* Some tool/popup/owned windows where the foreground window isn’t the
actual surface being drawn.

## How it works (high-level)
* Resolve the best target window (preferring the top-level/root window
over transient children).
* Apply Windows’ standard layered-window alpha mechanism (per-window
opacity) to adjust transparency.
* When unpinned, Restore the original opacity/state when possible.

If transparency doesn’t change, it means the window doesn’t support this
mechanism in its current configuration.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [X] Closes: 
#43278 
#42929
#28773

<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed


https://github.com/user-attachments/assets/c97a87f2-3126-4e19-990f-8c684dbeb631

<img width="1119" height="426" alt="image"
src="https://github.com/user-attachments/assets/547671ee-81d3-4c94-8199-bf0c4b1b7760"
/>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@vanzue vanzue added this to the PowerToys 0.97 milestone Feb 9, 2026
@vanzue vanzue added the Product-Always On Top Refers to the idea of a Always on Top Powertoy label Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Always On Top Refers to the idea of a Always on Top Powertoy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants