darktable-org / lua-scripts

148 stars 108 forks source link

Autostart scripts #480

Closed charludo closed 1 month ago

charludo commented 1 month ago

Hi,

I know that you can simply put

require "contrib/some_script"

into luarc. This works, or at least messages logged in some_script are then shown in the darktable log.

However, the script_manager still shows the script as "stopped", and it doesn't do anything until manually toggled to "started". This is a bit annoying for scripts you'd want to be toggled on at all times.

Is there a workaround for this?

wpferguson commented 1 month ago

script_manager remembers what scripts were running when darktable shuts down, unless it crashes. That information is written to the darktablerc file. When script_manager starts it reads the darktablerc file and restarts all the scripts that were running.

script_manager only knows about the scripts that it starts. Don't use the luarc file to start scripts, just use script_manager.

EDIT:

However, leave the line that starts script_manger in the luarc file :smile:

wpferguson commented 1 month ago

I'm guessing, but were you trying to run the fujifilm script and starting it from the luarc file?

You can go into your lua directory, and create another directory (i.e. mystuff, test_scripts, ...) and then drop any extra scripts you want in there. When script_manager starts it scans for all the scripts in the lua directory (and subdirectories), so it will pick up anything new. By putting it in a separate directory you can just choose it from the category (or folder if you're riding master) dropdown and then start and stop the script from there.

charludo commented 1 month ago

script_manager remembers what scripts were running when darktable shuts down, unless it crashes. That information is written to the darktablerc file. When script_manager starts it reads the darktablerc file and restarts all the scripts that were running.

script_manager only knows about the scripts that it starts. Don't use the luarc file to start scripts, just use script_manager.

EDIT:

However, leave the line that starts script_manger in the luarc file 😄

Ohhh, alright. Thank you. Since require "tools/script_manager" gets appended to luarc upon installation of this repository, I assumed that's how scripts are set to "perma-on". Combine that with an externally managed darktablerc, and my mistake becomes obvious.

I'm guessing, but were you trying to run the fujifilm script and starting it from the luarc file?

Yes, exactly 😄

wpferguson commented 1 month ago

Before script_manager the only way you could start a script was with the luarc, and there was no way to turn them off.

Lots of users complained that they couldn't use the scripts because they had to edit the luarc, so I wrote script_manager as a "replacement" for the luarc file. I probably need to go through the documentation and replace references to the luarc file with script_manager and then just leave a footnote that you can use the luarc file too.

If you go to the start/stop scripts dropdown, you can select install/update scripts, then under the add more scripts section you can specify a github repository and then provide a category(folder) to put them in and script_manager will clone the repository into your lua directory.

charludo commented 1 month ago

Makes sense. It is a convenient tool for sure!

I admit I'm a bit of a special case because Darktable's config is managed externally and DT can't permanently change the config files.


For future reference (just in case) the solution was to add

lua/script_manager/filmsim/fujifilm_auto_settings=TRUE

to dartablerc.