waycrate / wayshot

Mirrored at https://git.sr.ht/~shinyzenith/wayshot | screenshot tool for wlroots based compositors implementing zwlr_screencopy_v1
https://crates.io/crates/wayshot
BSD 2-Clause "Simplified" License
115 stars 20 forks source link

Problem with converting from grim to wayshot #15

Closed roland-5 closed 2 years ago

roland-5 commented 2 years ago

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):

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.

Shinyzenith commented 2 years ago

Hi, first of all thank you for the very thorough bug report. slurp is the external program we call as a helper to grab screen coordinates so if you can run that separately, put it in a variable and then call the variable after the -s argument, I believe it'll work.

The examples provided in the repo are with a posix shell in mind, there is no shell specific code inside of wayshot itself at the end of the day so I can't really support fish per se. The commands just need to be adapted to it.

roland-5 commented 2 years ago

Hi, first of all thank you for the very thorough bug report. slurp is the external program we call as a helper to grab screen coordinates so if you can run that separately, put it in a variable and then call the variable after the -s argument, I believe it'll work.

You mean?

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

It gives the same error as previously.

The examples provided in the repo are with a posix shell in mind, there is no shell specific code inside of wayshot itself at the end of the day so I can't really support fish per se. The commands just need to be adapted to it.

The fact that the examples are given as POSIX is fine, because Sway creates its environment anyway: therefore the bindsym I provided for grim work, although they are written for bash and not fish. If fish syntax were important here, they wouldn't work in Sway (the grim shouldn't be able to handle it either). And two converted bindsym are working without problem with Wayshot. In addition, by typing these commands in the console, the errors that show up to me should not show up, so Wayshot has a problem with something that can be seen in the Sway + fish combination, but not with Sway + bash. Or maybe I understating this wrong (I'm not programmer), but if it something wrong in Fish I can't alarm they, as I don't understand what makes errors.

Shinyzenith commented 2 years ago

I'm not sure if I completely understand the issue but the error that wayshot threw means that a proper integer wasn't passed by slurp to wayshot

Maybe try notify sending the variable for confirmation? The error code looks fine with respect to the syntax to me but then again I'm not a fish user so you probably know better:D

roland-5 commented 2 years ago

It will be a tough topic. :P First of all, I can't write commands in Sway config with fish syntax, they will just don't work (Sway will ignore them), that's why I wrote earlier that the examples from README are well written as POSIX. So converting them with fish syntax in Sway config make no much sense. Yeah It looks like problem is in Wayshot with interpretation data from Slurp. My theory is that the data Slurp throws into Wayshot is related to the build of the Fish, even though the Sway commands themselves must be written in Bash. Grim can either process Slurp results from Fish or Grim gets Slurp results differently from Wayshot, so Grim has no problem.

If I write in fish this:

grim -g (slurp) ~/ps_(date +"%Y%m%d%H%M%S").png

It's just do screenshot of selected area without problem.

strace grim -g (slurp) ~/ps_(date +"%Y%m%d%H%M%S").png ``` execve("/usr/bin/grim", ["grim", "-g", "228,0 1692x370", "/home/roland/ps_20220314135835.p"...], 0x7ffeb3c55ce8 /* 55 vars */) = 0 brk(NULL) = 0x55f14a2ed000 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffca250a320) = -1 EINVAL (Invalid argument) access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=127551, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 127551, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc5e6abd000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1061880, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc5e6abb000 mmap(NULL, 946752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e69d3000 mmap(0x7fc5e69e3000, 499712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7fc5e69e3000 mmap(0x7fc5e6a5d000, 376832, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8a000) = 0x7fc5e6a5d000 mmap(0x7fc5e6ab9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe5000) = 0x7fc5e6ab9000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libpixman-1.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \260\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=681768, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 684376, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e692b000 mmap(0x7fc5e6936000, 532480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7fc5e6936000 mmap(0x7fc5e69b8000, 73728, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8d000) = 0x7fc5e69b8000 mmap(0x7fc5e69ca000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9e000) = 0x7fc5e69ca000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libpng16.so.16", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 `\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=218808, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 221200, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e68f4000 mmap(0x7fc5e68fa000, 147456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7fc5e68fa000 mmap(0x7fc5e691e000, 45056, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2a000) = 0x7fc5e691e000 mmap(0x7fc5e6929000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x34000) = 0x7fc5e6929000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/librt.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=16200, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 16400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e68ef000 mmap(0x7fc5e68f0000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fc5e68f0000 mmap(0x7fc5e68f1000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fc5e68f1000 mmap(0x7fc5e68f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fc5e68f2000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libwayland-client.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 `\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=68128, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 70440, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e68dd000 mmap(0x7fc5e68e3000, 24576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7fc5e68e3000 mmap(0x7fc5e68e9000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc000) = 0x7fc5e68e9000 mmap(0x7fc5e68ec000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe000) = 0x7fc5e68ec000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libjpeg.so.8", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=522104, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 524312, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e685c000 mprotect(0x7fc5e6860000, 503808, PROT_NONE) = 0 mmap(0x7fc5e6860000, 299008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7fc5e6860000 mmap(0x7fc5e68a9000, 200704, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4d000) = 0x7fc5e68a9000 mmap(0x7fc5e68db000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7e000) = 0x7fc5e68db000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\324\2\0\0\0\0\0"..., 832) = 832 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0@\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 80, 848) = 80 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\205vn\235\204X\261n\234|\346\340|q,\2"..., 68, 928) = 68 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2463384, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc5e685a000 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 mmap(NULL, 2136752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e6650000 mprotect(0x7fc5e667c000, 1880064, PROT_NONE) = 0 mmap(0x7fc5e667c000, 1531904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2c000) = 0x7fc5e667c000 mmap(0x7fc5e67f2000, 344064, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a2000) = 0x7fc5e67f2000 mmap(0x7fc5e6847000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f6000) = 0x7fc5e6847000 mmap(0x7fc5e684d000, 51888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc5e684d000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=100184, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 102416, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e6636000 mprotect(0x7fc5e6639000, 86016, PROT_NONE) = 0 mmap(0x7fc5e6639000, 57344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fc5e6639000 mmap(0x7fc5e6647000, 24576, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11000) = 0x7fc5e6647000 mmap(0x7fc5e664e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fc5e664e000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libffi.so.8", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@ \0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=43040, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 46376, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e662a000 mmap(0x7fc5e662c000, 24576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fc5e662c000 mmap(0x7fc5e6632000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8000) = 0x7fc5e6632000 mmap(0x7fc5e6634000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x7fc5e6634000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=16488, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 16400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc5e6625000 mmap(0x7fc5e6626000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fc5e6626000 mmap(0x7fc5e6627000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fc5e6627000 mmap(0x7fc5e6628000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fc5e6628000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc5e6623000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc5e6621000 arch_prctl(ARCH_SET_FS, 0x7fc5e6624600) = 0 set_tid_address(0x7fc5e66248d0) = 573353 set_robust_list(0x7fc5e66248e0, 24) = 0 rseq(0x7fc5e6624fa0, 0x20, 0, 0x53053053) = 0 mprotect(0x7fc5e6847000, 12288, PROT_READ) = 0 mprotect(0x7fc5e6628000, 4096, PROT_READ) = 0 mprotect(0x7fc5e6634000, 4096, PROT_READ) = 0 mprotect(0x7fc5e664e000, 4096, PROT_READ) = 0 mprotect(0x7fc5e68db000, 4096, PROT_READ) = 0 mprotect(0x7fc5e68ec000, 8192, PROT_READ) = 0 mprotect(0x7fc5e68f2000, 4096, PROT_READ) = 0 mprotect(0x7fc5e6ab9000, 4096, PROT_READ) = 0 mprotect(0x7fc5e6929000, 4096, PROT_READ) = 0 mprotect(0x7fc5e69ca000, 32768, PROT_READ) = 0 mprotect(0x55f149f1f000, 4096, PROT_READ) = 0 mprotect(0x7fc5e6b12000, 8192, PROT_READ) = 0 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 munmap(0x7fc5e6abd000, 127551) = 0 getrandom("\x8a\x60\x15\x6b\x0a\xb0\x96\xb3", 8, GRND_NONBLOCK) = 8 brk(NULL) = 0x55f14a2ed000 brk(0x55f14a30e000) = 0x55f14a30e000 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3 connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/wayland-1"}, 27) = 0 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\1\0\f\0\2\0\0\0\1\0\0\0\0\0\f\0\3\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 24 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\2\0\0\0\0\0\34\0\1\0\0\0\7\0\0\0wl_shm\0\0\1\0\0\0\2\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 1892 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\2\0\0\0\0\0 \0\1\0\0\0\7\0\0\0wl_shm\0\0\1\0\0\0\4\0\0\0"..., iov_len=196}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 196 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\4\0\0\0\0\0\f\0\0\0\0\0\4\0\0\0\0\0\f\0\1\0\0\0\4\0\0\0\0\0\f\0"..., iov_len=2204}, {iov_base="", iov_len=1892}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 408 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\6\0\0\0\0\0\24\0\10\0\0\0\0\0\0\0\7\0\0\0", iov_len=20}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 20 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\10\0\0\0\0\0\30\0XB24\200\7\0\08\4\0\0\0\36\0\0", iov_len=1796}, {iov_base="", iov_len=2300}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 24 clock_gettime(CLOCK_REALTIME, {tv_sec=1647262715, tv_nsec=607709297}) = 0 openat(AT_FDCWD, "/dev/shm/grim-bDkbDc", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_CLOEXEC, 0600) = 4 unlink("/dev/shm/grim-bDkbDc") = 0 ftruncate(4, 8294400) = 0 mmap(NULL, 8294400, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = 0x7fc5e5e38000 fcntl(4, F_DUPFD_CLOEXEC, 0) = 5 close(4) = 0 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\4\0\0\0\0\0\20\0\t\0\0\0\0\220~\0\t\0\0\0\0\0 \0\n\0\0\0\0\0\0\0"..., iov_len=68}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[5]}], msg_controllen=20, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 68 close(5) = 0 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\1\0\f\0\t\0\0\0\10\0\0\0\1\0\f\0\0\0\0\0\10\0\0\0\2\0\24\0"..., iov_len=1772}, {iov_base="", iov_len=2324}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 44 mmap(NULL, 2506752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc5e5bd4000 openat(AT_FDCWD, "/home/roland/ps_20220314135835.png", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4 newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=0, ...}, AT_EMPTY_PATH) = 0 brk(0x55f14a333000) = 0x55f14a333000 brk(0x55f14a363000) = 0x55f14a363000 write(4, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\6\234\0\0\1r\10\2\0\0\0gV\356"..., 4096) = 4096 write(4, "\230\330?\322\322\243\325\25Q\241\372\252\324\361\357D\363\263\243\355=\361\335m\261hJ\324\3306\252n"..., 4096) = 4096 write(4, "\324\362'}\357\352}\363\252\6\377\340\325^\17\336qY\224t~\r\373\354\361\202\2738\357\364\243\276"..., 4096) = 4096 brk(0x55f14a353000) = 0x55f14a353000 brk(0x55f14a343000) = 0x55f14a343000 brk(0x55f14a333000) = 0x55f14a333000 brk(0x55f14a323000) = 0x55f14a323000 brk(0x55f14a322000) = 0x55f14a322000 brk(0x55f14a320000) = 0x55f14a320000 brk(0x55f14a31e000) = 0x55f14a31e000 brk(0x55f14a31d000) = 0x55f14a31d000 brk(0x55f14a31b000) = 0x55f14a31b000 write(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1424) = 1424 close(4) = 0 brk(0x55f14a318000) = 0x55f14a318000 munmap(0x7fc5e5bd4000, 2506752) = 0 munmap(0x7fc5e5e38000, 8294400) = 0 close(3) = 0 exit_group(0) = ? +++ exited with 0 +++ ```

But for Wayshot, doesn't work:

wayshot -s (slurp) -f ~/ps_(date +"%Y%m%d%H%M%S").png
strace wayshot -s (slurp) -f ~/ps_(date +"%Y%m%d%H%M%S").png ``` execve("/usr/bin/wayshot", ["wayshot", "-s", "439,363 1134x717", "-f", "/home/roland/ps_20220314140157.p"...], 0x7fff52cf9cd0 /* 55 vars */) = 0 brk(NULL) = 0x55d1cdb76000 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc09795cd0) = -1 EINVAL (Invalid argument) access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=127551, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 127551, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f875d1a9000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=478272, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f875d1a7000 mmap(NULL, 107240, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f875d18c000 mprotect(0x7f875d18f000, 90112, PROT_NONE) = 0 mmap(0x7f875d18f000, 73728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f875d18f000 mmap(0x7f875d1a1000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f875d1a1000 mmap(0x7f875d1a5000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7f875d1a5000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1061880, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 946752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f875d0a4000 mmap(0x7f875d0b4000, 499712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7f875d0b4000 mmap(0x7f875d12e000, 376832, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8a000) = 0x7f875d12e000 mmap(0x7f875d18a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe5000) = 0x7f875d18a000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libmvec.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1088760, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 1028112, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f875cfa8000 mmap(0x7f875cfae000, 143360, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f875cfae000 mmap(0x7f875cfd1000, 856064, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x29000) = 0x7f875cfd1000 mmap(0x7f875d0a2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf9000) = 0x7f875d0a2000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\324\2\0\0\0\0\0"..., 832) = 832 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0@\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 80, 848) = 80 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\205vn\235\204X\261n\234|\346\340|q,\2"..., 68, 928) = 68 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2463384, ...}, AT_EMPTY_PATH) = 0 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 mmap(NULL, 2136752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f875cd9e000 mprotect(0x7f875cdca000, 1880064, PROT_NONE) = 0 mmap(0x7f875cdca000, 1531904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2c000) = 0x7f875cdca000 mmap(0x7f875cf40000, 344064, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a2000) = 0x7f875cf40000 mmap(0x7f875cf95000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f6000) = 0x7f875cf95000 mmap(0x7f875cf9b000, 51888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f875cf9b000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f875cd9c000 arch_prctl(ARCH_SET_FS, 0x7f875cd9d0c0) = 0 set_tid_address(0x7f875cd9d390) = 573605 set_robust_list(0x7f875cd9d3a0, 24) = 0 rseq(0x7f875cd9da60, 0x20, 0, 0x53053053) = 0 mprotect(0x7f875cf95000, 12288, PROT_READ) = 0 mprotect(0x7f875d18a000, 4096, PROT_READ) = 0 mprotect(0x7f875d0a2000, 4096, PROT_READ) = 0 mprotect(0x7f875d1a5000, 4096, PROT_READ) = 0 mprotect(0x55d1cc4aa000, 61440, PROT_READ) = 0 mprotect(0x7f875d1fe000, 8192, PROT_READ) = 0 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 munmap(0x7f875d1a9000, 127551) = 0 poll([{fd=0, events=0}, {fd=1, events=0}, {fd=2, events=0}], 3, 0) = 0 (Timeout) rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f875cde0560}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGSEGV, {sa_handler=0x55d1cc36f870, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7f875cde0560}, NULL, 8) = 0 rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGBUS, {sa_handler=0x55d1cc36f870, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7f875cde0560}, NULL, 8) = 0 sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f875d1c6000 mprotect(0x7f875d1c6000, 4096, PROT_NONE) = 0 sigaltstack({ss_sp=0x7f875d1c7000, ss_flags=0, ss_size=8192}, NULL) = 0 getrandom("\xba\xfc\xf4\xe6\xf7\xed\x47\x65", 8, GRND_NONBLOCK) = 8 brk(NULL) = 0x55d1cdb76000 brk(0x55d1cdb97000) = 0x55d1cdb97000 openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 newfstatat(3, "", {st_mode=S_IFREG|0444, st_size=0, ...}, AT_EMPTY_PATH) = 0 read(3, "55d1cc2e0000-55d1cc352000 r--p 0"..., 1024) = 1024 read(3, "sr/lib/libc.so.6\n7f875cf9b000-7f"..., 1024) = 1024 read(3, "00 r--p 00000000 00:19 3733359 "..., 1024) = 1024 read(3, "875d200000 r--p 00034000 00:19 2"..., 1024) = 516 close(3) = 0 sched_getaffinity(573605, 32, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) = 32 getrandom("\xba\xa8\xc6\xc0\x6f\x0b\xb9\x43\xa4\x30\x0d\x71\x9f\x57\x8b\x3e", 16, GRND_NONBLOCK) = 16 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3 connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/wayland-1"}, 27) = 0 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4 newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=127551, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 127551, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f875cd7c000 close(4) = 0 openat(AT_FDCWD, "/usr/lib/libwayland-client.so", O_RDONLY|O_CLOEXEC) = 4 read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 `\0\0\0\0\0\0"..., 832) = 832 newfstatat(4, "", {st_mode=S_IFREG|0755, st_size=68128, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 70440, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f875d1b4000 mmap(0x7f875d1ba000, 24576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x6000) = 0x7f875d1ba000 mmap(0x7f875d1c0000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0xc000) = 0x7f875d1c0000 mmap(0x7f875d1c3000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0xe000) = 0x7f875d1c3000 close(4) = 0 openat(AT_FDCWD, "/usr/lib/libffi.so.8", O_RDONLY|O_CLOEXEC) = 4 read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@ \0\0\0\0\0\0"..., 832) = 832 newfstatat(4, "", {st_mode=S_IFREG|0755, st_size=43040, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 46376, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f875cd70000 mmap(0x7f875cd72000, 24576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x2000) = 0x7f875cd72000 mmap(0x7f875cd78000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x8000) = 0x7f875cd78000 mmap(0x7f875cd7a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x9000) = 0x7f875cd7a000 close(4) = 0 openat(AT_FDCWD, "/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 4 read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(4, "", {st_mode=S_IFREG|0755, st_size=16488, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 16400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f875d1af000 mmap(0x7f875d1b0000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x1000) = 0x7f875d1b0000 mmap(0x7f875d1b1000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x2000) = 0x7f875d1b1000 mmap(0x7f875d1b2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x2000) = 0x7f875d1b2000 close(4) = 0 mprotect(0x7f875d1b2000, 4096, PROT_READ) = 0 mprotect(0x7f875cd7a000, 4096, PROT_READ) = 0 mprotect(0x7f875d1c3000, 8192, PROT_READ) = 0 munmap(0x7f875cd7c000, 127551) = 0 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\1\0\f\0\2\0\0\0\1\0\0\0\0\0\f\0\3\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 24 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\2\0\0\0\0\0\34\0\1\0\0\0\7\0\0\0wl_shm\0\0\1\0\0\0\2\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 1892 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\2\0\0\0\0\0000\0\10\0\0\0\27\0\0\0zxdg_output_mana"..., iov_len=112}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 112 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\5\0\0\0\0\08\0\0\0\0\0\0\0\0\0T\1\0\0\276\0\0\0\0\0\0\0\10\0\0\0"..., iov_len=2204}, {iov_base="", iov_len=1892}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 232 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\0\0\f\0\3\0\0\0", iov_len=12}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 12 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\3\0\0\0\0\0\f\0l\237\1\0\1\0\0\0\1\0\f\0\3\0\0\0", iov_len=1972}, {iov_base="", iov_len=2124}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 24 write(2, "thread '", 8thread ') = 8 write(2, "main", 4main) = 4 write(2, "' panicked at '", 15' panicked at ') = 15 write(2, "called `Result::unwrap()` on an "..., 81called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }) = 81 write(2, "', ", 3', ) = 3 write(2, "src/wayshot.rs", 14src/wayshot.rs) = 14 write(2, ":", 1:) = 1 write(2, "73", 273) = 2 write(2, ":", 1:) = 1 write(2, "69", 269) = 2 write(2, "\n", 1 ) = 1 write(2, "note: run with `RUST_BACKTRACE=1"..., 78note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ) = 78 futex(0x7f875d1a6090, FUTEX_WAKE_PRIVATE, 2147483647) = 0 close(3) = 0 sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0 munmap(0x7f875d1c6000, 12288) = 0 exit_group(101) = ? +++ exited with 101 +++ ```

But this work in console great:

wayshot -s (slurp -f '%x %y %w %h') -f ~/ps_(date +"%Y%m%d%H%M%S").png
strace wayshot -s (slurp -f '%x %y %w %h') -f ~/ps_(date +"%Y%m%d%H%M%S").png ``` execve("/usr/bin/wayshot", ["wayshot", "-s", "383 250 435 830", "-f", "/home/roland/ps_20220314140032.p"...], 0x7ffe27c3c910 /* 55 vars */) = 0 brk(NULL) = 0x557e54fa9000 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc4212c470) = -1 EINVAL (Invalid argument) access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=127551, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 127551, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd60afa3000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=478272, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60afa1000 mmap(NULL, 107240, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd60af86000 mprotect(0x7fd60af89000, 90112, PROT_NONE) = 0 mmap(0x7fd60af89000, 73728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fd60af89000 mmap(0x7fd60af9b000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fd60af9b000 mmap(0x7fd60af9f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fd60af9f000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1061880, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 946752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd60ae9e000 mmap(0x7fd60aeae000, 499712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7fd60aeae000 mmap(0x7fd60af28000, 376832, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8a000) = 0x7fd60af28000 mmap(0x7fd60af84000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe5000) = 0x7fd60af84000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libmvec.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1088760, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 1028112, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd60ada2000 mmap(0x7fd60ada8000, 143360, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7fd60ada8000 mmap(0x7fd60adcb000, 856064, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x29000) = 0x7fd60adcb000 mmap(0x7fd60ae9c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf9000) = 0x7fd60ae9c000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\324\2\0\0\0\0\0"..., 832) = 832 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0@\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 80, 848) = 80 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\205vn\235\204X\261n\234|\346\340|q,\2"..., 68, 928) = 68 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2463384, ...}, AT_EMPTY_PATH) = 0 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 mmap(NULL, 2136752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd60ab98000 mprotect(0x7fd60abc4000, 1880064, PROT_NONE) = 0 mmap(0x7fd60abc4000, 1531904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2c000) = 0x7fd60abc4000 mmap(0x7fd60ad3a000, 344064, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a2000) = 0x7fd60ad3a000 mmap(0x7fd60ad8f000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f6000) = 0x7fd60ad8f000 mmap(0x7fd60ad95000, 51888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd60ad95000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60ab96000 arch_prctl(ARCH_SET_FS, 0x7fd60ab970c0) = 0 set_tid_address(0x7fd60ab97390) = 573525 set_robust_list(0x7fd60ab973a0, 24) = 0 rseq(0x7fd60ab97a60, 0x20, 0, 0x53053053) = 0 mprotect(0x7fd60ad8f000, 12288, PROT_READ) = 0 mprotect(0x7fd60af84000, 4096, PROT_READ) = 0 mprotect(0x7fd60ae9c000, 4096, PROT_READ) = 0 mprotect(0x7fd60af9f000, 4096, PROT_READ) = 0 mprotect(0x557e5375c000, 61440, PROT_READ) = 0 mprotect(0x7fd60aff8000, 8192, PROT_READ) = 0 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 munmap(0x7fd60afa3000, 127551) = 0 poll([{fd=0, events=0}, {fd=1, events=0}, {fd=2, events=0}], 3, 0) = 0 (Timeout) rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fd60abda560}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGSEGV, {sa_handler=0x557e53621870, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fd60abda560}, NULL, 8) = 0 rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0 rt_sigaction(SIGBUS, {sa_handler=0x557e53621870, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fd60abda560}, NULL, 8) = 0 sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fd60afc0000 mprotect(0x7fd60afc0000, 4096, PROT_NONE) = 0 sigaltstack({ss_sp=0x7fd60afc1000, ss_flags=0, ss_size=8192}, NULL) = 0 getrandom("\x93\x77\xd2\x23\x50\x73\x47\x43", 8, GRND_NONBLOCK) = 8 brk(NULL) = 0x557e54fa9000 brk(0x557e54fca000) = 0x557e54fca000 openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 newfstatat(3, "", {st_mode=S_IFREG|0444, st_size=0, ...}, AT_EMPTY_PATH) = 0 read(3, "557e53592000-557e53604000 r--p 0"..., 1024) = 1024 read(3, "sr/lib/libc.so.6\n7fd60ad95000-7f"..., 1024) = 1024 read(3, "00 r--p 00000000 00:19 3733359 "..., 1024) = 1024 read(3, "d60affa000 r--p 00034000 00:19 2"..., 1024) = 516 close(3) = 0 sched_getaffinity(573525, 32, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) = 32 getrandom("\xc8\x8c\xef\x90\x7f\x43\x33\xe2\x83\x12\x8d\xaa\xeb\x5c\xfc\x1e", 16, GRND_NONBLOCK) = 16 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3 connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/wayland-1"}, 27) = 0 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4 newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=127551, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 127551, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7fd60ab76000 close(4) = 0 openat(AT_FDCWD, "/usr/lib/libwayland-client.so", O_RDONLY|O_CLOEXEC) = 4 read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 `\0\0\0\0\0\0"..., 832) = 832 newfstatat(4, "", {st_mode=S_IFREG|0755, st_size=68128, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 70440, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7fd60afae000 mmap(0x7fd60afb4000, 24576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x6000) = 0x7fd60afb4000 mmap(0x7fd60afba000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0xc000) = 0x7fd60afba000 mmap(0x7fd60afbd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0xe000) = 0x7fd60afbd000 close(4) = 0 openat(AT_FDCWD, "/usr/lib/libffi.so.8", O_RDONLY|O_CLOEXEC) = 4 read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@ \0\0\0\0\0\0"..., 832) = 832 newfstatat(4, "", {st_mode=S_IFREG|0755, st_size=43040, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 46376, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7fd60ab6a000 mmap(0x7fd60ab6c000, 24576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x2000) = 0x7fd60ab6c000 mmap(0x7fd60ab72000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x8000) = 0x7fd60ab72000 mmap(0x7fd60ab74000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x9000) = 0x7fd60ab74000 close(4) = 0 openat(AT_FDCWD, "/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 4 read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832 newfstatat(4, "", {st_mode=S_IFREG|0755, st_size=16488, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 16400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7fd60afa9000 mmap(0x7fd60afaa000, 4096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x1000) = 0x7fd60afaa000 mmap(0x7fd60afab000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x2000) = 0x7fd60afab000 mmap(0x7fd60afac000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x2000) = 0x7fd60afac000 close(4) = 0 mprotect(0x7fd60afac000, 4096, PROT_READ) = 0 mprotect(0x7fd60ab74000, 4096, PROT_READ) = 0 mprotect(0x7fd60afbd000, 8192, PROT_READ) = 0 munmap(0x7fd60ab76000, 127551) = 0 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\1\0\f\0\2\0\0\0\1\0\0\0\0\0\f\0\3\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 24 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\2\0\0\0\0\0\34\0\1\0\0\0\7\0\0\0wl_shm\0\0\1\0\0\0\2\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 1892 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\2\0\0\0\0\0000\0\10\0\0\0\27\0\0\0zxdg_output_mana"..., iov_len=112}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 112 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\5\0\0\0\0\08\0\0\0\0\0\0\0\0\0T\1\0\0\276\0\0\0\0\0\0\0\10\0\0\0"..., iov_len=2204}, {iov_base="", iov_len=1892}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 232 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\0\0\f\0\3\0\0\0", iov_len=12}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 12 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\3\0\0\0\0\0\f\0k\236\1\0\1\0\0\0\1\0\f\0\3\0\0\0", iov_len=1972}, {iov_base="", iov_len=2124}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 24 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\1\0\f\0\3\0\0\0\1\0\0\0\0\0\f\0\7\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 24 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\3\0\0\0\0\0\34\0\1\0\0\0\7\0\0\0wl_shm\0\0\1\0\0\0\3\0\0\0"..., iov_len=1948}, {iov_base="", iov_len=2148}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 1892 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\3\0\0\0\0\0004\0\33\0\0\0\33\0\0\0zwlr_screencopy_"..., iov_len=88}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 88 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\10\0\0\0\0\0\30\0XB24\263\1\0\0>\3\0\0\314\6\0\0\10\0\0\0\5\0\24\0"..., iov_len=56}, {iov_base="", iov_len=4040}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 52 memfd_create("wayshot", MFD_CLOEXEC|MFD_ALLOW_SEALING) = 4 fcntl(4, F_ADD_SEALS, F_SEAL_SEAL|F_SEAL_SHRINK) = 0 ftruncate(4, 1444200) = 0 fcntl(4, F_DUPFD_CLOEXEC, 0) = 5 sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\3\0\0\0\0\0 \0\1\0\0\0\7\0\0\0wl_shm\0\0\1\0\0\0\t\0\0\0"..., iov_len=92}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[5]}], msg_controllen=20, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 92 close(5) = 0 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\t\0\0\0", iov_len=4}, {iov_base="\0\0\f\0\0\0\0\0\t\0\0\0\0\0\f\0\1\0\0\0\t\0\0\0\0\0\f\0XB24"..., iov_len=4092}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 168 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}]) recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\10\0\0\0\1\0\f\0\0\0\0\0\10\0\0\0\2\0\24\0\0\0\0\0\355J\2\0Z\220\233\25", iov_len=3932}, {iov_base="", iov_len=164}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 32 newfstatat(4, "", {st_mode=S_IFREG|0777, st_size=1444200, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 1444200, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = 0x7fd60aa09000 close(4) = 0 openat(AT_FDCWD, "/home/roland/ps_20220314140032.png", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 4 write(4, "\211PNG\r\n\32\n", 8) = 8 write(4, "\0\0\0\r", 4) = 4 write(4, "IHDR", 4) = 4 write(4, "\0\0\1\263\0\0\3>\10\6\0\0\0", 13) = 13 write(4, "\220\\\357\250", 4) = 4 mmap(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60a9e8000 brk(0x557e54ff0000) = 0x557e54ff0000 brk(0x557e55020000) = 0x557e55020000 munmap(0x7fd60a9e8000, 135168) = 0 write(4, "\0\1=E", 4) = 4 write(4, "IDAT", 4) = 4 write(4, "x\234\354\235\5\230\24G\23\206\213\3438,\270$\4\202$x\360\v\356\356\356\232\220\340vpXp"..., 81221) = 81221 write(4, "\342\344\306k", 4) = 4 write(4, "\0\0\0\0", 4) = 4 write(4, "IEND", 4) = 4 write(4, "\256B`\202", 4) = 4 munmap(0x7fd60aa09000, 1444200) = 0 close(4) = 0 close(3) = 0 sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0 munmap(0x7fd60afc0000, 12288) = 0 exit_group(0) = ? +++ exited with 0 +++ ```

