Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacement only works some of the time #1958

Open
1 task
lukebarton opened this issue Apr 25, 2024 · 13 comments
Open
1 task

Replacement only works some of the time #1958

lukebarton opened this issue Apr 25, 2024 · 13 comments
Labels
bug Something isn't working needs-triage More investigation is needed on this issue to understand the problem

Comments

@lukebarton
Copy link

Description

When I first installed espanso, it worked perfectly.

Then I restarted espanso, and then it only replaced properly every other time - every other other time, it would replace with a single " " character.

Then I restarted a few more times, and it took 5 or 6 tries to get a proper replacement.

And, I restarted it a few more times, and now I can't get it to work at all (it might still work, but I can't be bothered to type it out enough times to get it to show).

This is with backend: Auto. If I use backend: Clipboard, it works consistently.

ps aux | grep espanso shows 3 processes

luke.barton      73615   0.7  0.1 411336672  37728   ??  S    10:18pm   0:00.30 /Applications/Espanso.app/Contents/MacOS/espanso worker --monitor-daemon --start-reason config_changed
luke.barton      73914   0.0  0.0 410059824     48 s011  S+   10:19pm   0:00.00 grep espanso
luke.barton      72315   0.0  0.0 411073728  16032   ??  S    10:15pm   0:00.05 /Applications/Espanso.app/Contents/MacOS/espanso daemon
luke.barton      72313   0.0  0.1 411286688  28528   ??  S    10:15pm   0:00.13 /Applications/Espanso.app/Contents/MacOS/espanso launcher

Steps to reproduce

No response

Expected behavior

Using backend: Auto, it should insert the replacement regardless of the number of service restarts

Screenshots

CleanShot 2024-04-25 at 22 37 42

Logs

Auto:

22:32:38 [daemon(77812)] [INFO] reading configs from: "/Users/luke.barton/Library/Application Support/espanso"
22:32:38 [daemon(77812)] [INFO] reading packages from: "/Users/luke.barton/Library/Application Support/espanso/match/packages"
22:32:38 [daemon(77812)] [INFO] using runtime dir: "/Users/luke.barton/Library/Caches/espanso"
22:32:38 [daemon(77812)] [INFO] system info: Darwin v14.4.1 - kernel: 23.4.0
22:32:38 [daemon(77812)] [INFO] espanso version: 2.2.1
22:32:38 [daemon(77812)] [INFO] spawning the worker process...
22:32:38 [daemon(77812)] [INFO] watching for changes in path: "/Users/luke.barton/Library/Application Support/espanso"
22:32:38 [daemon(77812)] [INFO] binded to IPC unix socket: /Users/luke.barton/Library/Caches/espanso/espansodaemonv2.sock
22:32:38 [worker(77813)] [INFO] reading configs from: "/Users/luke.barton/Library/Application Support/espanso"
22:32:38 [worker(77813)] [INFO] reading packages from: "/Users/luke.barton/Library/Application Support/espanso/match/packages"
22:32:38 [worker(77813)] [INFO] using runtime dir: "/Users/luke.barton/Library/Caches/espanso"
22:32:38 [worker(77813)] [INFO] system info: Darwin v14.4.1 - kernel: 23.4.0
22:32:38 [worker(77813)] [INFO] using CocoaAppInfoProvider
22:32:38 [worker(77813)] [INFO] using CocoaSource
22:32:38 [worker(77813)] [INFO] using MacInjector
22:32:38 [worker(77813)] [INFO] using CocoaClipboard
22:32:38 [worker(77813)] [INFO] binded to IPC unix socket: /Users/luke.barton/Library/Caches/espanso/espansoworkerv2.sock
22:32:38 [worker(77813)] [INFO] monitoring the status of the daemon process
22:32:38 [worker(77813)] [INFO] monitoring the status of secure input

Clipboard:

