Process exits only after clicking on notification
I want to use this awesome tool in a script, so I can post process is with ffmpeg or something. But sway-interactive-screenshot waits until notify-send exits, which waits until the user interacts with the notification.
So I propose either a --no-notification flag to disable the sending of a notification, or detaching the notification process from the program, so it exits normally, even when the notification still lingers.
Indeed, the script will wait for the notification to be dismissed, expire or for a user action to be requested before exiting at the moment. The reason it doesn't exit immediately is because if the use requests an action it needs to be running to act on it. Moreover, if an action is run, the script will wait for it to complete as well, e.g. when editing the screenshot.
What I understand for your request is that you want to be able to be able to write a script like this:
out=/tmp/screenshot.png
sway-interactive-screenshot -o "$out"
some-processing-command "$out"
At the moment, this works, but the processing is delayed until the notification disappears. Given that actions can enable to modify the result, e.g. by editing the screenshot or deleting it, it does make sense even here to wait.
I don't know the context around what you are trying to do, however, I can propose two things on top of my head:
- Instead of the
--no-notification, one thing that would make sense would be--no-actionas if there are no actions, there's no reason to wait for the notification to be dismissed and the script would be able to return immediately. - "Hooks" could also be considered, e.g. when the screenshot is taken, a command could be run by the script to apply a transformation. This would enable the actions to work on the result of the transformation, e.g. if we click on the notification, we'd see the final result, if we select the delete action, the final file will be deleted.
Hi! The reason why I wanna postprocess is simply because the current output files have an issue of not playing in firefox (could have made a seperate issue for that actually) and I need to adjust the pix_fmt to yuv420p (idk).
It's just a simple ffmpeg command, so it could be given to a hook, but as soon as the command gets more complicated it gets annoying.
As i save the immediate output to a temp file (ffmpeg doesn't allow the input file and output file to be the same) then pipe it through ffmpeg into my screenshot folder, the notification will offer to open the temp file. That's why I proposed a no-notification, as i will have to create a correct notification myself anyway.
It might be a usecase that not many other people need, but it would make the program easier to use in scripts and even though the notification is useful, it's a trade I'd be willing to make :)
I see, a hooks would make more sense.
Having said that, have you considered passing options to the wf-recorder command to change the codec settings?
> wf-recorder --help
...
-c, --codec Specifies the codec of the video. These can be found by using:
ffmpeg -encoders
To modify codec parameters, use -p <option_name>=<option_value>
...
-p, --codec-param Change the codec parameters.
-p <option_name>=<option_value>
Arguments are passed in the take_screencast() function. We could add configuration options to pass custom arguments here.