So my lazy ass was thinking grim -g (slurp) work different than wayshot -s (slurp -f '%x %y %w %h'). So somewere in this is problem (for people using Sway+fish). Why I can just do slurp for grim, but for wayshot I need to add -f '%x %y %w %h'?

uncomfyhalomacro commented 2 years ago

I'm not sure if I completely understand the issue but the error that wayshot threw means that a proper integer wasn't passed by slurp to wayshot

Maybe try notify sending the variable for confirmation? The error code looks fine with respect to the syntax to me but then again I'm not a fish user so you probably know better:D

I was a fish user. lemme try

uncomfyhalomacro commented 2 years ago

Where is this bindsym command come from? Sway config does not use fish. So you misunderstood the first two commands as fish running it.

If you want to make it run fish do:

bindsym 2 exec "fish -c 'wayshot --stdout | wl-copy'"
bindsym 3 exec "fish -c 'wayshot -s (slurp -f \"%x %y %w %h\") --stdout | wl-copy'"
uncomfyhalomacro commented 2 years ago

https://user-images.githubusercontent.com/66054069/158310582-2904068d-1382-4ba3-bb67-5be08da05e28.mp4

uncomfyhalomacro commented 2 years ago

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.

In summary to all the misunderstandings. Fish is not POSIX or has its own syntax not common to POSIX-compliant shells. Sway uses sh in the backend to call commands through bindsym so using the fish -c "uwu this is my command" is the only thing u can do here. also to call slurp using fish, just use the parentheses and remove $ since fish does not support $() -> which is an invocation of a new shell and not to be confused as environmental variables.

