timothycrosley / streamdeck-ui

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

Begining Of entered text missing on output #303

Closed Data-007 closed 1 year ago

Data-007 commented 1 year ago

Entered text is not displayed correctly in an external application(Discord)

To Reproduce Inclosed below is how the button is configured, there is a line break (enter key)in the text field, the cursor is where the green arrow is. StreamDeckFault

Expected behaviour It used to work that when pressed(button) the text would appear and be submitted in 'Discord'. However, when pressed I get this in discord ("ood Morning Erik") the 'G' is missing and other beginning letters can be missing.

This is not necessarily tide to a specific version(certainly the last two versions of streamdeck-ui), it just started being a problem Iam famous for saying it, in discord chat.

Screenshots Please see above screenshot.

Operating system (please complete the following information)

Stream Deck Version -XL-

dodgyrabbit commented 1 year ago

@Data-007 I'm going to have to venture a guess that this is some kind of race condition. Since you have both a command and a text instruction, which happens to run in that order (the program doesn't really make an explicit guarantee that it would do that). I suspect what happens is sometimes when executing the switch command (activating discord), it's not yet ready to accept text but streamdeck_ui is already starting to type. There is no feedback mechanism to "know" when discord (or any other window for that matter) is ready. There are hacks we can do, like add an arbitrary pause in, but - they won't work in all situations and may even be undesired.

Some possible workarounds:

Closing as this won't result in direct application changes at this time. Thanks

Data-007 commented 1 year ago

@dodgyrabbit Something is wrong here.

I have copied the line from your readme: bash -c "wmctrl -a firefox && xdotool key alt+1" changed one item "firefox" to "discord" bash -c "wmctrl -a discord && xdotool key alt+1"

Still, the text is missing in the post in discord. In fact, while testing while editing the command: field Any text was divided between the command:Field and discord

Data-007

dodgyrabbit commented 1 year ago

I think you are misunderstanding my comment. Copy and pasting that particular command wasn't meant to fix the problem. I'm suggesting an alternative approach, which is to not use the Write Text feature in streamdeck_ui at all, but see if you can construct a command that switches and types in a reliable way, and use that instead. The xdotool type command seems to be an alternative way to get text to your application. You will have to experiment and test how to construct switching, waiting, typing from the terminal to be reliable. This will need to be done with a series of commands. Once you've got that working - use the Command feature to then send that.

If that is not something you're interested in pursuing, that's fine. Was just trying to provide some guidance on alternative problem solving approaches.

Hope that clears up what I was saying.