-
Notifications
You must be signed in to change notification settings - Fork 73
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
[HOWTO] EventScripter Script to Re-Apply Dark Theme After Updates #32
Comments
Wow, @andrewjmetzger I godda say, thats not bad work your done here! Way above my head for sure! |
Thanks! Would you mind testing it first, please? I only have one system running JD2, and more proof that everything works is always welcome. 😉 Note: If you do any testing, use a super short interval like 60000 milliseconds (1 minute) or something to avoid waiting so long for a restart. |
So... I'm dunce, but why do I not see anything related to the actual "files" that are needed to "reapply" the Theme? After every update, I have to drag and drop the syntheticaBlackEye.jar into the folder structure of JDownloader. |
Hey @leeuniverse, great question! Normally, to reapply the theme after an update, all you need to do is restart JDownloader 2 (JD2) a second time -- once by clicking the update button, and once more from the File menu. You shouldn't have to reinsert any JARs unless you completely wipe your settings or reinstall the program. The "trick" discussed in this issue doesn't rely on modifying JD2 files at all. Instead, it uses the built-in Event Scripter plugin to:
To add this to your JD2 install, you only need to enable the Event Scripter and add the scripts at the top of this issue. For more information on the Event Scripter plugin, check out the official docs and this list of curated community scrips. Let me know if there is anything I can do to further explain or assist you. 😃 |
Hummm.... Now I think I realize what's happening. The author has Two install instructions. One in which you change a backup file and I guess it's just one and done? And then another which has an already fully edited .JAR file. Now that I think about it, the first one I guess would work with your method. So, I guess that's why I was confused. LOL P.S., since you are on the ball, I figure I'll just ask you. ;) |
Both instructions work with this script. You can absolutely use a backup as the author directs, then unzip that and add the green progress bars to the JAR. The steps in this thread should only be followed AFTER the black theme is installed to your satisfaction, including any tweaks such as green progress bars. Edit: Fixed typos. |
Apologies, I did not mean to close this issue. 🙃 |
As for the system bar command, you are correct, that is intended to go in the Mac terminal. if the command in the wiki doesn't work, are you using Windows? On Windows 10, change the accent color in Settings -> Personalization -> Colors:
Otherwise, please post your macOS version (Check this using the Apple menu on the top left of the system bar -> About this Mac). |
Thanks... That sort of works. For some reason, it is also changing the color of the Windows Text Links on the Right of that Setting page. So, unfortunately, can't use too much of a dark color, otherwise can't read the links. LOL BTW, the script you created above, is there also one you can make that will automatically transfer over the JAR file from one location to replace the one that's replaced on Update? So, as you might know, his download includes already a fully edited (or near to it) Theme JAR file which we can just use to replace the program's theme JAR (save the Title Bar sadly). So on most updates, we have to replace that JAR file again because it gets overwritten on the update to be the default dark Black_Eye theme again. Thus, it would be nice for the replacing of that file to be done automatically for us like your script does after updating on restart or whatever. Thanks. |
To clarify, the script in this thread does NOT touch any JARs. Assuming the green progress bars are installed correctly, these things happen when JD2 updates:
If the advanced settings are configured correctly, you only have to replace files once per system. |
BTW, there are also some images in the Dark Theme found at JDownloader 2.0\themes\standard\org\jdownloader\images\exttable\ which are "White" instead of the "black" ones that are default. Anyway, either way, can you make a version of the script which copies/pastes the JAR file after the update? Thanks |
EventScripter can't modify core files, unfortunately it's very limited to controlling running downloads and the program itself. The proper way to install the green progress bars is to pack your own theme JAR. if you do that it will not revert after any update. |
So... apparently, you have to use one of the "existing" Themes as the Author did, since I guess he doesn't have access or know how to add his own JAR theme? So, I apparently can't just "rename" the JAR to something else. Seems it's a more complicated thing otherwise the author would have done it. |
As a point of clarification, here is how to propery apply the green progress bars, so that they persist after JD2 is updated. As described above, they will briefly vanish mid-update when JD2 turns white, but a second restart should fix that and restore the customized theme.
|
Just saw your last post... yes this is currently a JD2 limitation, so the theme MUST use the same name, at least for now. Issue #13 tracks the progress of making this repo an official theme. |
This script appears to have broken and needs some adjustment? Now it no longer restarts the 2nd time, even after adding multiple callAPI system restartJD lines. |
👋 Hi @ChaoticHolon! Thank you for letting me know that you're not seeing the dark theme applied as expected. I'm sad to say that we're limited in exactly how we can debug this, since the partially-applied theme we're trying to fix only occurs after a JDownloader 2 (JD2) update, so we'd have to wait for one, deliberately not apply the update, and run this script to test whether the restarts worked. We could deliberately downgrade JD2, although that seems less than ideal. 😞 Admittedly, I haven't updated the script in a while (I don't use the dark theme on my server). I have a funny feeling that JD2 doesn't "keep track" of script execution across restarts anymore, though. When this script was working as intended, the second restart would occur either right away (if you were lucky) or you'd be waiting around for the next occurrence of that Interval-based trigger. In other words, you'd be staring at a partially-applied JD2 theme for 10 minutes, maximally (if using the suggested Interval). Unless you were staring at JD2 during that brief window, you may have never seen it (which was very much by design). With some update during the last year, it seems this behavior has changed. Using the script as it exists in v1.1.0 is quite literally a non-starter (heh). There are a couple of possible work-around solutions depending on how far you'd like to take this, but all of them are way beyond the scope of this issue. If you're curious, I've outlined them at the bottom. 🙂 Thanks and make it a great day, So, if the original solution's out, let's get creative... 😉 There is no native JD2 CLI to just do
On Windows, we could use something like AutoHotKey to do this for us. On Windows/Linux/macOS, I'm sure we could do something similar and Automate the Boring Stuff with Python. |
So, just a mention to you all.... I've just been replacing the JAR file every update when it's needed, which isn't always, haven't had problems yet. I don't do anything else fancy like the Terminal stuff or otherwise. So, other than the Top Border Bar being the system default, I always have the nice black theme the creator made. |
Hey @leeuniverse, that's a great point! If I were to do this again today, I'd take a similar approach. Replacing the JAR would also be easy to add into any JD2 launch shortcut, I've included some untested scripts here if anyone wants to try this: REM This is a Windows batch script
REM Save as themeJD2.bat or similar.
REM Setup: Make changes to syntheticaBlackEye.jar such as green progress bars etc
REM and save a copy elsewhere (the first path in the copy).
REM This script will restore the custom syntheticaBlackEye.jar
REM to JD2's directory before every launch (the second path in the copy).
@echo off
copy /b /v /y "/path/to/modified/copy/of/syntheticaBlackEye.jar" "/path/to/JDownloader/libs/laf/syntheticaBlackEye.jar"
start jdownloader2.exe
exit #!/usr/bin/env bash
# This is a Bash script for linux and possibly macOS.
# Save as themeJD2.sh or similar.
# Setup: Make changes to syntheticaBlackEye.jar such as green progress bars etc.
# Save a copy elsewhere (the first path in the copy).
# This script will restore the custom syntheticaBlackEye.jar
# to JD2's directory before every launch (the second path in the copy).
cp -f "/path/to/modified/copy/of/syntheticaBlackEye.jar" "/path/to/JDownloader/libs/laf/syntheticaBlackEye.jar"
# JD2 should be in your PATH, so this will launch it.
jdownloader &
disown
exit
Ha! Good luck with that. I think the JD2 team have their hands full with other issues. Lots of backlog in their bug tracker. They're doing a good job, though, so I can't really complain. EDIT: Fixed a syntax error in the Windows batch script (misplaced space) |
Why this exists
After installing the rather excellent dark theme, I was frustrated that updates temporarily broke the theme until JDownloader 2 was restarted again. So, I looked up the API calls, and created a script for the Event Scripter plugin to work around the bug. This Event Scripter script will check for updates periodically, apply them if JDownloader 2 if it is idle, and then automatically restart JDownloader2 again to fix the dark theme.
To use this, enable Event Scripter from Settings -> Plugins. Then, add a new script with an Interval trigger. Set the trigger to a much longer delay, enable synchronous execution by checking the box, and paste the script from below. Scroll down for detailed instructions.
Headless users only -- here is the same script with no line breaks:
Detailed Instructions
IMPORTANT: For the first time run, you must allow the script to use the Interval permission. Afterwards, the script will run automatically.
Update and Re-apply theme
600000
milliseconds (10 minutes)@Vinylwalk3r if you like this script and want to include it in the repo, the JSON "headless" script can be added to
./cfg/org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json
under the JDownloader 2 installation directory. Note that this still requires the user to install and enable Event Scripter beforehand. Let me know and I'm happy to create a PR.Hope this helps!
@andrewjmetzger
Changelog:
Version 1.0.1 - 2021-03-19:
Version 1.0.0 - 2021-03-19:
The text was updated successfully, but these errors were encountered: