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 issue with Kitty #281

Closed
dufferzafar opened this issue May 14, 2020 · 35 comments
Closed

Replacement issue with Kitty #281

dufferzafar opened this issue May 14, 2020 · 35 comments
Labels
bug Something isn't working Linux Related to the Linux operating system

Comments

@dufferzafar
Copy link

dufferzafar commented May 14, 2020

I looked at existing issues, and even at the code. It seems there is some "special" handling required for terminals. Can you please add kitty to the list?

With a file like:

matches:
  - trigger: ";name"
    replace: "Shadab Zafar"

  - trigger: ";email"
    replace: "hello@email.com"

Results in:

Espanso on Kitty

Notice the issues with case of the text as well as special characters like @.

@federico-terzi
Copy link
Collaborator

This is pretty strange, as it should work correctly! Could you please try to add this line to your configuration and see if that helps?

fast_inject: false

@federico-terzi federico-terzi added bug Something isn't working Linux Related to the Linux operating system labels May 15, 2020
@federico-terzi
Copy link
Collaborator

Hey,
I'm going to close this issue as it's been a while since the last follow up.
Let me know if you have other questions.
Cheers :)

@matclab
Copy link

matclab commented Jul 30, 2020

Still have some issues here with kitty 0.18.1 and espanso 0.6.3.

With default configuration file, 07/30/2020 expands to àè:"à:éàéà and with fast_inject: false, it expands to )&>#)>@)@)

@matclab
Copy link

matclab commented Jul 30, 2020

I wonder if i3 doesn't do something in between because when trigerring an expansion in kitty terminal i3 shows me a somewhat unrelated error about duplicate keybinding or not being able to translate some keys.

@matclab
Copy link

matclab commented Jul 30, 2020

Hmmm it's not related to kitty, as I've the same behavior in xterm or gnome-terminal

@federico-terzi
Copy link
Collaborator

@matclab I'm sorry you experienced this problem, what keyboard layout are you using? In the meanwhile, you can try setting:

backend: Clipboard

in your default.yml config

@matclab
Copy link

matclab commented Jul 31, 2020

Thanks for your help.
My layout is:

$setxkbmap -query 
rules:      evdev
model:      pc105
layout:     fr
variant:    oss

@federico-terzi
Copy link
Collaborator

@matclab thank you. It seems like the non-English layouts have some problems on Terminals without the Clipboard backend

@idr4n
Copy link

idr4n commented Feb 28, 2021

Hi there,

I'm having this issue as well in kitty (Garuda Linux). fast_inject: false does solve the issue however the backspace feature, although it works as well, it add some characters to the initial trigger (basically it doesn't come back to the same trigger characters). Alacritty and Konsole terminals don't have this issue.

@federico-terzi
Copy link
Collaborator

Hey @ivanddm,

I'm sorry you experienced this problem! Could you please try adding the backspace_delay: 10 option in your default.yml file and see if that helps? You might also need to tweak that number.
If it does, then we can move it to an app-specific config so that it only affects Kitty. A good starting point is this discussion on VSCode: #544 (comment)

Cheers :)

@idr4n
Copy link

idr4n commented Mar 2, 2021

Thanks @federico-terzi. I will try that out, thanks a lot for your support.

In Mac, espanso is working beautifully (I'm gradually migrating from textexpander). However in Linux, besides the issue with Kitty (which might make me use a different default terminal, alacratty or konsole don't have such issues), I noticed as well that it takes a considerable amount of time to restart espanso (like a minute or so). It might be something in my config that is causing the issue, not sure.

Anyways, I will come back to you after trying the suggested backspace_delay.

@federico-terzi
Copy link
Collaborator

I noticed as well that it takes a considerable amount of time to restart espanso

Wow, this is unbearably slow! Espanso shouldn't take more than a second or two to restart, so there is something seriously wrong here :)

How many matches do you have? Did you install any "big" package?

@idr4n
Copy link

idr4n commented Mar 4, 2021

@federico-terzi as suspected, it was something with my configuration, not sure what. I switched to another distro with i3wm and espanso is running smoothly and restarting right away, not delay whatsoever. Regarding Kitty, I don't think I will be using it in Linux, as Alacritty seems to work much better in Linux. So no problem from my side. Thanks in any case for following up :)

@federico-terzi
Copy link
Collaborator

@ivanddm Great! No worries :) Feel free to point out any other issues as they occur!

@crisidev
Copy link

Is it possible to reopen this? I am experiencing issue with replacement in Kitty 0.24.2 on ubuntu, where every replacement becomes a v.

I have tried to use the backend: Clipboard and fast_inject: false.

This is only happening on Kitty, other terminals work fine and the rest of windows work fine as well.

I am not sure how to debug this..

@federico-terzi
Copy link
Collaborator

@crisidev I'm sorry you experienced this problem! What version of Espanso are you running? Upgrading to the v2 might help: #594 (comment)

@crisidev
Copy link

First of all thanks for this product! I am running espanso 2.1.3-alpha and the character that get printed is a literal v. I have disabled espanso for now on kitty by setting backspace_delay to a very high number, but I would like to be able to debug this 😞

@federico-terzi
Copy link
Collaborator

@crisidev Thanks! That's interesting, what keyboard layout are you using? :)

@crisidev
Copy link

crisidev commented Mar 23, 2022

My layout is QUERTY with en_US.

On top of this I use https://github.com/rvaiya/keyd for some remapping

 Turns capslock into an escape key when pressed and a control key when held.
capslock = overload(C, esc)

# Swap alt and meta
leftalt = leftmeta
leftmeta = leftalt

# Control arrows
leftcontrol = overload(controlfn, control)

# Mic mute
f8 = f20

# Functions
[controlfn]
right = end
left = home
up = pageup
down = pagedown
backspace = delete

And these xset options:

  xset r rate 200 60
  xset m 2 60
  xset b off

I want to reiterate that this doesn't look like a system wide problem as espanso works perfectly on any application apart from Kitty (I am on version 0.24.2).

@federico-terzi
Copy link
Collaborator

@matclab Thanks! One thing you might try is remapping the paste shortcut used by espanso when using Kitty. See also: https://espanso.org/docs/configuration/app-specific-configurations/

Create a file in $CONFIG/config/kitty.yml with this content:

filter_class: "kitty"
paste_shortcut: "SHIFT+INSERT"
apply_patch: false

Let me know if that helps :)

@crisidev
Copy link

First of all thanks for all the help you are giving me 😀

With the snippet above the v is not pasted anymore, espanso just delete the match.

So for example if I write a', the 2 characters are just deleted.

@tissieres
Copy link

tissieres commented Mar 29, 2022

Hello @federico-terzi,
Thanks for espanso!
I suffer from the same problem. I tried to set the paste_shortcut to CTRL+SHIFT+V since it is what is configured with my kitty, but it still output only a v in my prompt. Switching backend did not help.

BTW, it was working fine with the old version (0.7x).

@federico-terzi
Copy link
Collaborator

@crisidev @tissieres Thank you guys, could you please try also adding this option? (increase the values as necessary)

pre_paste_delay: 500

If this still doesn't solve it, you might try installing the xclip utility (using your favorite package manager) and also adding this line:

x11_use_xclip_backend: true

Let me know if that helps :)

@tissieres
Copy link

Thanks for coming back to us. Nope, neither pre_paste_delay nor x11_use_xclip_backend helped in my case. I'm gonna downgrade to the 0.7x in the meantime.

@0range0range
Copy link

I have similar problem. Also tried everything above.

@oaao
Copy link

oaao commented Jul 20, 2022

solved this at least for my use case by trying all the combinations for .yml config edits suggested so far until something dinged.


my solution:

$CONFIG/
└── espanso/
    ├── user/
    │   └── kitty.yml  # MUST be in this subdirectory
    └── default.yml
# ~/.config/espanso/user/kitty.yml
filter_class: "kitty"

fast_inject: false

# backend: Clipboard            -- not necessary; actually seems more performant if omitted
# paste_shortcut: "ShiftInsert" -- no change with any accepted inputs ("CtrlShiftV", etc.)
# apply_patch: false            -- no change in any combination

the file placement + fast_inject: false was literally all i needed!


