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

Proposal to incorporate with the WinDynamicDesktop project

Open Gravifer opened this issue 2 years ago • 2 comments

Both ADM and WDD are now essential to my daily experiences, and as great projects they work marvellously alongside each other. In recent iterations, both projects are exploring the idea of add-on scripts, which I realize that the main purpose, at least for now, is to implement some features of the other project, who has invested great effort to polish. Maybe it's a good time to make the two projects collaborate, which some users seem to already desire. I am not familliar with the history of both communities, so this may be an abrupt suggestion. As a crude idea I think the following would be welcome:

  1. Integrated finctionalities. Depending on the compatability of the codebases, this may be achieved in several different ways:
  • Merge the codebases and create a monolithic project.
  • Expose agreed-upon ABI to each other.
  • Interoperate via some commandline interface.
  1. Shared script scheduling. Right now there is major overlap in the capabilities of the script engines. In the future, both projects may share a common engine for scheduled scripts. Considering the current status of the engines, this may result in a more mordern, versatile and connected tool compared to the archaic Windows native scheduled-task functionality.

mirror at WDD

Gravifer avatar May 21 '22 07:05 Gravifer

To respond to the request of integrated functionalities

Merge the codebases and create a monolithic project.

That's the one point that is probably the least likely to happen. It would require either projects to heavily compromise and give up their vision for the project.

Expose agreed-upon ABI to each other.

ADM already has a way to talk to it via windows namedpipes. Any application that wanted to could use our client implementation that is available in C# https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/blob/master/AutoDarkModeComms/PipeClient.cs

and Rust https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/blob/master/adm-updater-rs/src/comms.rs

Since we mainly operate in C# it is also declared as an interface https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/blob/master/AutoDarkModeComms/IMessageClient.cs

Interoperate via some commandline interface.

In addition, Auto Dark Mode also offers a command line interface that wraps the aforementionied windows pipes client. https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/wiki/Command-line-arguments-%7C-parameters

If any developer from another project wanted to collaborate, those two options should be quite painless and depending on the feasibility we'd be open to integrating new functionality into our pipe server to talk to and interact with other applications

To respond to your second inquiry about script scheduling

ADM and WDD operate, as far as I know in a different way. While WDD updates multiple times a day, ADM updates at two set times in a day and synchronizes themes based on WMI driven events. I'm not really sure how one would combine these, I would suggest that people may use either ours or WDDs depending on what they prefer/fits their use case best.

Spiritreader avatar May 21 '22 09:05 Spiritreader

I made a script to automatically change the background to match the system light/dark mode.

I thought I'd share how to achieve this here as I have seen a few people requesting this feature. Show the file extensions in file explorer. Copy the settings.json to the C:\ drive changing and add .light to the end of the file name - repeat this step and rename the other dark.

Open each file in Notepad.

Find the following line and make sure the dark file has the following, change the light file to say false. "darkMode": true,

Download AutoHotKey and use the following script. Change your username to match your system.

^F1:: Process, Close, WinDynamicDesktop.exe Sleep, 1000 Run powershell Remove-Item -Path C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json Sleep, 6000 Run powershell Copy-Item "C:\settings.json.dark" -Destination "C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json" RegWrite, REG_DWORD, HKEY_CURRENT_USER\SOFTWARE\Stoic Joker's\T-Clock 2010\Clock, ForeColor, 16777215 Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force Sleep 1000 Run, C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\WinDynamicDesktop.exe return ^F2:: Process, Close, WinDynamicDesktop.exe Sleep, 1000 Run powershell Remove-Item -Path C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json Sleep, 6000 Run powershell Copy-Item "C:\settings.json.light" -Destination "C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json" RegWrite, REG_DWORD, HKEY_CURRENT_USER\SOFTWARE\Stoic Joker's\T-Clock 2010\Clock, ForeColor, 0 Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1 -Type Dword -Force Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1 -Type Dword -Force Sleep, 10000 Run, C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\WinDynamicDesktop.exe return

Now when you press Ctrl key and F1 it will change the system theme and the wallpaper to dark mode. Pressing Ctrl and F2 for the light system mode and wallpaper.

I need to improve the script as I don't want the Powershell windows to appear but this does the job.

The code above also changes the T-Clock text colour to white/black so it is readable when switching modes as it doesn't happen automatically so if you don't use this you can just remove it.

You can also use this with AutoDarkMode by replacing the two lines above Sleep, 1000 with SendInput, ^{9} - change the Hotkey to match the ones you have set up in the AutoDarkMode app.

I hope this helps!

My-Name-Is-Adam avatar Jun 17 '22 07:06 My-Name-Is-Adam