autokey / autokey

AutoKey, a desktop automation utility for Linux and X11.

Home Page:https://autokey.github.io/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Swallows" letters in Firefox browser

nkowshik opened this issue · comments

AutoKey is a Xorg application and will not function in a Wayland session. Do you use Xorg (X11) or Wayland?

Unknown

Has this issue already been reported?

  • I have searched through the existing issues.

Is this a question rather than an issue?

  • This is not a question.

What type of issue is this?

Bug

Choose one or more terms that describe this issue:

  • autokey triggers
  • autokey-gtk
  • autokey-qt
  • beta
  • bug
  • critical
  • development
  • documentation
  • enhancement
  • installation/configuration
  • phrase expansion
  • scripting
  • technical debt
  • user interface

Other terms that describe this issue if not provided above:

No response

Which Linux distribution did you use?

Linux Mint 21 Xfce

Which AutoKey GUI did you use?

GTK

Which AutoKey version did you use?

autokey-gtk 0.95.10

How did you install AutoKey?

From Mint repository

Can you briefly describe the issue?

While expanding phrases in Firefox browser (e.g., title bar to open a file with a long path or a long url frequently visited) and Thunderbird (e.g., part of a password [I dont use the TB password manager for some mail accounts]) some letters are "swallowed" or initial letter of trigger phrase not erased (expected behaviour). At times I have noticed (although I am not sure) that number of letters "swallowed" reduces if there is a time gap between typing the trigger phrase and pressing the trigger key.
I am classifying this as bug due to the following reasons:

  1. I am facing this issue only in the last couple of weeks. The same phrases used to work well earlier.
  2. There is no such problem with Chrome browser

As a workaround I am forced to use the phrase in text editor and copy/paste.

Can the issue be reproduced?

Always

What are the steps to reproduce the issue?

Create a phrase with trigger word and try it in Firefox address bar

What should have happened?

No response

What actually happened?

No response

Do you have screenshots?

No response

Can you provide the output of the AutoKey command?

No response

Anything else?

No response

commented

Whatever worked once and doesn't work now, has nothing to do with Autokey, It's Firefox. Your quickest solution is change to a script, which can also use a trigger word. It's important that when sending text, it must be enclosed by single quotes and not double. Single quotes pass on the enclosed text as is, while double quotes don't.

Also, Firefox characteristics are easily configured by their policies and user_prefs in the user.js file of the profile folder. The list of possible modifications is endless.

commented

@nkowshik There are a few critical missing details in your report:

Are you sure you're using X11, not the Wayland display manager?

Run this in a terminal to be sure:

echo $XDG_SESSION_TYPE

Are you using the Paste using CTrl+V option on your phrases (you should be unless your phrase contains macros)?

Firefox and Libreoffice have had this problem forever (probably more than a decade). It has been reported many times. Using the above pasting option usually fixes it. If it doesn't, then you have to use scripts as @ineuw suggests so you can add more delays. (We can help with coding this.)

You may want to consider ugrading to 0.96.0, our current release. It has a lot of bug fixes and a few new features. You're using a Debian-based distro, so you can use the debs we provide. Instructions are here.

This won't fix your current issue, but it will avoid a lot of others.

commented

I pasted into Firefox address bar using Autokey, but I used <ctrl>+<insert> and <shift>+<insert>, and avoided <ctrl>+c and <ctrl>+v because of it's relation to the mouse. Its significance relates to clipboard copy and paste behavior.

I copy and paste manually with <ctrl>+c and <ctrl>+v, but not in Autokey.

If you are copying and pasting in Firefox using the mouse middle button, then check about:config for the following preference settings. I modified these two days ago, after finding mouse related problems that were possibly related to yours.

If these were modified they appear bold. If you didn't make the modification, then it was Firefox. Toggle and test them.

// my Firefox mouse related settings, may not be the solution for you.

browser.tabs.opentabfor.middleclick = true 
middlemouse.contentLoadURL = true
general.autoscroll = false
general.autoscroll.prevent_to_collapse_selection_by_middle_mouse_down = false
middlemouse.openNewWindow = true
middlemouse.paste = false
middlemouse.scrollbarPosition = true

Whatever worked once and doesn't work now, has nothing to do with Autokey, It's Firefox. Your quickest solution is change to a script, which can also use a trigger word. It's important that when sending text, it must be enclosed by single quotes and not double. Single quotes pass on the enclosed text as is, while double quotes don't.

Also, Firefox characteristics are easily configured by their policies and user_prefs in the user.js file of the profile folder. The list of possible modifications is endless.

