wayshot: Problem with converting from grim to wayshot

Hi,

I use fish as shell and Sway as WM, and I believe one of it, causing problems with some commands that I try convert from grim to wayshot:

What works:

bindsym 1 exec 'wayshot -f ~/ps_$(date +"%Y%m%d%H%M%S").png', mode "default"
bindsym 2 exec 'wayshot --stdout | wl-copy', mode "default"

What I couldn’t make convert:

bindsym 3 exec 'grim -g "$(slurp)" ~/ps_$(date +"%Y%m%d%H%M%S").png', mode "default"
bindsym 4 exec 'grim -g "$(slurp)" - | wl-copy', mode "default"

I tried to convert them to like this, but from Sway they don’t wont to work (nothing happens):

  • For bindsym 3 tried to make it:
wayshot -s "$(slurp -f '%x %y %w %h')" -f ~/ps_$(date +"%Y%m%d%H%M%S").png

If I try from console:

wayshot -s "(slurp -f '%x %y %w %h')" -f ~/ps_(date +"%Y%m%d%H%M%S").png                                                                                                         5m26s/23:53
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', src/wayshot.rs:73:69
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If I try in bash

wayshot -s "$(slurp -f '%x %y %w %h')" -f ~/ps_$(date +"%Y%m%d%H%M%S").png

It’ just working.

  • For bindsym 4 tried to make it:
wayshot -s "$(slurp -f '%x %y %w %h')" --stdout | wl-copy

If I try from console:

wayshot -s "(slurp -f '%x %y %w %h')" --stdout | wl-copy
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', src/wayshot.rs:73:69
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If I try in bash

wayshot -s "$(slurp -f '%x %y %w %h')" --stdout | wl-copy

It’ just working.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 26 (10 by maintainers)

Most upvoted comments

Thank you all! ❤️

Sorry for taking so long to answer, but work has sucked my life out of me lately. Something is definitely wrong from my side. If I try

Take it easy 🫂.

It works for you, so the problem is mine. I do not know if someone from Fish will be able to answer me, but I will send this problem and maybe they will let me know if my configuration file is doing something wrong.

I will install fish and sway tomorrow, get to the bottom of this and let you know.

@roland-rollo you should remove the backslashes on the shell. but on the sway config, you should add it. fish -c 'wayshot -s (slurp -f \"%x %y %w %h\") --stdout | wl-copy' and it should work well in sway config because the \ escapes the ". but if you are on fish shell fish -c 'wayshot -s (slurp -f \"%x %y %w %h\") --stdout | wl-copy' wont work because fish does not recognize \ trying to escape " so running fish -c 'wayshot -s (slurp -f "%x %y %w %h") --stdout | wl-copy' without the backslashes \ will work.

EDIT: if you want to know why i noticed that, it is because of the Error message ParseIntError. This means that the geometry format is returning something that is not a number. It might be \ or " or both because like i said before, fish does not know \ is to escape something