Shinyzenith commented 2 years ago

I think that pretty much answers it, I'll wait for the author to reply.

roland-5 commented 2 years ago

Where is this bindsym command come from? Sway config does not use fish. So you misunderstood the first two commands as fish running it.

If you want to make it run fish do:

bindsym 2 exec "fish -c 'wayshot --stdout | wl-copy'"
bindsym 3 exec "fish -c 'wayshot -s (slurp -f \"%x %y %w %h\") --stdout | wl-copy'"

Thank you @uncomfyhalomacro for answers and explonations, but... It didn't help.

https://user-images.githubusercontent.com/44477799/158694835-e0f22751-38e9-4ea8-a8e7-859ff93c0d7b.mp4

Edit: I thought tham maybe wayshot-git package from Arch AUR have problems, but bin versions give me the same error.

Shinyzenith commented 2 years ago

https://user-images.githubusercontent.com/60808802/158695688-37ac348b-40c4-4235-924c-3d6cdb448c99.mp4

Shinyzenith commented 2 years ago

Initially the command you ran gave me an error too, but applying some basic debugging knowledge, i removed the \from the slurp command and it worked.

roland-5 commented 2 years ago

I copied the @uncomfyhalomacro uncomfyhalomacro proposal but in the video he did not actually give any slashes, and then, indeed it work in console, as you write. But it is not working from Sway.

    bindsym 3 exec "fish -c 'wayshot -s (slurp -f "%x %y %w %h") --stdout | wl-copy'", mode "default"

