Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Advice needed] How to implement Push-to-talk like behavior #661

Open
kvj opened this issue Feb 5, 2024 · 5 comments
Open

[Advice needed] How to implement Push-to-talk like behavior #661

kvj opened this issue Feb 5, 2024 · 5 comments

Comments

@kvj
Copy link

kvj commented Feb 5, 2024

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

@rvaiya
Copy link
Owner

rvaiya commented Feb 6, 2024

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.

@kvj
Copy link
Author

kvj commented Feb 6, 2024

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

@rvaiya
Copy link
Owner

rvaiya commented Feb 7, 2024

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.

@tkna91
Copy link
Contributor

tkna91 commented Feb 10, 2024

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.

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.

@tkna91
Copy link
Contributor

tkna91 commented Feb 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants