lua-scripts icon indicating copy to clipboard operation
lua-scripts copied to clipboard

support for system wide installed scripts

Open darix opened this issue 3 years ago • 9 comments

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.

darix avatar Jul 28 '21 18:07 darix

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

  • scripts should probably live in $(prefix)/share/darktable/lua/scripts
  • I need to modify src/lua/init.c to add another search path after the config dir
  • I need to modify the darktable luarc file to use the scripts directory if it exists and there isn't a copy of the scripts in the users config dir and launch script manager
  • I need to modify script_manager to be aware of the "system" scripts directory and deal with it properly

wpferguson avatar Jul 28 '21 19:07 wpferguson

Just my comments:

Perhaps darktable should work more like GIMP.

  • GIMP loads all files in the script directories no special file like the luarc. Is it possible to change dt to do the same.
  • 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.)

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

supertobi avatar Jul 29 '21 07:07 supertobi

The path suggested by @wpferguson is perfect imho.

darix avatar Jul 29 '21 11:07 darix

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 <config_dir>/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.

wpferguson avatar Jul 29 '21 15:07 wpferguson

any update on this?

darix avatar Jan 07 '22 00:01 darix

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.

wpferguson avatar Jan 07 '22 06:01 wpferguson