I have no idea how to debbug it and maybe it's time for me to give up. I will try in future.

Shinyzenith commented 2 years ago

I get that it's frustrating, but I'm not giving up ;)

bindsym 3 exec 'fish -c wayshot -s (slurp -f "%x %y %w %h") --stdout | wl-copy', mode "default"

what about this?

Shinyzenith commented 2 years ago

Worst case scenario, we can just put all of this in a bash script and then call the script with bindkeys.

uncomfyhalomacro commented 2 years ago

i will try in sway. zzzz i will report later

uncomfyhalomacro commented 2 years ago

I copied the @uncomfyhalomacro uncomfyhalomacro proposal but in the video he did not actually give any slashes, and then, indeed it work in console, as you write. But it is not working from Sway.

    bindsym 3 exec "fish -c 'wayshot -s (slurp -f "%x %y %w %h") --stdout | wl-copy'", mode "default"

I have no idea how to debbug it and maybe it's time for me to give up. I will try in future.

i didnt put any slashes because i dont have to escape them. but in bindsym, u have to. i think u have to escape | as well but imma try sway. later

uncomfyhalomacro commented 2 years ago

@roland-rollo here it works. with bindsym Print exec fish -c 'wayshot -s (slurp -f \"%x %y %w %h\") --stdout | swappy -f -', mode "default"

