Windows-Auto-Night-Mode icon indicating copy to clipboard operation
Windows-Auto-Night-Mode copied to clipboard

Suggestion/request: Slideshow wallpapers

Open iliadaili opened this issue 3 years ago • 18 comments

Hi! I installed auto Dark Mode and, after installing it, I saw that it had the option to set up different wallpapers for light mode and dark mode. I thought that was very cool, but I ended up deciding not to use it, because I like having a slideshow wallpaper for Windows and I would lose that option if I opted for Dark Mode's light and dark mode wallpapers. So, my suggestion is precisely for the addition of an option to set up two different slideshows for light mode and dark mode, being able to choose two different image folders to be presented in each theme. I don't know anything about coding, but this seems like it would be very complicated, so I'm really just throwing this out there and I'll understand if it's a very low priority addition. Thank you for this great app!

iliadaili avatar Aug 16 '21 15:08 iliadaili

You can use Windows Themes switch, just switch the mode at the top UI.

Armin2208 avatar Aug 16 '21 16:08 Armin2208

Essentially, what we need for slideshows is:

Backend

  • [ ] A new WallpaperType called Slideshow https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/blob/f34801f1a33f59188523155ac9dd566c04aee163/AutoDarkModeLib/ComponentSettings/Base/WallpaperSwitchSettings.cs#L42
  • [ ] A new class in the WallpaperSwitchSettings.cs file that has the following properties:
    • [ ] Interval: Integer for slideshow interval
    • [ ] Shuffle: Boolean whether the slideshow should shuffle
    • [ ] ImagesRootPath: String to point to where the slideshow directory is
    • [ ] OPTIONAL for now (can implement later) ItemPaths: List of strings that contain which items in a directory should be selected
  • [ ] Logic in the Wallpaper switching class to handle a new wallpaper type
    • [ ] TypeNeedsUpdate logic to determine if the slideshow config has changed
    • [ ] HandleSwitchByType switching logic to set slideshow and log it via LogHandleSwitch
    • [ ] Write logic to retrieve initial slideshow state

Frontend

  • [ ] New type dropdown menu called slideshow on the wallpaper picker page image
  • [ ] File picker for slideshow folder
  • [ ] OPTIONAL: File picker for specific images
  • [ ] List of files or mosaic preview of images (depending on feasibility)
  • [ ] Logic to update the config file with new slideshow config data

If anyone wants to help or contribute, feel free to reach out.

Spiritreader avatar Nov 23 '22 03:11 Spiritreader

I don't know if it's an issue on Windows or the app itself, but creating two custom Windows 11 themes for dark and light, with both of them having two seperate or the same diaporama for the desktop background totally break the diaporamas and create weird results (going back to single images, diaporama stopping and not moving anymore etc.) when switching modes (with the app or not). So maybe this could be a great solution.

Matthysse avatar Feb 21 '23 21:02 Matthysse

I applied separate light and dark themes within the AutoDark app and both themes are set to do a slideshow that updates every day, but whenever it switches from light to dark or vice-versa it reverts back to whatever is the first image in the folder, so unless I manually switch it (right-click the desktop and click "next desktop background") I only ever get one picture for dark mode and one picture for light mode. I don't know if this is a problem with Windows or with the app or if there's anything I can do about it.

Syberyah avatar Jan 21 '24 06:01 Syberyah

I applied separate light and dark themes within the AutoDark app and both themes are set to do a slideshow that updates every day, but whenever it switches from light to dark or vice-versa it reverts back to whatever is the first image in the folder, so unless I manually switch it (right-click the desktop and click "next desktop background") I only ever get one picture for dark mode and one picture for light mode. I don't know if this is a problem with Windows or with the app or if there's anything I can do about it.

grafik Do you have picture shuffle enabled?

Armin2208 avatar Jan 21 '24 18:01 Armin2208

Yes, I do have them on shuffle. I meant to include that in the post, sorry!

On Sun, Jan 21, 2024, 1:01 PM Armin Osaj @.***> wrote:

I applied separate light and dark themes within the AutoDark app and both themes are set to do a slideshow that updates every day, but whenever it switches from light to dark or vice-versa it reverts back to whatever is the first image in the folder, so unless I manually switch it (right-click the desktop and click "next desktop background") I only ever get one picture for dark mode and one picture for light mode. I don't know if this is a problem with Windows or with the app or if there's anything I can do about it.

