Closed cravend closed 2 years ago
The open-command string needs to include a "placeholder" %u
, which will be replaced with filenames at runtime:
--open-command='open "%u"'
The default open-command string is: xdg-open "%u"
This needs to be more clear to the users, though. I'll add some text to the error output to put anyone encountering this on the right track.
I have this line in my sclirc, does it not work that way?
open-command = 'open %u'
When I manually pass the open-command
flag on the CLI, it works, but opens the attachment in TextEdit. EDIT: running the exact same command on the CLI directly works (i.e. opens with Preview).
This config line should work:
open-command = open "%u"
When there are single quotes around the command, it is used as a single "two word" application name (not what you want). Without the double quotes around %u
, the files with spaces in their names would not open.
Not sure about why TextEdit is launched instead of Preview.. Could you try running scli --debug
and post the output of the logs (in ~/.local/share/scli/log
) after opening an attachment?
Edit: I suspect maybe open
is alias
ed to something in your .bashrc
? scli
does not read the aliases from it. You can try which open
and /usr/bin/open <filename>
.
The config line did work, thanks for the tip! The log is below. open
isn't aliased to anything else; I also tried manually typing /usr/bin/open
in the config but it didn't change.
My current theory is that open
isn't recognising that the file is an image (because signal doesn't include the extension in the file).
I also realised that I was wrong — when I run open "/Users/cravend/.local/share/signal-cli/attachments/-jdUoOCZUCSwmM42eJbk"
, TextEdit opens (not Preview as expected). A potential workaround is to manually define the application used: open -a Preview "/Users/cravend/.local/share/signal-cli/attachments/-jdUoOCZUCSwmM42eJbk"
INFO:root:scli ?
DEBUG:root:signal-cli account: linked device
DEBUG:root:callf: `['signal-cli', '-u', '+[MY_PHONE]', '--output=json', 'daemon']`
DEBUG:root:callf: `['/usr/bin/open', '/Users/cravend/.local/share/signal-cli/attachments/-jdUoOCZUCSwmM42eJbk']`
INFO:root:daemon_log: INFO DaemonCommand - Exported dbus object: /org/asamk/Signal
INFO:root:signal-cli dbus service started
INFO:root:signal-cli 0.9.0
signal-cli
saves attachment files without extensions. If Mac's open
relies only on file extensions to pick the appropriate application, it's not going to work.
The Preview
app will only work with images (AFAIK), but attachments can also be audio or any other file type.
You'll need to either use an alternative to open
like mimeopen
that uses file
inspection or other tricks, or roll your own equivalent.
Ah, I didn't even consider voice memos. I'll keep exploring alternatives on macOS and report back if I figure out a better option.
Hi y'all,
I'm having trouble opening attachments on macOS. originally, it was trying to call
xdg-open
(which I don't have installed), but even after changing to the defaultopen
command, I still get the following error: