[Advice needed] How to implement Push-to-talk like behavior
Hi,
I swear I've spent quite some amount of time reading documentation and trying things out. How can I implement the following behavior?
a single press will emit C-d, but press and hold will emit C-d on press start and C-d on press finish. The idea is to toggle Mic with short press and turn it on and then off for long press.
Any advice is much apreciated
I don't believe this is possible with the current feature set. If I understand you correctly, you effectively want to simulate a key press on key release.
This feels like something that should be built into the recording software, and I can't think of too many instances in which it would be generally desirable, but I am willing to consider the addition of such an action if you can make a case for it.
If you are really desperate, you can probably hack together a shell script to do this using a combination of keyd monitor and keyd input, but I wouldn't recommend it :P.
Thanks for the response!
Hacking is definitely possible.
I was thinking about something like *layerm(<layer>, <macro>)* but with two macro: one before layer change, another after
Update: it's actually working approach
Before proceeding, it would be preferable if you could precisely outline the action you are proposing as well as the class of problems it solves.
At the moment, the use case seem fairly niche, and I tend to take a conservative approach to new features. I am not yet persuaded that having a dedicated action which does something on key up is warranted.
Let me make a request as well.
I would like to use something like this to turn my computer keyboard into a virtual MIDI keyboard.
- https://github.com/gbevin/SendMIDI
- https://github.com/cbdevnet/midimonster
To do this, I need to have it execute a NOTE OFF command when the key is up.
Something like this already exists, but to enter MIDI on a computer keyboard requires focus on the GUI window, which makes it difficult to concentrate on the operation seamlessly.
https://vmpk.sourceforge.io/
it would be very smart if it could be done in keyd.
The basic idea would be that key down would execute a key or command to enable/open some function, and key up would execute a key or command to disable/close it, but it could be used in a variety of ways, such as the following.
- Record audio only while the key is pressed.
- Record from inside the computer or microphone for as long as the key is held down, and when released, a confirmation dialog appears before execution, and selecting Y will move or upload the file.
- Shoot video only while the key or foot-switch is pressed.
- While the key is pressed, it will record video from a USB camera, computer screen, etc. and record it to a file name, such as a timestamp. When the key is released, it kills the process (e.g. ffmpeg) and completes the video recording.
- vim-clutch https://github.com/alevchuk/vim-clutch
- When you start pressing the key, open a new terminal and execute commands via ssh, release the key after checking the results and a confirmation dialog appears before execution, select Y to log out and close the terminal
It is fascinating to be able to complete start and finish with a single key. I think it would make things much easier by lowering the cognitive load for many things.