Terminal - import directory in Darktable

Hi,
I’m wondering how to write a bash sh script to open a directory (with Raw photos ofc) directly in Darktable.

#!/bin/bash
flatpak run "org.darktable.Darktable" "/path/to/pictures/import"

my script doesn’t work, in fact I’ve no idea how to deal with Dt from terminal.

The command flatpak doesn’t have much commands.

How doesn’t it run? What happens? What output?

I don’t use flatpak, and I haven’t actually opened a whole folder like this this, but I’ve debugged shellscripts, and made plenty of mistakes even in a single-liner!

First. Is the fault with the script or the command. Please try the command at a prompt…

$ flatpak run “org.darktable.Darktable” “/path/to/pictures/import”

what happens?

(You shouldn’t need those quotes unless you have spaces in your filenames)

I think you probably want flatpak run org.darktable.Darktable --command darktable /path/to/stuff

1 Like

Awesome! Your command works nicely with flatpaks!

On mac it was very easy to import directories, (something like: open -a darktable /absolute/path/to/dir), on Linux (Mint, Cinnamon, latest) things are a little different (probably because I’m a Mint newbie):

flatpak run org.darktable.Darktable --command darktable /absolute/path/to/dir

I tried in Vscode and my terminal, both throw error code 1 and display darktable’s man page instead.
There we can read:

darktable [OPTIONS] [IMAGE FILE | IMAGE_ FOLDER]

I shouldn’t get any error - puzzled…

Darktable: 4.6.1 (flatpak)
Mint, Virginia: 21.3 (Cinnamon)

First time for me to call a flatpak so …
Thanks for sharing your thoughts!

Be careful that flatpak are running in an isolated environment (on a mac you are probably using a darktable version that is running on the main environment).
I don’t really use the flatpak version of Darktable (I use a self compiled version), but I just tried on my system, and this works:

flatpak run "org.darktable.Darktable" /home/olivier/Images

Or as Mica wrote (be careful with the location of the --command argument):

flatpak run --command=darktable "org.darktable.Darktable" /home/olivier/Images

As I already said flatpak runs in an isolated environment. If you run something like (ls replaced the darktable command):

flatpak run --command=ls "org.darktable.Darktable" /home/olivier/Images

Then you should get the list of files in the folder your specified. If not, then darktable will not find the files neither and you should look first at solving that problem.

2 Likes

Thanks very much, Oliver!
I just had to remove the --command option to get this working.

The beauty of flatpak is to get self contained apps. Maybe yet another feature I really liked from mac.

Unistalling common apps (for whatever good reason) on Linux makes me always worry to lose some shared resources.