grafik.png (view on web) https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/assets/32982430/3ec371d2-fbaa-40f9-8654-bdd88e91284a Do you have picture shuffle enabled?

— Reply to this email directly, view it on GitHub https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/issues/247#issuecomment-1902711501, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFP3ZMK7BAWJNSIYL7I6CFLYPVJV7AVCNFSM5CIAPO4KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJQGI3TCMJVGAYQ . You are receiving this because you commented.Message ID: @.***>

Syberyah avatar Jan 21 '24 18:01 Syberyah

I applied separate light and dark themes within the AutoDark app and both themes are set to do a slideshow that updates every day, but whenever it switches from light to dark or vice-versa it reverts back to whatever is the first image in the folder, so unless I manually switch it (right-click the desktop and click "next desktop background") I only ever get one picture for dark mode and one picture for light mode. I don't know if this is a problem with Windows or with the app or if there's anything I can do about it.

I don't think that's actually fixable with windows themes at all because they don't remember the wallpaper state that they were in before. Putting it into shuffle should work but probably not if the slideshow time is set so high that the first image stays around for too long. The thing is, ADM isn't really a wallpaper switcher, and more of a theme switcher.

So it's out of scope for this project to re-create a program that switches wallpapers, as opposed to switching your wallpaper when the theme switches once per day.

If that is truly a windows limitation, there's nothing we can really do when it comes to the issue you're facing.

Spiritreader avatar Jan 21 '24 21:01 Spiritreader

Okay. Thanks for reaching out! I'll play with the settings a bit more and see if anything works, but I understand there's nothing you can do. The app does help me a lot, though, so thank you for creating and maintaining it (and making it free)!

On Sun, Jan 21, 2024, 4:31 PM Sam @.***> wrote:

I applied separate light and dark themes within the AutoDark app and both themes are set to do a slideshow that updates every day, but whenever it switches from light to dark or vice-versa it reverts back to whatever is the first image in the folder, so unless I manually switch it (right-click the desktop and click "next desktop background") I only ever get one picture for dark mode and one picture for light mode. I don't know if this is a problem with Windows or with the app or if there's anything I can do about it.

I don't think that's actually fixable with windows themes at all because they don't remember the state that they were in before. Putting it into shuffle should work but probably not if the slideshow time is set so high that the first image stays around for too long. The thing is, ADM isn't really a wallpaper switcher, and more of a theme switcher.

So it's out of scope for this project to re-create a program that switches wallpapers, as opposed to switching your wallpaper when the theme switches once per day.

If that is truly a windows limitation, there's nothing we can really do when it comes to the issue you're facing.

— Reply to this email directly, view it on GitHub https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/issues/247#issuecomment-1902770669, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFP3ZMN5KRMYERY7JYACHEDYPWCLFAVCNFSM5CIAPO4KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJQGI3TOMBWGY4Q . You are receiving this because you commented.Message ID: @.***>

Syberyah avatar Jan 21 '24 21:01 Syberyah

Okay. Thanks for reaching out! I'll play with the settings a bit more and see if anything works, but I understand there's nothing you can do. The app does help me a lot, though, so thank you for creating and maintaining it (and making it free)! On Sun, Jan 21, 2024, 4:31 PM Sam @.> wrote: I applied separate light and dark themes within the AutoDark app and both themes are set to do a slideshow that updates every day, but whenever it switches from light to dark or vice-versa it reverts back to whatever is the first image in the folder, so unless I manually switch it (right-click the desktop and click "next desktop background") I only ever get one picture for dark mode and one picture for light mode. I don't know if this is a problem with Windows or with the app or if there's anything I can do about it. I don't think that's actually fixable with windows themes at all because they don't remember the state that they were in before. Putting it into shuffle should work but probably not if the slideshow time is set so high that the first image stays around for too long. The thing is, ADM isn't really a wallpaper switcher, and more of a theme switcher. So it's out of scope for this project to re-create a program that switches wallpapers, as opposed to switching your wallpaper when the theme switches once per day. If that is truly a windows limitation, there's nothing we can really do when it comes to the issue you're facing. — Reply to this email directly, view it on GitHub <#247 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFP3ZMN5KRMYERY7JYACHEDYPWCLFAVCNFSM5CIAPO4KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJQGI3TOMBWGY4Q . You are receiving this because you commented.Message ID: @.>

