Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bind multiple commands with --config #202

Open
salahoued opened this issue Oct 18, 2024 · 4 comments
Open

bind multiple commands with --config #202

salahoued opened this issue Oct 18, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@salahoued
Copy link

salahoued commented Oct 18, 2024

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.

@artemsen artemsen added the bug Something isn't working label Oct 19, 2024
@artemsen artemsen self-assigned this Oct 19, 2024
@artemsen
Copy link
Owner

There is a problem handling the exit action. This action has high priority and terminates the program before any other actions are performed. I don't know how to fix it without breaking everything else, sorry =)

@salahoued
Copy link
Author

salahoued commented Oct 26, 2024

No, there is no problem.
It's just that I'm used to it CTRL+q: for a Kivy app I did, and q for imv.

I can, just add a keybind s for example to save then q to exit.

But most of all I thank you for this work

@litoj
Copy link
Contributor

litoj commented Nov 15, 2024

I have a similar issue of keybindings not getting overriden, only appended. When I have Shift+s=scale fit it toggles the slideshow (because that is the default binding) and also executes my binding. I don't remember this happening in the previous version though (now on 3.4)

Edit: I noticed the scale action is not yet in 3.4, that's why it started the slideshow - because it ignored the invalid mapping. If there could pop up a message with the invalid binding that would be very useful.

@artemsen
Copy link
Owner

When I have Shift+s=scale fit it toggles the slideshow

It was #203, fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants