6

I'm trying to invoke scrot with a bindsym so I have a keyboard shortcut to take screenshots

This command works when run as a one-liner or as a bash .sh:

save_dir="/home/dork/apache/drkt.eu/subdomains/u/";
random_name=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1).png;
scrot -s "$save_dir/$random_name";
echo -n "https://u.drkt.eu/$random_name" | xsel --clipboard

It does not work when ran by i3 bindsym $mod+Shift+Z exec bash -c save_dir="/home/dork/apache/drkt.eu/subdomains/u/"; random_name=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1).png; scrot -s "$save_dir/$random_name"; echo -n "https://u.drkt.eu/$random_name" | xsel --clipboard

i3 reports an error when the above is run, but not when as a shell script, though neither work. I assume that's just because bash is eating the error and not reporting it back to i3

This is the error when ran as a one-liner:

ERROR: Received ConfigureNotify for unknown window 0x00600000
ERROR: Received ExposeEvent for unknown window 0x00600000
ERROR: Received ConfigureNotify for unknown window 0x00600000
ERROR: Received ConfigureNotify for unknown window 0x00600007
ERROR: Received ExposeEvent for unknown window 0x00600007
ERROR: Received ConfigureNotify for unknown window 0x00600007
ERROR: Received ConfigureNotify for unknown window 0x0060000a
ERROR: Received ExposeEvent for unknown window 0x0060000a
ERROR: Received ConfigureNotify for unknown window 0x0060000a
ERROR: Received ConfigureNotify for unknown window 0x0060000d
ERROR: Received ExposeEvent for unknown window 0x0060000d
ERROR: Received ConfigureNotify for unknown window 0x0060000d
ERROR: Received ConfigureNotify for unknown window 0x00600010
ERROR: Received ConfigureNotify for unknown window 0x00600010
ERROR: Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'shmlog', 'debuglog', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'sticky', 'split', 'floating', 'mark', 'unmark', 'resize', 'rename', 'nop', 'scratchpad', 'swap', 'title_format', 'title_window_icon', 'mode', 'bar', 'gaps'
ERROR: Your command: exec bash -c save_dir="/home/dork/apache/drkt.eu/subdomains/u/"; random_name=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1).png; scrot -s "$save_dir/$random_name"; echo -n "https://u.drkt.eu/$random_name" | xsel --clipboard
ERROR:                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/run/user/1000/i3/errorlog.1235 (END)

I am open to alternatives if there is a better way to do this than the i3 config!

Thank you for reading <3

top 3 comments
sorted by: hot top controversial new old
[-] lemmyreader@lemmy.ml 2 points 2 months ago

Does inserting --release like this bindsym --release $mod+z exec scrot -s help ?

[-] drkt@lemmy.dbzer0.com 1 points 2 months ago

I'm afraid not; it's the exact same error

[-] drkt@lemmy.dbzer0.com 1 points 2 weeks ago

It appears that -s is simply incompatible with i3wm in that it spawns an interactive process and i3wm can't do that. Removing or changing the flag to something that does not require any interaction works.

this post was submitted on 28 Apr 2024
6 points (100.0% liked)

Linux 101 stuff. Questions are encouraged, noobs are welcome!

936 readers
9 users here now

Linux introductions, tips and tutorials. Questions are encouraged. Any distro, any platform! Explicitly noob-friendly.

founded 1 year ago
MODERATORS