darktable-org / lua-scripts

155 stars 110 forks source link

support for system wide installed scripts #352

Open darix opened 3 years ago

darix commented 3 years ago

To make it easier for people to run lua scripts it might be an idea to provide native packages (deb,rpm) for the lua scripts

They could live e.g. in $(prefix)/share/darktable/scripts.

  1. The manager should prefer scripts installed into the user home over system wide copies.
  2. it should ask the user to upgrade scripts via the package manager if they are installed in the system wide dir or ask if a copy in the home should be installed.
wpferguson commented 3 years ago

I looked at itand here's what I came up with

supertobi commented 3 years ago

Just my comments:

Perhaps darktable should work more like GIMP.

@darix Where would you like to safe the files you need for the packages? How is it handled in other projects?

darix commented 3 years ago

The path suggested by @wpferguson is perfect imho.

wpferguson commented 3 years ago

GIMP loads all files in the script directories no special file like the luarc. Is it possible to change dt to do the same

The difference is that GIMP just adds a menu entry. If we started all the scripts, as of today, that would add 21 modules to the lighttable UI. If we install the modules as a package, then script_manager becomes the default interface to the scripts (kind of like GIMP's menus). I'll add a check to see if the user has a luarc file in the config directory and use it if it exists, otherwise script_manager will start.

GIMP as a list of directories in the preferences, that can be extended by the user to look for the scripts. (This is just nice to have.)

This is doable. We just have to add them to package.path in the right place. Currently <config_dir>/lua is the last entry. I'm planning on adding <prefix>/share/darktable/lua/scripts as the last entry, so the if <config_dir>/lua exists that will get used first. We could add other path entries either before or after /lua using preferences or an extension to script_manager. Actually adding it to script_manager makes more sense because the path could immediately be modified, the new location scanned for scripts, and whatever scripts are found could be added to script_manager on the fly.

darix commented 2 years ago

any update on this?

wpferguson commented 2 years ago

I've been swamped by real life and just haven't got to it yet. Things should let up around the April/May time frame and I'll start cleaning up all the loose ends and left over issues.

darix commented 3 months ago

while I am in this bug tracker. any progress? :)

wpferguson commented 3 months ago

I was awfully optimistic in Jan of 22 :rofl:

Life finally slowed down around January of this year and I've been making progress on clearing out all the backlog.

I may have an idea.....

@TurboGit opened a PR, #450, to make the lua scripts more of a "first class" citizen by including the script tree in the externals so that the translators could work on translating the script strings as part of darktable. If we have the tree already in the source I wonder how much of an effort it would be to package the scripts along with darktable. I'd just have to figure out how to "override" the installed ones (have the .config/darktable/lua directory before the darktable-install/lua directory in the search path maybe). Or the scripts could be installed in the usual place the first time darktable starts and then just work as normal.

wpferguson commented 3 months ago

Had an idea about how to do it. I added a luarc file and a lua directory with the scripts in <install dir>/share. I added <install dir>/share/lua to the search path at the end. That way if the user chooses to install using the scripts installer (into <confir dir>/lua) that set of scripts will take priority over the included scripts.

I had to do some tweaks to script_manager to handle the built in scripts, but it wasn't too bad.

I'll end up pulling scripts_installer out of the darktable luarc file and adding it to the tools directory so that if a user has git installed and wants the latest version of the scripts they can just run scripts_installer to pull them.

I'll probably need some help with the CMake magic to get everything to be where it should so that it installs correctly.