darktable can be customized and extended using the Lua programming language. This repository contains the collected
efforts of the darktable developers, maintainers, contributors and community. The following sections list the scripts
contained in the repository, whether they can be run by themselves (Standalone - Yes) or depend on other
scripts (Standalone - No), what operating systems they are known to work on (L - Linux, M - MacOS, W - Windows), and their purpose.
These scripts are written primarily by the darktable developers and maintained by the authors and/or repository maintainers. They are located in the official/ directory.
These scripts are contributed by users. They are meant to have an "owner", i.e. the author, who maintains them. Over time the community has helped maintain these scripts, as well as the authors. They are located in the contrib/ directory.
These scripts provide examples of how to use specific portions of the API. They run, but are meant for demonstration purposes only. They are located in the examples/ directory.
Manage (install, update, enable, disable) the lua scripts
Related third-party projects
The following third-party projects are listed for information only. Think of this collection as an awesome-darktable-lua-scripts list. Use at your own risk!
The recommended method of installation is using git to clone the repository. This ensures that all dependencies on other scripts
are met as well as providing an easy update path. Single scripts listed as standalone may be downloaded and installed by themselves.
snap packages
The snap version of darktable comes with lua included starting with version 2.4.3snap2.
Ensure git is installed on your system. If it isn't, use the package manager to install it. Then open a terminal and:
cd ~/snap/darktable/current
git clone https://github.com/darktable-org/lua-scripts.git lua
flatpak packages
Flatpak packages now use the internal lua interpreter.
Ensure git is installed on your system. If it isn't, use the package manager to install it. Then open a terminal and:
cd ~/.var/app/org.darktable.Darktable/config/darktable
git clone https://github.com/darktable-org/lua-scripts.git lua
appimage packages
These packages run in their own environment and don't have access to a lua interpreter, therefore the scripts can't run. The packagers could enable the internal interpreter, or allow the package to link the interpreter from the operating system, or bundle a copy of lua with the package. If you use one of these packages and wish to use the lua scripts, please contact the package maintainer and suggest the above fixes.
Linux and MacOS
Ensure git is installed on your system. If it isn't, use the package manager to install it. Then open a terminal and:
cd ~/.config/darktable/
git clone https://github.com/darktable-org/lua-scripts.git lua
Windows
Ensure git is installed on your system. Git can be obtained from https://gitforwindows.org/, as well as other places. If you use the gitforwindows.org distribution, install the Git Bash Shell also as it will aid in debugging the scripts if necessary. Then open a command prompt and run:
cd %LOCALAPPDATA%\darktable
git clone https://github.com/darktable-org/lua-scripts.git lua
If you don't have %LOCALAPPDATA%\darktable you have to start dartable at least once, because the directory is created at the first start of darktable.
Enabling
When darktable starts it looks for a file name ~/.config/darktable/luarc (%LOCALAPPDATA%\darktable\luarc for windows) and reads it to see which scripts to include. The file is a plain text file with entries of the form require "<directory>/<name>" where directory is the directory containing the scripts, from the above list, and name is the name from the above list. To include GIMP the line would be require "contrib/gimp".
The recommended way to enable and disable specific scripts is using the script manager module. To use script manager do the following:
You can also create or add lines to the luarc file from the command line:
echo 'require "contrib/gimp"' > ~/.config/darktable/luarc to create the file with a gimp entry
or echo 'require "contrib/hugin"' >> ~/.config/darktable/luarc to add an entry for hugin.
On windows from a command prompt:
echo require "contrib/gimp" > %LOCALAPPDATA%\darktable\luarc to create the file with a gimp entry
or echo require "contrib/hugin" >> %LOCALAPPDATA%\darktable\luarc to add an entry for hugin.
Disabling
To disable a script open the luarc file in your text editor and insert -- at the start of the line containing the script you wish to disable, then save the file.
Updating
To update the script repository, open a terminal or command prompt and do the following:
Snap
cd ~/snap/darktable/current/lua
git pull
Flatpak
cd ~/.var/app/org.darktable.Darktable/config/darktable/lua
git pull
Linux and MacOS
cd ~/.config/darktable/lua/
git pull
Windows
cd %LOCALAPPDATA%\darktable\lua
git pull
Documentation
The Lua Scripts Manual provides documentation
for the scripts transcribed from the header comments. Each script also contains comments and usage instructions
in the header comments.
The Lua Scripts Library API Manual provides
documentation of the libraries and functions. Lua-script libraries documentation may also be generated using
the tools in the tools/ directory.
More information about the scripting with Lua can be found in the darktable user manual:
Scripting with Lua
The Lua API Manual provides docuemntation of the
darktable Lua API.
Troubleshooting
Running darktable with Lua debugging enabled provides more information about what is occurring within the scripts.
Snap
Open a terminal and start darktable with the command snap run darktable -d lua. This provides debugging information to give you insight into what is happening.
Linux
Open a terminal and start darktable with the command darktable -d lua. This provides debugging information to give you insight into what is happening.
MacOS
Open a terminal and start darktable with the command /Applications/darktable.app/Contents/MacOS/darktable -d lua. This provides debugging information to give you insight into what is happening.
Windows
Open a command prompt. Start darktable with the command "C:\Program Files\darktable\bin\darktable" -d lua > log.txt. This provides debugging information to give you insight into what is happening.
Contributing
In order to have your own scripts added here they have to be under a free license (GPL2+ will definitely work, others can be discussed).
请发表评论