timothycrosley / streamdeck-ui

A Linux compatible UI for the Elgato Stream Deck.
https://timothycrosley.github.io/streamdeck-ui/
MIT License
1.14k stars 242 forks source link

Ability to hold keys #199

Open attilakv opened 2 years ago

attilakv commented 2 years ago

When I work with a drawing tablet I use the streamdeck for shortcuts. This is mostly fine, but I ran into some limitations. For example in Krita there are a few shortcuts that require a mouse action while a key is held: shift + click-drag to resize the brush, ctrl + mmb-drag to zoom, ctrl + click to sample a color, etc.

Currently, if I press and hold a button on the streamdeck, the associated key(s) get pressed and released, instead of being held.

igventurelli commented 2 years ago

+1 It may be applied for Discord's Push to Talk feature

dodgyrabbit commented 2 years ago

Interesting idea. Perhaps this should be the default behaviour? I.e. if you press the Stream Deck button, they keypress combination is pressed. If you release it, the keys are released.

Note that it is possible to have a series of key presses. We would have to decide if it just holds the "last" set of key presses or a specific group.

For example: alt+F4, F11 means press alt and F4, then release them, then press F11 and release F11.

So if we added this hold logic as the default, which keys should be held? Option 1 None of them - only works if there's one set Option 2 The first group alt+F4 Option 3 The last group F11 Option 4 We add a modifier keyword hold to a group, that means hold this group combination until the key is released. For now, this would only be possible on one group. In theory, we could make it work for multiple groups - but that would mean you need to press the button multiple times to complete a command - which could be confusing.

hold+alt+F4, F11 - this means, press alt then F4 and hold them until the Stream Deck button is released. When released, press F11 and release F11 (no hold).

alt+F4, hold+F11 - this means, press alt then F4 then release them, then press and hold F11 until the Stream Deck button is released. Then release F11.

Syntactically hold can be anywhere in the group. Thoughts?

attilakv commented 2 years ago

I think your option 4 is the most versatile, but I would like to suggest a few other examples/use cases:

This would give the user an OnPress - OnRelease functionality. Also, I think a hold alt+F4 syntax would be nice as it can be conceptualized as "dynamic delay"

dodgyrabbit commented 2 years ago

Agreed, I like the idea of having hold on it's own.

There are some obstacles to implement this. The current application has a relatively simple model. A key is pressed, a bunch of stuff is executed and it's done. Everything is done on the main thread - so effectively everything stops processing while the key is being held down. You can even see it today by adding delay 5 to a Press Keys. It will delay for 5 seconds, but it will also delay processing UI events or any other keypress events. In reality, a more sophisticated key handler and event processor needs to be developed to support features like this.

There are other considerations - I think it makes sense to have the option for any "action" (e.g. press keys, starting a program, changing page etc) to be bound to various events (like key down, key up, key held, two keys held etc).

Will loop back to this case at some point but some ground work is needed to proceed.

sftim commented 2 years ago

I like the idea of defaulting keypresses to momentary and having a special option to trigger press+release for keys (so that even if you hold down the button, the release event fires). Being able to trigger macros (eg a sequence key left-alt down, key f4 down, key f4 up, key left-alt up, key f11) would be even better.

zombiehoffa commented 2 years ago

In the elgato store there is an opensource app that does this (and a bunch of other cool stuff) already, https://github.com/BarRaider/streamdeck-supermacro , specifically the Keystroke PTT function. Not sure if this will help get this done faster or not but figured I would share since I depserately need this behavior to work if I am to use this on linux.

Hopefully it helps.

Danie10 commented 1 year ago

Yes, I just realised that for mouse drawing on the screen with KDE Plasma, I need to hold meta+shift so would be really useful. And various games also make use of keys being held to adjust things. I tested on the Windows side and see their key press function does do hold as an existing feature.

coolapso commented 1 year ago

hi, this project seems to be stale and a new fork as been made with the intention of replacing this one.

if this still an issue please reopen it at: https://github.com/streamdeck-linux-gui/streamdeck-linux-gui