Sure thing! As soon as we're aware of any fix, we'll of course implement it. One thing that we could possibly do:

You mentioned the "right-click the desktop and click "next desktop background" function. If you can find an API call we can make (automatically call this via command line or something) we could at least integrate doing the "next desktop background" switch automatically when a user selects a theme with a slideshow. It would still briefly show the first wallpaper in the collection, but then fix itself. As a possible workaround.

Spiritreader avatar Jan 21 '24 23:01 Spiritreader

You mentioned the "right-click the desktop and click "next desktop background" function. If you can find an API call we can make (automatically call this via command line or something) we could at least integrate doing the "next desktop background" switch automatically when a user selects a theme with a slideshow. It would still briefly show the first wallpaper in the collection, but then fix itself. As a possible workaround.

Hiya! I was doing some research on this and managed to implement it as an AutoHotkey script. I uploaded my code with extensive comments on how it works here: https://gist.github.com/zlrc/2e452daac77ff87d321198e0d8414cbf

Turns out, automating this sort of functionality was a lot more complicated than I thought, as existing scripts I found online were written for an older version of AutoHotkey and were esoteric in their implementation. Fortunately, I learned a few things that I hope would be valuable for implementing the workaround in Auto Dark Mode.

Basically the method you're looking for is IDesktopWallpaper::AdvanceSlideshow, which is declared in shobjidl_core.h of the Windows API. In my AutoHotkey script, I had to call this function by its virtual method table index.

The Windows API isn't my area of expertise, so I'm sure someone else here might have a better idea on where to proceed. I did happen to find a stackoverflow answer that goes into a bit more detail on the IDesktopWallpaper interface, in case that might be of any informative use.

Anyhow, I see that the Discussions board is the proper place for ADM scripts. If there is any interest, I can add my script and it's yaml configurations to that repository when I have time later.

zlrc avatar Apr 22 '24 03:04 zlrc

@zlrc That is really cool! Pretty much exactly what we're looking for!

Turns out, automating this sort of functionality was a lot more complicated than I thought,

Sadly that is always the case when interacting with anything Windows & theming 😆

With this we can send a "next slideshow element" command automatically when the shuffle toggle is enabled to ensure a different picture shows up. That should manifest in direct improvement!

Anyhow, I see that the Discussions board is the proper place for ADM scripts.

This was absolutely the right place to let us know, but of course if you like you can create an adm userscript hook for it!

I'm at 99,9% capacity with work, university and some sysadmin stuff I'm involved in, so I'm not sure when I'm going to have time to implement it. But this is a huge help, thank you!

Spiritreader avatar Apr 22 '24 09:04 Spiritreader

@Syberyah, @zlrc

I've pushed a new beta (12.4.2.16) build that automatically forwards the slideshow by one position if the mode is in shuffle on switch.

Please test

Spiritreader avatar Apr 24 '24 21:04 Spiritreader

@zlrc @Spiritreader Thank you guys for going to the trouble to make this work! Where do I find the beta to download it? Sorry, I'm not good with Github at all.

Syberyah avatar Apr 26 '24 01:04 Syberyah

@zlrc @Spiritreader Thank you guys for going to the trouble to make this work! Where do I find the beta to download it? Sorry, I'm not good with Github at all.

You switch to the beta in the auto dark Mode app itself. There's a section under settings where you can select the beta branch and then hit "check for updates"

Spiritreader avatar Apr 26 '24 06:04 Spiritreader

@Spiritreader Awesome! A couple things after taking a look:

  1. I got a pop-up error after attempting to toggle themes on the beta branch: "The method or operation is not implemented." Exception text below:
