News for hackers. Stuff that matters.
Re:Espanso Cross-Platform Text Expander by albertzeyer on Friday August 26, 2022 @07:19AM (#32605898)
I was wondering how this was done technically, i.e. how it gets the current text content, and how it would do the text replacement.

From a quick glance, it looks like for getting the text, it listens to all the keyboard events globally. I can imagine many potential problems and shortcomings with this approach, but on the other side, this is probably the most simple and most generic solution, working for almost every application.

For sending the text, it does sth similar, i.e. it just injects global key events. Probably first some key backspace events to delete the old text, and then the keys for the replacement text.

https://github.com/espanso/espanso/blob/dev/espanso-inject/s...

But maybe I understand the code wrong. I did not delve too deep into it.

Re:Espanso Cross-Platform Text Expander by federicoterzi on Friday August 26, 2022 @09:18AM (#32607101)
Author here :) You're pretty close! Espanso currently uses a combination of key injection + clipboard to get the best results. There are still some edge cases, but we are trying to solve them with other approaches, such as using custom Input Methods (the same mechanism used for some languages like Chinese)
Re:Espanso Cross-Platform Text Expander by SaulJLH on Friday August 26, 2022 @01:00PM (#32610042)
Any plans for AHK support? v1, but esp. v2: https://www.autohotkey.com/
Re:Espanso Cross-Platform Text Expander by veidr on Friday August 26, 2022 @07:54AM (#32606160)
I think there is literally no other way to do this well.

Maybe for some subset of applications and OS, it could work, but Espanso works with virtually everything on Mac and Linux. (Windows too I think but I don’t use it there.)

It does require a high degree of trust, but otoh it is extremely useful.

It is one of the most useful pieces of software I have ever used, so I’m willing to extend it a level of trust similar to my OS or password manager.

Re:Espanso Cross-Platform Text Expander by kamban on Friday August 26, 2022 @10:50AM (#32608271)
I have seen its codebase, and even took some inspiration for my Elephas app. The founder is an expert I can say.