22:34:09 [daemon(78301)] [INFO] reading configs from: "/Users/luke.barton/Library/Application Support/espanso"
22:34:09 [daemon(78301)] [INFO] reading packages from: "/Users/luke.barton/Library/Application Support/espanso/match/packages"
22:34:09 [daemon(78301)] [INFO] using runtime dir: "/Users/luke.barton/Library/Caches/espanso"
22:34:09 [daemon(78301)] [INFO] system info: Darwin v14.4.1 - kernel: 23.4.0
22:34:09 [daemon(78301)] [INFO] espanso version: 2.2.1
22:34:09 [daemon(78301)] [INFO] spawning the worker process...
22:34:09 [daemon(78301)] [INFO] watching for changes in path: "/Users/luke.barton/Library/Application Support/espanso"
22:34:09 [daemon(78301)] [INFO] binded to IPC unix socket: /Users/luke.barton/Library/Caches/espanso/espansodaemonv2.sock
22:34:09 [worker(78302)] [INFO] reading configs from: "/Users/luke.barton/Library/Application Support/espanso"
22:34:09 [worker(78302)] [INFO] reading packages from: "/Users/luke.barton/Library/Application Support/espanso/match/packages"
22:34:09 [worker(78302)] [INFO] using runtime dir: "/Users/luke.barton/Library/Caches/espanso"
22:34:09 [worker(78302)] [INFO] system info: Darwin v14.4.1 - kernel: 23.4.0
22:34:09 [worker(78302)] [INFO] using CocoaAppInfoProvider
22:34:09 [worker(78302)] [INFO] using CocoaSource
22:34:09 [worker(78302)] [INFO] using MacInjector
22:34:09 [worker(78302)] [INFO] binded to IPC unix socket: /Users/luke.barton/Library/Caches/espanso/espansoworkerv2.sock
22:34:09 [worker(78302)] [INFO] using CocoaClipboard
22:34:09 [worker(78302)] [INFO] monitoring the status of the daemon process
22:34:09 [worker(78302)] [INFO] monitoring the status of secure input

Your environment

  • Public source code:
  • Environment name and version (e.g., Rust 1.59.0):
  • Operating system and version (e.g., Ubuntu 20.04.2 LTS): macos 14.4.1
  • Espanso version (e.g., 2.1.4-beta): 2.2.1

Self-service

  • I'd be willing to fix this bug myself.
@lukebarton lukebarton added the bug Something isn't working label Apr 25, 2024
@smeech
Copy link
Collaborator

smeech commented Apr 25, 2024

So if you use clipboard it works fine?

@AucaCoyan AucaCoyan added the needs-triage More investigation is needed on this issue to understand the problem label Apr 30, 2024
@lukebarton
Copy link
Author

lukebarton commented May 13, 2024

Yes.

If I use backend: Clipboard, it works consistently.

If I use Auto, it works 1/n times, getting worse depending on how many times espanso has been restarted.

CleanShot.2024-05-13.at.12.54.10.mp4

@lukebarton
Copy link
Author

05/13/2024 05/13/2024 05/13/2024 05/13/2024 05/13/2024 05/13/2024 05/13/2024 05/13/2024 05/13/2024 05/13/2024

CleanShot.2024-05-13.at.13.00.24.mp4

@lukebarton
Copy link
Author

Clipboard works okay but sometimes outputs a v. It's a bit janky.

@smeech
Copy link
Collaborator

smeech commented May 13, 2024

backend: Auto uses Inject for short replacements and switches over to Clipboard for expansions longer than the clipboard_threshold (default 100).

However, I (Linux Mint Xfce) find Clipboard works most widely (so I have backend: clipboard in my default.yml), except for terminal instances, for which I have an app-specific config which specifies backend: auto.

I'm afraid I'm getting lost with regard to which mechanism you are using, and to drill down further I'd need to see your trigger code, and the outputs of #acfg# and #detect#. It may be necessary to tweak some of the slightly more obscure settings.

Are you using Xorg or Wayland?

@lukebarton
Copy link
Author

# espanso configuration file

# For a complete introduction, visit the official docs at: https://espanso.org/docs/

# You can use this file to define the global configuration options for espanso.
# These are the parameters that will be used by default on every application,
# but you can also override them on a per-application basis.

# To make customization easier, this file contains some of the commonly used
# parameters. Feel free to uncomment and tune them to fit your needs!

# --- Toggle key

# Customize the key used to disable and enable espanso (when double tapped)
# Available options: CTRL, SHIFT, ALT, CMD, OFF
# You can also specify the key variant, such as LEFT_CTRL, RIGHT_SHIFT, etc...
# toggle_key: ALT
# You can also disable the toggle key completely with
# toggle_key: OFF

