Closed Kanin closed 4 years ago
I cannot find a way to send a fake q keypress to the process.
It's possible with xdotool
. At least on Plasma Desktop it works perfectly. I do it all the time with my recordings: Ctrl+F2 to start recording and Ctrl+F3 to stop recording.
The instructions are on the screencast Wiki page. The commands don't work on the current version of Konsole/Plasma, but I will update the Wiki page soon with the working ones.
It would be nice to be able to quit all current recordings gracefully via the command line, so pressing q in a terminal isn't needed.
What do you mean by this statement? It's not clear to me. What's your practical suggestion?
For xdotool to work the terminal in which the recording is taking place has to be open, correct? With my current script the terminal doesn't open, because I simply don't need it. I handle/notify on all errors.
My suggestion is a command like screencast quit
which will gracefully quit any ongoing recordings as if you pushed q in the terminal window.
For xdotool to work the terminal in which the recording is taking place has to be open, correct?
Yes. A terminal window needs to be opened. It can be minimized on the taskbar and it will still works.
My suggestion is a command like screencast quit which will gracefully quit any ongoing recordings as if you pushed q in the terminal window.
Since screencast is currently a terminal application written in shell script code, this is out of the scope of this program. This type of interaction should be handled by the user.
If you want an approach without the need of opening a terminal window, you can use a named pipe (fifo). I've tested the fifo approach and it works perfectly for me without opening a terminal, just using desktop hotkeys. I'll add an example to the screencast Wiki page.
I'll give that a shot, thank you! The wiki here on GitHub or is there another?
The screencast Wiki is currently at GitHub. There is no other.
I've updated the xdotool
method and added a method with a named pipe.
Here is the link for the method using a name pipe:
https://github.com/dbermond/screencast/wiki/Practical-Usage-Tips#using-a-named-pipe-fifo
Does it work for you?
I have made modifications to the linked Wiki page, so make sure that you're using the latest example codes.
Yeah those work for me, is there any way to not have a keybind for controlling the fifo? Having it auto create/remove it on recording start/stop?
Ok, I've made a rewrite of the named pipe method.
Now with a single script to handle everything and no need to init/de-init the fifo anymore. It also accepts options to pass to screencast so there is no need to modify the script itself to define the screencast command. Use the script --help
option to see the usage details.
Please try it.
Wow this works really well, thank you!
Nice. Good to know. Thank you for testing the script.
Closing this issue as it's solved.
So I'm currently writing a script to record and upload clips to my media server, but I'm having issues quitting the application. I basically want to set a shortcut
ctrl + shift + print
to start/stop recording, but I'm having issues stopping it. I cannot find a way to send a fake q keypress to the process. It would be nice to be able to quit all current recordings gracefully via the command line, so pressing q in a terminal isn't needed.