t1m0thyj / WinDynamicDesktop

Port of macOS Mojave Dynamic Desktop feature to Windows
https://windd.info
Mozilla Public License 2.0
4.39k stars 292 forks source link

Wrong image on a desktop #594

Open Meelee35 opened 4 months ago

Meelee35 commented 4 months ago

Steps to Reproduce:

  1. Start windynamicdesktop
  2. Press on the desktop icon in taskbar, switch to desktop 2.
  3. See that the desktop background is the correct image, then fades to either the wrong time or your original desktop background.

Are you using the Microsoft Store version of WDD?: Yes/No No

Desktop 1 displays the correct image for the time of day. image Desktop 2 is stuck on image it was when i last refreshed from the WDD menu on that desktop. image

May i also add that using the sync desktop wallpaper script does not work, scripts are enabled.

t1m0thyj commented 3 months ago

@Meelee35 Thanks for reporting this!

I've just pushed an update to the SyncVirtualDesktops script that fixes an error it could throw about the Nuget package provider failing to install: https://github.com/t1m0thyj/WDD-scripts/blob/master/experimental/SyncVirtualDesktops.ps1

With the latest version of the script, changing the wallpaper across multiple desktops is working fine for me. Could you try installing the updated script and switching between 2 different themes with it enabled? The behavior I'm seeing is that the wallpaper changes on both Desktop 1 and 2.

treispezeronoua commented 2 months ago

Hi! I'm using the latest version of WDD, downloaded from GitHub, along with the SyncVirtualDesktops.ps1 script.

The wallpaper doesn't update automatically on the second etc virtual desktop. Tried different themes, no luck. I'm using Windows 11 22H2, build 22621.3880.

t1m0thyj commented 2 months ago

After creating multiple virtual desktops, could you try running the following command in a PowerShell terminal and let me know what happens? This is the same method used by the SyncVirtualDesktops.ps1 script. It should set the wallpaper across all virtual desktops to be the default Windows 11 Bloom wallpaper.

Get-DesktopList | ForEach-Object { Set-DesktopWallpaper -Desktop $_.Number -Path "C:\Windows\Web\Wallpaper\Windows\img0.jpg" }
treispezeronoua commented 2 months ago

@t1m0thyj When running the above command from your comment I get the following:

Get-DesktopList : The 'Get-DesktopList' command was found in the module 'VirtualDesktop', but the module could not be loaded. For more information, run 'Import-Module VirtualDesktop'. At line:1 char:1

Then, if I run 'Import-Module VirtualDesktop' in terminal, I get:

Import-Module : File C:\Users\user\OneDrive\Documents\WindowsPowerShell\Modules\VirtualDesktop\1.5.1\VirtualDesktop.psm1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1

Lastly, by running the 'Get-ExecutionPolicy -List' command, I get:

Scope ExecutionPolicy


MachinePolicy Undefined UserPolicy Undefined Process Undefined CurrentUser Undefined LocalMachine Undefined

If I change the execution policy to allow running scripts, by running the initial command from your comment I get the following:

The type initializer for 'VirtualDesktop.DesktopManager' threw an exception. At C:\Users\user\OneDrive\Documents\WindowsPowerShell\Modules\VirtualDesktop\1.5.1\VirtualDesktop.ps1:1070 char:16

t1m0thyj commented 2 months ago

@treispezeronoua Thanks for the detailed response! Based on the error message, you have v1.5.1 of the PS VirtualDesktop module installed. This version is 2 years old and doesn't support recent builds of Win11.

If you have the latest version of SyncVirtualDesktops.ps1, it's supposed to detect when Windows has been updated to a new build and automatically update the VirtualDesktop module for you, but this may not be working as intended. In the "scripts" folder alongside SyncVirtualDesktop.ps1 there should be another file named "SyncVirtualDesktops.dat". Could you please attach the contents of this file if exists?

For now manually updating the VirtualDesktop module should fix the problem. In a PowerShell terminal that allows running scripts, run this command to update to the latest version v1.5.8: Update-Module -Name VirtualDesktop. After the update is successful, the SyncVirtualDesktops.ps1 script should work in WinDD.

treispezeronoua commented 2 months ago

@t1m0thyj Thank you for your reply!

I couldn't find the .dat file in the scripts folder, but I managed to get the WDD to sync the wallpaper across virtual desktops.

To do that, I deleted VirtualDesktop v1.5.1 and reinstalled it using the 'Install-Module VirtualDesktop' command, which installed v1.5.8. Once the VirtualDesktop module was installed, I then set the Execution Policy to Unrestricted using the 'Set-ExecutionPolicy -ExecutionPolicy Unrestricted' command.

Finally, to test that everything was working as expected, I ran your command, 'Get-DesktopList | ForEach-Object { Set-DesktopWallpaper -Desktop $_.Number -Path "C:\Windows\Web\Wallpaper\Windows\img0.jpg" }'.

Thank you for helping me with this!

t1m0thyj commented 2 months ago

@Meelee35 Does the workaround mentioned in https://github.com/t1m0thyj/WinDynamicDesktop/issues/594#issuecomment-2273120021 work for you as well?