Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FancyZones]: workspace/virtual desktop <-> layout mapping #11125

Closed
1 task
manuelserradev opened this issue May 6, 2021 · 10 comments
Closed
1 task

[FancyZones]: workspace/virtual desktop <-> layout mapping #11125

manuelserradev opened this issue May 6, 2021 · 10 comments
Labels
Issue-Bug Something isn't working Product-FancyZones Refers to the FancyZones PowerToy Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Severity-Regression This was working in a previous release

Comments

@manuelserradev
Copy link
Contributor

manuelserradev commented May 6, 2021

Microsoft PowerToys version

0.37

Running as admin

  • Yes

Area(s) with issue?

FancyZones

Steps to reproduce

  1. Setup two or more workspaces
  2. Open Fancy zone editor and use a different layout for each workspace

✔️ Expected Behavior

Fancy zones for each workspace are persisted and correctly mapped.

❌ Actual Behavior

Every Fancy zone layout change is applied to every workspace.

Other Software

System info
Edition Windows 10 Pro
Version Dev
Installed on 01-‎May-‎21
OS build 21370.1
Experience Windows 10 Feature Experience Pack 321.9601.0.3
@manuelserradev manuelserradev added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels May 6, 2021
@manuelserradev
Copy link
Contributor Author

@enricogior enricogior added the Product-FancyZones Refers to the FancyZones PowerToy label May 6, 2021
@manuelserradev
Copy link
Contributor Author

manuelserradev commented May 6, 2021

Maybe Windows vNext related, since rolling back to 0.33.1 or 0.35.0 do not solved the issue.

Also, removing temp data under %appdata%/Local/Microsoft/PowerToys/FancyZones do not solved the issue.

Update: not reproducible on Windows stable. Maybe some special label is required?

@crutkas
Copy link
Member

crutkas commented May 13, 2021

when you say workspaces, you mean virtual desktops?

@crutkas crutkas added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels May 13, 2021
@manuelserradev
Copy link
Contributor Author

manuelserradev commented May 13, 2021 via email

@ghost ghost added Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Needs-Team-Response An issue author responded so the team needs to follow up and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 13, 2021
@manuelserradev manuelserradev changed the title [FancyZones]: workspace <-> layout mapping [FancyZones]: workspace/virtual desktop <-> layout mapping May 15, 2021
@tychedelia
Copy link

This is also an issue for me. Other closed issues in this repo suggest that the layout per virtual desktop should persist, but changing layout on one desktop currently is breaking all my others.

@manuelserradev
Copy link
Contributor Author

manuelserradev commented Jun 1, 2021

From my understanding and investigation (with me being completely uncomfortable and ignorant with cpp) the issue is with the registry key not being open when CurrentVirtualDesktop is requested.

// VirtualDesktopUtils.cpp

if (RegQueryValueExW(key.get(), NonLocalizable::RegCurrentVirtualDesktop, 0, nullptr, reinterpret_cast<BYTE*>(&value), &size) == ERROR_SUCCESS)
{
    // this code never get executed
    *desktopId = value;
    return true;
}

Also experimenting with RegOpenKeyEx before requesting the value, fix the problem.

Problem is that is not very clear to me how to handle this kind of change, for example I can see the usage of wil::unique_hkey here and there.

The fix seems trivial: open before query. But looks like there is some magic to have the key always open (and thus this code is failing)?

@manuelserradev
Copy link
Contributor Author

manuelserradev commented Jun 2, 2021

The missing regkey is Software\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\1\VirtualDesktops from sessionKeyPath.

Maybe a fallback to the canonical Software\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops can be done? Maybe I can contribute that way.

manuelserradev added a commit to manuelserradev/PowerToys that referenced this issue Jun 2, 2021
@crutkas crutkas removed Needs-Team-Response An issue author responded so the team needs to follow up Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Jun 2, 2021
@crutkas
Copy link
Member

crutkas commented Jun 2, 2021

This is a valid scenario we need to address. @zadjii-msft anything else we need? @SeraphimaZ as fyi

@crutkas crutkas added the Severity-Regression This was working in a previous release label Jun 2, 2021
manuelserradev added a commit to manuelserradev/PowerToys that referenced this issue Jun 3, 2021
@manuelserradev
Copy link
Contributor Author

In the meantime I updated my local branch to use a different approach with reg key open/read (I think more RAII compliant???) by using wil::unique_hkey - the same approach used by the same code in the same scope.

Let me know if you want me to refine this branch and open or document a bit more.

Maybe this is a regression from Explorer.exe itself, but I'm now on build 21390.1 and can repro the issue.

System info Value
Edition Windows 10 Pro
}Version Dev
Installed on ‎27-‎May-‎21
OS build 21390.1
Experience Windows 10 Feature Experience Pack 321.13302.10.3

crutkas pushed a commit that referenced this issue Jun 18, 2021
* fix(#11125): fallback to canonical regkey session unaware

* chore(#11125): use wil::unique_hkey instead of HKEY for fallback CurrentVirtualDesktop

* refactor: extract new explorer current virtual desktop behavior into a separate method
@crutkas crutkas added the Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. label Jun 18, 2021
royvou pushed a commit to royvou/PowerToys that referenced this issue Jul 7, 2021
* fix(microsoft#11125): fallback to canonical regkey session unaware

* chore(microsoft#11125): use wil::unique_hkey instead of HKEY for fallback CurrentVirtualDesktop

* refactor: extract new explorer current virtual desktop behavior into a separate method
@dedavis6797
Copy link
Contributor

Resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Product-FancyZones Refers to the FancyZones PowerToy Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Severity-Regression This was working in a previous release
Projects
None yet
Development

No branches or pull requests

5 participants