image_path doesn't work with variables
Describe the bug
when using variables with a image_path replacement, no output is produced and [ERROR] image injector reported an error: image can't be found in the given path appears in logs.
To Reproduce i want to paste the latest image from my screenshots directory and have the following config:
~/.config/espanso/match$ cat test.yml
matches:
- trigger: ":scr1"
image_path: "/home/daniel/Pictures/screenshots/{{latestimage}}"
vars:
- name: latestimage
type: shell
params:
cmd: "ls -Art /home/$USER/Pictures/screenshots | tail -n 1"i have tried this with other commands as well, e.g. cmd: "find /home/$USER/Pictures/screenshots -type f -printf '%T@ %p\n' | sort -n | cut -d' ' -f 2- | tail -n 1" to use the whole output for image_path, but this doesn't work either.
to troubelshoot if my shell commands weren't evaluated right i ran
matches:
- trigger: ":scr2"
replace: "/home/daniel/Pictures/screenshots/{{latestimage}}"
vars:
- name: latestimage
type: shell
params:
cmd: "ls -Art /home/$USER/Pictures/screenshots | tail -n 1"and this produces the output /home/daniel/Pictures/screenshots/Screenshot_20230418_174239.png.
to troubleshoot espanso's ability to insert an image, i ran
matches:
- trigger: ":scr3"
image_path: "/home/daniel/Pictures/screenshots/Screenshot_20230418_174239.png"which pastes the image as expected.
Expected behavior The latest image from the screenshot directory should be pasted.
Logs
19:04:10 [daemon(132154)] [INFO] spawning the worker process...
19:04:10 [worker(135257)] [INFO] reading configs from: "/home/daniel/.config/espanso"
19:04:10 [worker(135257)] [INFO] reading packages from: "/home/daniel/.config/espanso/match/packages"
19:04:10 [worker(135257)] [INFO] using runtime dir: "/home/daniel/.cache/espanso"
19:04:10 [worker(135257)] [INFO] system info: Manjaro Linux v22.1.0 - kernel: 5.15.108-1-MANJARO
19:04:10 [worker(135257)] [INFO] binded to IPC unix socket: /home/daniel/.cache/espanso/espansoworkerv2.sock
19:04:10 [worker(135257)] [INFO] monitoring the status of the daemon process
19:04:10 [worker(135257)] [INFO] using X11AppInfoProvider
19:04:10 [worker(135257)] [INFO] using X11Source
19:04:10 [worker(135257)] [INFO] using X11ProxyInjector
19:04:10 [worker(135257)] [INFO] using X11Clipboard
19:04:28 [worker(135257)] [ERROR] image injector reported an error: image can't be found in the given pathSetup information
- OS: linux manjaro, kernel 5.18
- Version: espanso ver. 2.1.8
any help with this is appreciated, but i fully understand if this isn't a priority. thanks for espanso, it's a wonderful tool and makes my life a lot easier!
Source: espanso/espanso