System.NotImplementedException: The method or operation is not implemented.
   at AutoDarkModeSvc.Handlers.WallpaperHandler.IDesktopWallpaper.AdvanceSlideshow(String monitorID, DesktopSlideshowDirection direction)
   at AutoDarkModeSvc.Handlers.WallpaperHandler.AdvanceSlideshow(DesktopSlideshowDirection direction) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Handlers\WallpaperHandler.cs:line 294
   at AutoDarkModeSvc.Core.ThemeManager.UpdateTheme(SwitchEventArgs e) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Core\ThemeManager.cs:line 352
   at AutoDarkModeSvc.Core.ThemeManager.RequestSwitch(SwitchEventArgs e) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Core\ThemeManager.cs:line 60
   at AutoDarkModeSvc.Core.ThemeManager.SwitchThemeAutoPauseAndNotify() in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Core\ThemeManager.cs:line 137
   at AutoDarkModeSvc.Service.ToggleTheme(Object sender, EventArgs e) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Service.cs:line 351
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
  1. Might I suggest adding a random chance that AdvanceSlideshow does not get called at all? I assume in this current implementation, the first wallpaper will always be skipped, and thus never used as the "first" in the slideshow after a theme switch. This likely isn't a problem if the shuffled slideshow is set to change wallpapers often, since that first wallpaper will show up again eventually. However, it might not be ideal for slideshows configured to change wallpapers after several hours.
    • My script, for example, is configured to have a 1 in 6 chance to not execute AdvanceSlideshow because I have 6 images in my slideshow folder. I haven't figured out how the number of images could be determined automatically yet, so I have that number hardcoded into the script at the moment.

zlrc avatar Apr 30 '24 01:04 zlrc

@Spiritreader Awesome! A couple things after taking a look:

1. I got a pop-up error after attempting to toggle themes on the beta branch: "The method or operation is not implemented." Exception text below:
System.NotImplementedException: The method or operation is not implemented.
   at AutoDarkModeSvc.Handlers.WallpaperHandler.IDesktopWallpaper.AdvanceSlideshow(String monitorID, DesktopSlideshowDirection direction)
   at AutoDarkModeSvc.Handlers.WallpaperHandler.AdvanceSlideshow(DesktopSlideshowDirection direction) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Handlers\WallpaperHandler.cs:line 294
   at AutoDarkModeSvc.Core.ThemeManager.UpdateTheme(SwitchEventArgs e) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Core\ThemeManager.cs:line 352
   at AutoDarkModeSvc.Core.ThemeManager.RequestSwitch(SwitchEventArgs e) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Core\ThemeManager.cs:line 60
   at AutoDarkModeSvc.Core.ThemeManager.SwitchThemeAutoPauseAndNotify() in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Core\ThemeManager.cs:line 137
   at AutoDarkModeSvc.Service.ToggleTheme(Object sender, EventArgs e) in D:\Code\Repos\AutoDarkMode\Windows-Auto-Night-Mode\AutoDarkModeSvc\Service.cs:line 351
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
2. Might I suggest adding a random chance that `AdvanceSlideshow` does _not_ get called at all? I assume in this current implementation, the first wallpaper will always be skipped, and thus never used as the "first" in the slideshow after a theme switch. This likely isn't a problem if the shuffled slideshow is set to change wallpapers often, since that first wallpaper will show up again eventually. However, it might not be ideal for slideshows configured to change wallpapers after several hours.
   
   * My script, for example, is configured to have a 1 in 6 chance to not execute `AdvanceSlideshow` because I have 6 images in my slideshow folder. I haven't figured out how the number of images could be determined automatically yet, so I have that number hardcoded into the script at the moment.

Hmm the error message indicates that the AdvancedSlideshow api call doesn't exist

Need to look into this more. You have this working on the same machine with your ahk script?

Spiritreader avatar Apr 30 '24 05:04 Spiritreader

Need to look into this more. You have this working on the same machine with your ahk script?

Yes, this is on the same machine. I made sure the script was disabled while testing the beta branch.

zlrc avatar Apr 30 '24 20:04 zlrc

@zlrc sorry for the wait!

Got it figured out now, turns out the windows API does not actually allow specifying device paths and will advance slideshows round-robin on multiple monitor setups.

As far as this is concerned:

Might I suggest adding a random chance that AdvanceSlideshow does not get called at all?

Since on a theme switch there is no change to the slideshow (yet), not calling this will actually result in a chance that the slideshow is not forwarding when the theme is changed, thus appearing stuck. At the moment I would say this is more undesirable than having to wait one full cycle to view the first image of the randomized set (it will show up, just as the last image so to say). However, in the future when the ADM managed mode allows setting different slideshows, it would make sense if the generated random set is always the same.

For now though I've omitted a random chance, since our internal wallpaper handler doesn't support changing to differrent slideshow folder yet on themes switch, and the unmanaged mode (aka full theme switching) is not our responsibility to manage, but that of the user.

In any case, please try again to see if it works now!

I've pushed a new beta build (10.4.2.20) which should be available in the coming hour.

Spiritreader avatar May 08 '24 22:05 Spiritreader