https://user-images.githubusercontent.com/66054069/158710522-fb63bc56-4f67-4dad-8c28-0c256e84d733.mp4

https://user-images.githubusercontent.com/66054069/158710583-4dec0dcb-42f6-47b8-850a-e0c998233d0a.mp4

Shinyzenith commented 2 years ago

Tysm cutie @uncomfyhalomacro

uncomfyhalomacro commented 2 years ago

@Shinyzenith close this. zzzzzzzzz

Shinyzenith commented 2 years ago

lets wait for author to confirm if it's fixed

roland-5 commented 2 years ago

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

bindsym Print exec fish -c 'wayshot -s (slurp -f \"%x %y %w %h\") --stdout | swappy -f -', mode "default"

Appear black window that do nothing and I can select any region to copy.

https://user-images.githubusercontent.com/44477799/159805763-c2aebff5-3469-4d98-8cc2-1f98a729c6e1.mp4

Either I have something strangely set in the fish or something related to the Rust environment is missing, because I typed in the console

fish -c '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
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

I can select region with slurp but after this it give me this error.

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 really appreciate your commitment and help. <3

uncomfyhalomacro commented 2 years ago

@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

Shinyzenith commented 2 years ago

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-5 commented 2 years ago

@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

I tried with backslashes and without in Sway config and terminal. :P I tried many combinations (changing ' to " and vice versa and more) and it was always the same results. Adding fish -c didn't help (bash -c or sh -c too), but I updated to Fish 3.4.1 and... It finally works:

# Screen capture
#
set $screenshot 1 selected, 2 whole, 3 selected clipboard, 4 whole clipboard
mode "$screenshot" {
    bindsym 1 exec 'wayshot -s "$(slurp -f \"%x %y %w %h\")" -f ~/ps_$(date +"%Y%m%d%H%M%S").png', mode "default"
    bindsym 2 exec 'wayshot -f ~/ps_$(date +"%Y%m%d%H%M%S").png', mode "default"
    bindsym 3 exec 'wayshot -s "$(slurp -f \"%x %y %w %h\")" --stdout | wl-copy', mode "default"
    bindsym 4 exec 'wayshot --stdout | wl-copy', mode "default"

# back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
    bindsym $mod+Print mode "default"
}

bindsym $mod+Print mode "$screenshot"
roland-5 commented 2 years ago

Thank you all! <3