News for hackers. Stuff that matters.
Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @07:05AM (#26012863)
(Author here)

Feel free to ask any question, I'll be happy to answer them :)

Re:Show HN: Espanso: detect a typed keyword and replace it w... by Kaze404 on Wednesday February 03, 2021 @10:21AM (#26014384)
I seem to have found a bug. When I use the default match ":espanso" on my terminal (Kitty) it gets expanded to "hi there1", while I expect "Hi there!". Seems to work fine on Firefox.

Edit: Seems like it's an issue with shifted characters? When I type any trigger and erase, for example ":espanso", I expect the first character to be a colon (:) but instead I get a semi-colon (;). Weird.

Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @10:52AM (#26014728)
Thanks for reporting this issue! I'm working on a patch that should solve this problem. In the meanwhile, can you try adding:

backend: Clipboard

on your default.yml file and see if that helps?

Re:Show HN: Espanso: detect a typed keyword and replace it w... by shaicoleman on Wednesday February 03, 2021 @04:05PM (#26019092)
Same issue with shift not working under Kitty. (e.g. :DATE trigger produces )@?)#?@)@! )

backend: Clipboard works intermittently for me

Re:Show HN: Espanso: detect a typed keyword and replace it w... by Kaze404 on Wednesday February 03, 2021 @03:22PM (#26018611)
Works perfectly now, thank you :)
Re:Show HN: Espanso: detect a typed keyword and replace it w... by flotothemoon on Wednesday February 03, 2021 @08:50AM (#26013548)
First, this looks awesome, will be giving this a try. Is there a way to pass (inline) arguments to the expansion? Or would I use a form for that?

e.g. ":member(test)" => "private test;"

Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @09:19AM (#26013758)
Thanks! I'm currently working on a way to make this possible, but for now you will have to stick with forms :) (or passive mode [1], but I'd advice against that as it's going away in the next version).

[1]: https://espanso.org/docs/passive-mode/

Re:Show HN: Espanso: detect a typed keyword and replace it w... by Ciantic on Wednesday February 03, 2021 @07:24AM (#26012980)
It's very nice that this is done with Rust, because I'd love to get rid of AutoHotkey in Windows (which also trivally support this kind of expansions). Do you plan to release individual components as crates?

I don't see myself using single program to do just expansions, but instead building my own program with Rust that has all sort of shortcuts like in AutoHotkey. I could use your expansion code as crate instead.

Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @07:34AM (#26013062)
Hey, It's unlikely that espanso will become a library anytime soon, but I'm currently refactoring the core into separate crates to follow a more modular "workspace" approach. So if you want to write your own standalone program, you could just pick the modules you need!

Started the refactor a few days ago so it's still in the early stage, but it's happening here: https://github.com/federico-terzi/espanso/tree/dev-1.x

Re:Show HN: Espanso: detect a typed keyword and replace it w... by Tade0 on Wednesday February 03, 2021 @08:14AM (#26013299)
For keylogging and mouse/keyboard automation you can use this:

https://crates.io/crates/enigo

And this:

https://crates.io/crates/device_query/0.2.0

respectively.

Re:Show HN: Espanso: detect a typed keyword and replace it w... by tnorthcutt on Wednesday February 03, 2021 @09:01AM (#26013636)
Espanso looks pretty cool! I’m curious if you can share compelling reasons to switch from e.g. Alfred’s snippets functionality (on macOS)?

I’ve used aText for a long time, then semi-recently moved most things to Alfred, but I’m curious about Espanso :)

Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @09:17AM (#26013741)
Thanks! First things that come to my mind: 1. Espanso is free and open-source 2. If you use espanso and then move to Linux or Windows, the transition is flawless 3. It support Forms [1] and it can be extended in many ways [2] 4. You can easily collaborate with others and share snippets on the Hub: https://hub.espanso.org/

Cons: There is no GUI yet, but we are working on it

[1]: https://espanso.org/docs/forms/ [2]: https://espanso.org/docs/matches/

Re:Show HN: Espanso: detect a typed keyword and replace it w... by tnorthcutt on Wednesday February 03, 2021 @02:00PM (#26017635)
Thanks for the replies!

One more question if you're up for it: does Espanso suffer from having secure input disabled?

I frequently see this with both aText and Alfred: "Secure input is enabled (by loginwindow)" (aText) & "loginwindow seems to be preventing text expansion by locking secure entry" (Alfred)... with no indication as to how to rectify the situation.

Re:Show HN: Espanso: detect a typed keyword and replace it w... by tnorthcutt on Wednesday February 03, 2021 @02:28PM (#26018006)
Ah nevermind, I see this when I run `espanso start`:

"WARNING: An application is currently using SecureInput and might prevent espanso from working correctly."

For anyone else who ends up here with the same problem: this blog post was helpful as it suggested that locking & unlocking my system might remove the lock on secureinput created by loginwindow: https://rakhesh.com/mac/macos-find-app-using-secure-input/

Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @05:12PM (#26019852)
Yes, unfortunately there is not much we can do about that, given that macOS does not give us much information :)
Re:Show HN: Espanso: detect a typed keyword and replace it w... by shaicoleman on Wednesday February 03, 2021 @04:08PM (#26019123)
It doesn't detect backspace with non-backspace keys under Linux.

I'm using the Colemak keyboard layout, and Caps Lock is mapped to Backspace.

Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @05:11PM (#26019833)
Thanks for reporting this issue! I'm currently rewriting the detection mechanism core, so hopefully this problem will be solved in the next version :)
Re:Show HN: Espanso: detect a typed keyword and replace it w... by akvadrako on Wednesday February 03, 2021 @07:13AM (#26012906)
How does this integrate on Linux? I took a minute and couldn't find that information on the website.
Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @07:19AM (#26012945)
Espanso currently supports X11-based linux systems through the X Record Extension [1] and libxdo [2]

That said, I'm currently working on another engine based on evdev that could be able to support also Wayland systems.

For the linux install see also: https://espanso.org/install/linux/

[1]: https://www.x.org/releases/X11R7.6/doc/libXtst/recordlib.htm... [2]: https://github.com/jordansissel/xdotool

Re:Show HN: Espanso: detect a typed keyword and replace it w... by eterps on Wednesday February 03, 2021 @12:34PM (#26016332)
Awesome, would love to give it a try as a Wayland user.
Re:Show HN: Espanso: detect a typed keyword and replace it w... by federicoterzi on Wednesday February 03, 2021 @05:14PM (#26019872)
Thanks! your best bet is to activate notification on the issue I linked before :) I'm currently working on it, the detection part is almost done, I'll need to figure out the best way to inject the text after detecting a match