# --- Injection backend
#
# Espanso supports multiple ways of injecting text into applications. Each of
# them has its quirks, therefore you may want to change it if you are having problems.
# By default, espanso uses the "Auto" backend which should work well in most cases,
# but you may want to try the "Clipboard" or "Inject" backend in case of issues.
backend: Clipboard

# --- Auto-restart

# Enable/disable the config auto-reload after a file change is detected.
auto_restart: true
# --- Clipboard threshold

# Because injecting long texts char-by-char is a slow operation, espanso automatically
# uses the clipboard if the text is longer than 'clipboard_threshold' characters.
# clipboard_threshold: 100

# For a list of all the available options, visit the official docs at: https://espanso.org/docs/
# espanso match file

# For a complete introduction, visit the official docs at: https://espanso.org/docs/

# You can use this file to define the base matches (aka snippets)
# that will be available in every application when using espanso.

# Matches are substitution rules: when you type the "trigger" string
# it gets replaced by the "replace" string.
matches:
  # Simple text replacement
  - trigger: ":espanso"
    replace: "Hi there!"

  - trigger: ":shrug"
    replace: "¯\\_(ツ)_/¯"

  # NOTE: espanso uses YAML to define matches, so pay attention to the indentation!

  # But matches can also be dynamic:

  # Print the current date
  - trigger: ":date"
    replace: "{{mydate}}"
    vars:
      - name: mydate
        type: date
        params:
          format: "%m/%d/%Y"

  # Print the output of a shell command
  - trigger: ":shell"
    replace: "{{output}}"
    vars:
      - name: output
        type: shell
        params:
          cmd: "echo 'Hello from your shell'"

  # And much more! For more information, visit the docs: https://espanso.org/docs/

Auto/Inject fails most of the time, as per videos.
Clipboard outputs a random v character occasionally, but otherwise works, albeit it slowly.

@lukebarton
Copy link
Author

Are you using Xorg or Wayland?

No, macos, as per the bug report template that I was asked to fill out.

@lukebarton
Copy link
Author

lukebarton commented May 13, 2024

[espanso config: "/Users/luke.barton/Library/Application Support/espanso/config/default.yml"]

backend: Auto
enable: true
paste_shortcut: None
inject_delay: None
key_delay: None
apply_patch: true
word_separators: [" ", ",", ".", "?", "!", "\r", "\n", "\u{16}"]

preserve_clipboard: true
clipboard_threshold: 100
disable_x11_fast_inject: false
pre_paste_delay: 100
paste_shortcut_event_delay: 10
toggle_key: None
auto_restart: true
restore_clipboard_delay: 300 
post_form_delay: 200 
post_search_delay: 200 
backspace_limit: 5
search_trigger: None
search_shortcut: Some("ALT+SPACE")
keyboard_layout: None

show_icon: true
show_notifications: true
secure_input_notification: true

x11_use_xclip_backend: false
x11_use_xdotool_backend: false
win32_exclude_orphan_events: true
win32_keyboard_layout_cache_interval: 2000

match_paths: [
    "/Users/luke.barton/co/dotfiles/home/espanso/match/base.yml",
]

@lukebarton
Copy link
Author

lukebarton commented May 13, 2024

title: 'Replacement only works some of the time · Issue #1958 · espanso/espanso'
exec: '/Applications/Arc.app'
class: 'company.thebrowser.Browser'

app is largely irrelevant, it happens everywhere.

@smeech
Copy link
Collaborator

smeech commented May 13, 2024

Are you using Xorg or Wayland?

No, macos, as per the bug report template that I was asked to fill out.

Oops! My apologies - I read the "Ubuntu" (example) part!

@smeech
Copy link
Collaborator

smeech commented May 13, 2024

Just puzzling how your default.yml sets backend: Clipboard, but the #acfg# output shows backend: Auto!
That probably needs resolving first, as it appears you're not using the backend you expect.
Is it possible you have more than one default.yml file? Are you editing the correct one?

If you're still having problems after sorting that out, it may be worth trying some of the X11 options, especially toggling disable_x11_fast_inject: false to true.

@lukebarton
Copy link
Author

I probably copied the acfg after changing the config. I wouldn’t read into that.

@lukebarton
Copy link
Author

I want to use auto. When I first installed/used espanso, auto worked fine. Then it got worse. It’s a bit of a shame that auto just seems broken.

I’ll try your suggestion and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage More investigation is needed on this issue to understand the problem
Projects
None yet
Development

No branches or pull requests

3 participants