Satty icon indicating copy to clipboard operation
Satty copied to clipboard

"No such file..." error on copy to clipboard

Open vstuen opened this issue 1 year ago • 1 comments

I receive the following output when I attempt to copy to clipboard:

~> grim - | satty --filename - --fullscreen

(process:148659): Gtk-WARNING **: 22:57:10.148: Unknown key gtk-modules in /home/vegard/.config/gtk-4.0/settings.ini

(satty:148659): Adwaita-WARNING **: 22:57:10.174: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead.
Error saving No such file or directory (os error 2)

Saving files works just fine. I've also tried running it with an image path instead of piping to it.

Other scenarios that successfully copies the image to clipboard:

# plain grim + wl-copy
grim - | wl-copy -t image/png

# swappy works as well
grim - | swappy -f -

I use satty 0.13.0, with wl-clipboard.

In addition, I have copyq set up to manage my clipboard history (I've also tried without it running - just in case).

I've set copy-command = "wl-copy -t image/png" in the config.

vstuen avatar Jul 19 '24 21:07 vstuen

This occurs for me as well. FWIW, I've set the same copy-command, though it'd surprise me if that were relevant. (Edit: tested with --copy-command="cat > ~/asdf.png"; no change in behavior and asdf.png is not created, so it's not that.)

I'm running satty-bin v0.14.0 from the AUR on Arch, but I also just tested with the built-from-source satty (which happens to be on v0.13.0) and the same error occurs. Happy to provide further details if it'd help with debugging!

LRitzdorf avatar Aug 04 '24 03:08 LRitzdorf

Update! I've gotten this to work by creating a shell script (containing my desired wl-copy -t image/png command), and calling that script as my copy command.

Based on this, it looks like Satty expects a copy command that it can execute as a single token, rather than passing it to a shell (as in C's system()) for expansion.

Edit: Yep, see https://github.com/gabm/Satty/blob/3c18d64ae208dab6115457af2ff0c167a2cb224c/src/sketch_board.rs#L235. Since the user is providing this command themselves, I thiiiink we can safely pass this to a shell. PR incoming; please feel free to comment!

LRitzdorf avatar Sep 05 '24 02:09 LRitzdorf