Thanks! I use paste settings = Paste Using -> Keyboard with abbreviation. I could not find any settings in Firefox that seem related to this. Anyways, I understand that the problem could be with firefox.

Whatever worked once and doesn't work now, has nothing to do with Autokey, It's Firefox. Your quickest solution is change to a script, which can also use a trigger word. It's important that when sending text, it must be enclosed by single quotes and not double. Single quotes pass on the enclosed text as is, while double quotes don't.

Also, Firefox characteristics are easily configured by their policies and user_prefs in the user.js file of the profile folder. The list of possible modifications is endless.

@nkowshik There are a few critical missing details in your report:

Are you sure you're using X11, not the Wayland display manager?

Run this in a terminal to be sure:

echo $XDG_SESSION_TYPE

Are you using the Paste using CTrl+V option on your phrases (you should be unless your phrase contains macros)?

Firefox and Libreoffice have had this problem forever (probably more than a decade). It has been reported many times. Using the above pasting option usually fixes it. If it doesn't, then you have to use scripts as @ineuw suggests so you can add more delays. (We can help with coding this.)

You may want to consider ugrading to 0.96.0, our current release. It has a lot of bug fixes and a few new features. You're using a Debian-based distro, so you can use the debs we provide. Instructions are here.

This won't fix your current issue, but it will avoid a lot of others.

Thanks! Yes, I am using X11. I use paste settings = Paste Using -> Keyboard with abbreviation. I just type out the abbreviation followed by trigger character(space/comma/tab) and expect autokey to expand. That used to happen till a couple of weeks back. Now it is broke ONLY on Firefox/TB. In fact it took quite a while for me to figure out the weird issue.
I did upgrade. But as you guessed I have the same issue.

Just an update on the subject - I tried using script instead of phrase through keyboard.send_keys. The problem remains

Did you add a delay to your script, @nkowshik? The Function to Type Text Slowly shows how to do this and is usually helpful in this type of situation.

commented

Thanks! I use paste settings = Paste Using -> Keyboard with abbreviation. I could not find any settings in Firefox that seem related to this. Anyways, I understand that the problem could be with firefox.

This is why I lobbied long and hard to get the defaullt paste setting for phrases to be Paste using Ctrl+V (implemented in 0.96.0). We had countless reports like this.

IDK exactly what's going on, but I guess that a paste of the whole string at once is processed as one event for most applications whereas key presses from typing are each separate events and can overload a receiving application that was designed to handle typing at much slower human speeds.

commented

I suggest that you change the trigger key from space, as a test. Although, it is an acceptable character in browsers, but may not be in your context.

Then,

  1. Anonymize and post the script.
  2. Post the text of the troubleshooting info from firefox about:support page.

230705_troubleshooting-info

commented

Just an update on the subject - I tried using script instead of phrase through keyboard.send_keys. The problem remains

The problem results from using keyboard typing events rather than pasting the whole thing as one string. You should always paste the whole string rather than typing it unless you need to send active keys (that move the cursor, etc. immediately) to an application. This avoids other problems as well. E.g. Unicode charcters paste fine, but cannot be typed directly with the keyboard API without special encoding. That's another topic.

As @Elliria notes, the potential fix isn't just using a script instead of a phrase. It's that you can add time.sleep(.1) statements in various places to give things time to complete before proceeding to the next step.

This applies to the receiving application, but also applies within AutoKey itself.

The keyboard and clipboard API calls use asynchronous methods which return with success instantly even though their work is being done in other independent threads that are still running. Small delays give them time to complete.

My type_slow() function should only be used as a last resort when nothing else works.

@ineuw , @Elliria , @kjs3 @josephj11 Thanks a ton for all the inputs/suggestions.
Ctrl+v is working fine. Thanks @josephj11. I had always used keyboard and never tried Ctrl+v. I am yet to check whether Ctrl+v works in password inputs.
@Elliria - Yes, I did insert a time.sleep statement to no avail.
@ineuw - I tried all options of trigger character without any success.

Having said that, I still feel there is something more amiss, since it works on Chrome with keyboard. In retrospect (after seeing that Ctrl+v works) I think the problem could be with Firefox's typeahead/spell check features interfering.
Once again thank you all!
Nitin

Either way, it's not an AutoKey issue so much as a Firefox issue. I'm glad to see it's working for you now, though.

commented

@nkowshik Please close this issue if you feel it is resolved.

Thanks @Elliria, @josephj11 . I am closing the issue as resolved.