swayimg icon indicating copy to clipboard operation
swayimg copied to clipboard

bind multiple commands with `--config`

Open salahoued opened this issue 4 months ago • 2 comments

Hi, I want to write a script that allows me to browse a directory of images, and when on exit (pressing q) the current image is written to a file last_page.txt, and then exit. So when running the script again it read the file last_page.txt and pass it to swayimg that way it starts up at the last page/image.

last_page=~/last_page_sway.txt
curr_page="$(cat $last_page)"

swayimg \
    -p 0,0 \
    --config='keys.viewer.q=exec echo "%" > ~/last_page_sway.txt; exit' \
    $curr_page

The issue is, when pressing q, the current_file is not written to last_page.txt and it just exits

I have commented out the q keybind in the config file for both the viewer and gallery.

salahoued avatar Oct 18 '24 20:10 salahoued