Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-08-25 13:59:20

gschwarz
Member
Registered: 2023-03-30
Posts: 23

Automatically saving screenshot and playing sound

I was unsuccessfully looking for a way to achive the following two things with xfce4-screenshooter:

- automatically, i.e. without confirmation dialog, save the screenshot
- play a sound as an audio feedback

I did not find a way doing so unfortunately.

Thanks to contribution #9906, I ended up using scrot instead.
I used the following line as a keyboard shortcut configuration:

scrot -p Schreibtisch/Screenshot-%Y-%m-%d.png -e canberra-gtk-play\ -i\ camera-shutter

(I am using German as my desktop language, so annoyingly XFCE actually uses the German names for the filesystem).

Is this the best approach?

Offline

#2 2024-08-25 14:36:23

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Automatically saving screenshot and playing sound

What version of xfce4-screenshooter are you using?

The best approach is always the one that works for you. If you're interested in getting a similar result with xfce4-screenshooter....

xfce4-screenshooter -f -s ~/Pictures/Screenshot-$(date +%Y-%m-%d).png && canberra-gtk-play -i camera-shutter

...works for me using version 1.11.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2024-08-25 18:18:08

gschwarz
Member
Registered: 2023-03-30
Posts: 23

Re: Automatically saving screenshot and playing sound

Thanks for picking up this topic.
As I'm using Manjaro, I'm using xfce4-screenshooter 1.11.1.
Your suggestion does work, but it has one major drawback: if saving the screenshot fails (e.g. because I specify a non-existing directory, but many more subtle causes are conceivable), the sound is played nonetheless.
Another drawback: that way, a second screenshot on the same day overwrites the first one.

Offline

#4 2024-08-25 21:35:27

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Automatically saving screenshot and playing sound

gschwarz wrote:

Your suggestion does work, but it has one major drawback: if saving the screenshot fails (e.g. because I specify a non-existing directory, but many more subtle causes are conceivable), the sound is played nonetheless.

It appears that xfce4-screehshooter doesn't return a failed value when the action fails. It might be worth creating a bug report for this.

Another drawback: that way, a second screenshot on the same day overwrites the first one.

Try this script instead (it will bypass the bug and add a unique qualifier to the filename.

#!/bin/sh

FILENAME="$HOME/Picturess/Screenshot-$(date +%Y-%m-%d-%s).png"

xfce4-screenshooter -f -s $FILENAME > /dev/null 2>&1

[[ -e $FILENAME ]] && canberra-gtk-play -i camera-shutter

exit 0

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2024-08-27 19:03:43

gschwarz
Member
Registered: 2023-03-30
Posts: 23

Re: Automatically saving screenshot and playing sound

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 8 queries executed - Memory usage: 534.94 KiB (Peak: 535.78 KiB) ]