Closed cah42 closed 1 year ago
I'm sorry, but I don't fully understand what you mean with custom events. Could you explain a bit more?
It seems like what you want to do should be possible with our script engine though: https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/wiki/How-to-add-custom-scripts
Just create an entry for your dark.bat and light.bat there and ADM will call them on switch.
You can add sth like this to the scripts file (more info and documentation in the link above)
- Name: MyDarkApp
Command: cmd
ArgsLight: [/c, 'X:\path\to\batch\mylightcustomscript.bat']
ArgsDark: [/c, 'X:\path\to\batch\mydarkcustomscript.bat']
AllowedSources: [Any]
Auto Dark Mode will then run that batch file on switch and will log that and also output the callees stdout/stderr
Example:
For this config:
- Name: TestCMD
Command: cmd
ArgsLight: [/c, 'C:\Users\Sam\AppData\Roaming\AutoDarkMode\test.bat']
ArgsDark: [/c, 'C:\Users\Sam\AppData\Roaming\AutoDarkMode\test.bat']
AllowedSources: [Any]
test.bat:
echo hello
service.log:
2023-05-13 03:17:20 | Info | HotkeyHandler.RegisterAllHotkeys: hotkey signal received: toggle theme
[...]
2023-05-13 03:17:24 | Info | ScriptHandler.Launch: running TestCMD: "cmd" "/c" "C:\Users\Sam\AppData\Roaming\AutoDarkMode\test.bat"
2023-05-13 03:17:24 | Info | ScriptHandler.Launch: TestCMD's output:
C:\Windows\System32>echo hello
hello
You can open the scripts configuration file here and then enable them after you're done with setting everything up.
No updates have been provided to this issue after 60 days of inactivity. The issue will be automatically closed in 7 days.
Sorry for the late response! I totally missed your reply.
Custom scripts is exactly what I was looking for. Thanks for pointing me in that direction.
I am a happy user of AutoDarkMode, using hotkeys to switch between light and dark.
However, some of my core applications, eg. WezTerm, does not follow the system theme, but has its own configuration file. I then run a dark.bat with a content like:
to replace the theme configuration in the config file from light the dark.
Instead of this manuel process, it would be grand, if we had the possibility to fill out two custom events, SwitchToLightEvent and SwitchToDarkEvent. Each maybe just a edit we could fill out with a custom command or path to a bat with the commands needed to complete the theme switch fully.