my initial conditions:

  • kitty terminal
  • my only custom espanso config was user/kitty.yml which specified only backend: Clipboard
  • default keyboard layout
  • all replacements in kitty outputting as the character v, like @tissieres & @crisidev
  • all other replacements functioning normally

@oaao
Copy link

oaao commented Jul 20, 2022

likely also relevant: backend: Clipboard could neither cause nor solve the problem on its own, but its interplay with fast_inject seems worth mentioning until i can take a proper look at espanso and kitty code in a few days:

assuming :espanso -> Hi there! is the correctly functioning replacement,

  • ❌ -> hi there1 (shift key?)
    • espanso defaults (no user/kitty.yml)
    • fast_inject: true, and no backend specification
  • ❌ -> v (ctrl+(shift+)v?)
    • both fast_inject: true and backend: Clipboard
    • (again, any combinations involving paste_shortcut + apply_patch produced no change)
  • ✔️ Hi there!
    • fast_inject: false and backend: Clipboard (replacement is highlighted, but a bit awkward/sluggish on my machine)
    • fast_inject: false, and no backend specification (no highlight, but snappier for me)

@f0rdprefect
Copy link

I get bitten by this bug right now and trying to figure out how to configure espanso correctly so I get the correct replacements.

So far I just tried fast_inject : false and backend : Clipboard with no change in behavior. This is a pitty since I just switched from alacritty to kitty due to performance reasons...

@emilBeBri
Copy link

emilBeBri commented Sep 10, 2022

same here - if I try to replace

,ae

with the Danish char

æ

it works fine in alacritty, but not in kitty. I think it's the problem of espanso, as you say. I tried using both backend clipboard and fast_inject, but it did not fix it.

when using backend: Inject, instead of the replacement becoming 'v', as other users as reported, it replaces with nothing instead.

shame, I would prefer to use kitty! But I rely on espanso too much so that will have to wait till this is figured out. Please let me know if I can help troubleshoothing! (I'm without internet the next 14 days though)

I'm on manjaro w. i3

@dudozermaks
Copy link

same thing here. tried everything above - non of that helped. i'm using kitty + manjaro i3 + espanso from AUR. espanso works everywhere except kitty :(.
I have this in my base.yml:

- trigger: ":py_temp"
    replace: |
             # !/usr/bin/python3
             # {{mydate}}
    vars:
      - name: mydate
        type: date
        params:
          format: "%d.%m.%Y"

I have this in my default.yml:

backend: Inject
fast_inject: false

with backend 'Inject', it replaces this string: "3 1/usr/bin/python3". if i choose another backend, then espanso replaces it to 'v'

@nilp0inter
Copy link

nilp0inter commented Jan 26, 2023

Hi,

I just want to report that I've tried several combinations and this is the first one that works for me:

backend: Clipboard
disable_x11_fast_inject: true
inject_delay: 15
key_delay: 10

Hope that helps.

Cheers!

@emilBeBri
Copy link

That didn't work me, what @nilp0inter did.

would love to see a solution to this...!! (that is not hacky)

@Argus-Khan
Copy link

Still having this issue, none of the solutions mentioned above work for me. Using Clipboard back-end simply expands to "v", otherwise using Inject back-end replaces some of the characters with different characters such as
: => ;
( => 9
) => 0
and etc...

Setup:
kitty 0.29.2
espanso 2.1.8
Fedora 38
i3 4.22

@fromZahir2Aleph
Copy link

It doesn't work with abbreviations function of Autokey either. Here is the reply from Kitty developer.
"Yes all these programs use all manner of unholy hacks to do what they do. I'm afraid I dont have any interest in debugging them."
kovidgoyal/kitty#6585 (reply in thread)
Alacritty it is then)

@emilBeBri
Copy link

Thanks @back2analogue for the clarification - I think kovids answer is a bit odd, since it works fine in alacritty. But I have read enough of his github comments to know that he's a gruff person and when he has set his mind on something it does not easily get unset. So that's that then. But good to know that there is no easy fix for this.

Alacritty it is then, yes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Linux Related to the Linux operating system
Projects
None yet
Development

No branches or pull requests