Skip to content

support for system wide installed scripts #352

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

Open
darix opened this issue Jul 28, 2021 · 9 comments
Open

support for system wide installed scripts #352

darix opened this issue Jul 28, 2021 · 9 comments
Milestone

Comments

@darix
Copy link

darix commented Jul 28, 2021

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
Copy link
Member

wpferguson commented Jul 28, 2021

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

@supertobi
Copy link
Contributor

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?

@darix
Copy link
Author

darix commented Jul 29, 2021

The path suggested by @wpferguson is perfect imho.

@wpferguson
Copy link
Member

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 wpferguson added this to the dt 3.8 milestone Jul 29, 2021
@darix
Copy link
Author

darix commented Jan 7, 2022

any update on this?

@wpferguson
Copy link
Member

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
Copy link
Author

darix commented Jun 16, 2024

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

@wpferguson
Copy link
Member

I was awfully optimistic in Jan of 22 🤣

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants