bitfocus / companion

Bitfocus Companion enables the reasonably priced Elgato Stream Deck and other controllers to be a professional shotbox surface for an increasing amount of different presentation switchers, video playback software and broadcast equipment.
http://bitfocus.io/companion
Other
1.61k stars 503 forks source link

Enhancement Request - long press button action #925

Closed theColourSpace closed 1 year ago

theColourSpace commented 4 years ago

Describe the feature Would be great to have an alternative button action that would be triggered by a long press.

Is this platform dependent (windows, mac, ..)? Independent

If documentation is required to implement, do you know where to find it? Not externally dependent.

Usecases Being able to load a video stream in preview vs direct insert for example.

Or having one button perform multiple tasks. Really the sky is the limit!

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label Enhancement to this issue, with a confidence of 0.99. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

JeffreyDavidsz commented 4 years ago

If I understand your question correctly, use press down for your action with a delay. then use release to cancel the press down action. So when holding key down nothing will happen untill delay time is meet (for example 300ms). when releasing the button before that the operation is canceled. I use this for shutdown projectors

theColourSpace commented 4 years ago

No, I mean to be able to have two different actions. So one short press action, and a different action for a long press. So maybe your projector button as an example, a short press would turn on the projector, but a long press would turn it off.

On Fri, Dec 13, 2019 at 1:24 AM Jeffrey Davidsz notifications@github.com wrote:

If I understand your question correctly, use press down for your action with a delay. then use release to cancel the press down action. So when holding key down nothing will happen untill delay time is meet (for example 300ms). when releasing the button before that the operation is canceled. I use this for shutdown projectors

JeffreyDavidsz commented 4 years ago

That probably still can be made in the same way only add the on command to the press down. maybe add a bit of delay to the cancel all actions. Just test it. Key is that the on command is send before the cancel (on key release) is being done. Feel free to reopen this issue if it doesnt work for you

theColourSpace commented 4 years ago

I was using that example for your situation. Mine is that I want to send one keyboard short cut for a short press and a different keyboard short cut for a long press.

So ctl-v for a short press. Ctl-c for a long press. If the ctl-v command gets sent before the Ctl-c command, then the ctl-c wouldn’t work.

On Fri, Dec 13, 2019 at 1:33 AM Jeffrey Davidsz notifications@github.com wrote:

That probably still can be made in the same way only add the on command to the press down. maybe add a bit of delay to the cancel all actions. Just test it. Key is that the on command is send before the cancel (on key release) is being done. Feel free to reopen this issue if it doesnt work for you

AnthonyHunt commented 4 years ago

Also the Next/FF scenario. Short press for next track, long press to skip through a track.

krocheck commented 4 years ago

Also for PTZ ... short press for slow and longer press kicks to faster speed. You need the release action still for the stop command.

ryanjohnclark commented 4 years ago

This would be a great feature for my application as well.

MeestorX commented 4 years ago

I support this. Love to see it happen.

Degeert commented 4 years ago

This would be a fantastic feature for many uses. It would save a lot of "going thru pages" time.

hjoelr commented 3 years ago

This is a feature I've wanted myself too. I think this would be super useful. In my scenario, momentary press for PTZ preset recall. Long press for save preset.

@krocheck @JeffreyDavidsz Is there some process for determining which features would be accepted into the application? I'm not sure I have time to work on this, but lets say I did, I wouldn't to spend the time on it only to have it not be approved for merge. I also wouldn't want to go about it one way only to find that it should be gone about another.

MeestorX commented 3 years ago

I ended up implementing this myself, but I think that was one of many things that I did that required hooking into the main companion code in a way that might not survive updates. So far so good though!

hjoelr commented 3 years ago

@MeestorX Could you somehow share your code? Maybe it would at least be a start to an official solution.

krocheck commented 3 years ago

Everything is case-by-case, but generally we accept new features to the core without major issues. You can find PRs where we have revisions that are needed. This might be an edge case where the implementation strategy should be discussed in advance. For instance, I suspect you would need a separate table called "Long Press Actions" or "Button Hold Actions". I would then expect a checkbox at the top with the rest of the bank settings called "Enable Long Press Actions" (or something to that effect), along with the delay interval with a default hold amount.. That checkbox should show/hide that extra table so that it doesn't clutter the screen for the [likely] majority of button cases that don't need it.

I know you said you likely don't have time at the moment, but those are my thoughts. Others can chime in.

MeestorX commented 3 years ago

@MeestorX Could you somehow share your code? Maybe it would at least be a start to an official solution.

https://github.com/MeestorX/companion-module-yamaha-MIDI

It's likely to not be useful as a general idea, as I implemented it for only one function, macro recording. For general-purpose, there'd likely need to be an additional drop-down in button editing screen, so instead of just key-down, key-up, feedback, there'd also be "long-press" with an additional action selectable. However, personally, I don't think that would even go far enough, as I'd like to see:

Gets pretty messy so I don't really know how best to create a gui for all those options, but I definitely need all those options, just haven't gotten around to building them in.

clalun commented 3 years ago

This is a wanted function for saving plz camera presets as mentioned in another comment. To have "Recall preset" on a quick button down and "Save preset" when holding down for a while.

I managed to temporarely solve this by using "Save Preset" with a delay of 3000 ms on "Key Down" and have "Recall preset" on "Key Up" without any delay. You can't push buttons quickly Though as this always saves the current camera position after 3 sec!!! I was really testing how the "Delay" field worked. I thought that it just defined that if the button were held down for the delay time it triggered the action. But of course it just delayed the action. So it is two different types of delay that perhaps could solve the feature.

A real Long press button feature would be so much better!

Julusian commented 3 years ago

Personally, I think it should be changed to have press and long press actions, with down and up still there but lower down as advanced options. Combining down&up with long press will give weird or confusing results, so a dedicated press type too would be best. Latching buttons may not want to be changed, I'm not sure how to handle that without it becoming really complex.

But this will require some thought on the backend, as during upgrade scripts the modules have to explicitly look and both the actions and release actions, so there will need to be some api change to include the new action triggers

zineer commented 3 years ago

I did upvote this since I think it would be a useful feature.

However, I saw a few people mentioned PTZ camera preset programming which was my use case, so wanted to share my workaround, built upon what @clalun shared. On the keydown, I added a Save preset action with a delay of 2000ms, then in the keyup action I added a Recall preset action along with an internal: Abort all delayed actions action. So when pressed and released, it recalls the preset. When held for over 2 seconds it saves the preset (and probably recalls it, but it is saved by then). The downside would be that I assume abort all delayed actions really does mean all, not just for this button, so if you had delayed actions from other buttons, they would be aborted as well.

image

istnv commented 3 years ago

The latest builds add a 'This' button option to most internal actions, including abort: image

hparsons56 commented 3 years ago

I upvoted as well, but playing off zineer's suggestion, I did it slightly differently. Needing to reset a ProPresenter timer only on a long hold, I created a button on page 99 (which I'll never use), with a reset clock and stop clock, both set at 3000 milliseconds.

Then I had my timer button (on page 1, Key Down) set to Start the clock, and Press and Release button 2 on page 99. I set Key Up to cancel all delayed actions (like zineer did). If I release the key in less than 3 seconds, it will kill the reset.

I also put the timer value on the key display, using the $(propresenter:watched_clock_current_time) variable

theColourSpace commented 3 years ago

If you hold it down it does a stop AND a reset, yes?

In that case, it’s the same work around we’ve discussed before. It’s possible to set up a system where you can do Action A or (Action A & B)... but not one where you do either Action or (just) Action B.

Which is the problem. I suppose you could set up some clunky work around with the ability to execute scripts from companion. But this seems like such a straightforward utility.

On Sat, Apr 3, 2021 at 4:03 PM hparsons56 @.***> wrote:

I upvoted as well, but playing off zineer's suggestion, I did it slightly differently. Needing reset a ProPresenter timer only on a long hold, I created a button on page 99 (which I'll never use), with a reset clock and stop clock, both set at 3000 milliseconds.

Then I had my timer button (on page 1, key down) set to Start the clock, and Press and Release button 2 on page 99. I set key up to cancel all delayed actions (like zineer did). If release the key less than 3 seconds, it will kill the reset.

I also put the timer value on the key display, using the $(propresenter:watched_clock_current_time) variable

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/925#issuecomment-812918506, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZGIKRPF6X7FGZ5Q4YC3GLTG5YBLANCNFSM4J2BB7TQ .

--

Juan Salvo

istnv commented 3 years ago

The abort single button now uses the 'Unlatch?' option to abort the release actions on latch and non-latch buttons. So it is now possible: down-with-delay... run Action... Abort (skip) release actions<--- only down actions run down-up... run Up action... abort all (delayed down) Actions<--- only up actions run

fdebeer commented 3 years ago

The abort single button now uses the 'Unlatch?' option to abort the release actions on latch and non-latch buttons. So it is now possible: down-with-delay... run Action... Abort (skip) release actions<--- only down actions run down-up... run Up action... abort all (delayed down) Actions<--- only up actions run

to make it more clear: on key down: 'action 1' with 1000 ms delay, 'aboard action on button' delay 1050 ms (or use relative delay) and mark 'unlatch' on key up: 'aboart all delayed action', 'action 2' when you press short, action 2 goes, longpress 1 sec action 1 goes

theColourSpace commented 3 years ago

Thank you for this! But I'm not seeing an "unlatch" option... can you clarify that part?

On Tue, Apr 6, 2021 at 8:31 AM fdebeer @.***> wrote:

The abort single button now uses the 'Unlatch?' option to abort the release actions on latch and non-latch buttons. So it is now possible: down-with-delay... run Action... Abort (skip) release actions<--- only down actions run down-up... run Up action... abort all (delayed down) Actions<--- only up actions run

to make it more clear: on key down: action 1 with 1000 ms delay, aboart action on button delay 1050 ms (or use relative delay) and mark 'unlatch' on key up: aboart all delayed action, action 2 when you press short, action 2 goes, longpress 1 sec action 1 goes

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion/issues/925#issuecomment-814082051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZGIKQUGNC5LAJHQTPRTI3THL5LJANCNFSM4J2BB7TQ .

fdebeer commented 3 years ago

Thank you for this! But I'm not seeing an "unlatch" option... can you clarify that part? on the internal 'aboard action on button' there is an 'unlatch' checkbox. check this one to disable the up-key this internal command is in the beta's, not yet in the stable

istnv commented 3 years ago

image

istnv commented 3 years ago

I was typing that on my phone :)

The abort single button now uses the 'Unlatch?' option to abort the release actions on latch and non-latch buttons. So it is now possible: down-with-delay... run Action... Abort (skip) release actions<--- only down actions run down-up... run Up action... abort all (delayed down) Actions<--- only up actions run

to make it more clear: on key down: 'action 1' with 1000 ms delay, 'aboard action on button' delay 1050 ms (or use relative delay) and mark 'unlatch' on key up: 'aboart all delayed action', 'action 2' when you press short, action 2 goes, longpress 1 sec action 1 goes

theColourSpace commented 3 years ago

Thank you!

theColourSpace commented 3 years ago

If anybody needs example of this. Here it is. Works great in 2.2.0. Screenshot from 2021-04-06 17-24-56

Julusian commented 1 year ago

This is in the 3.0 betas