AHK_X11 icon indicating copy to clipboard operation
AHK_X11 copied to clipboard

Superkey shortcuts will send the letter into focused window

Open dmnmsc opened this issue 2 years ago • 8 comments

Hi,

I'm using gnome desktop and I have a problem with keyboard shortcuts. Take this script as example:

#t::
IfWinExist, Telegram
	{
	WinActivate
	}
else
	{
	Run, telegram-desktop
	WinActivate
	}
return

This will send and type the letter t into the focused window. Desired scenario: no letter t appearing in focused window. This seems to happen when you are using just super as a key.

dmnmsc avatar Mar 17 '23 11:03 dmnmsc

Hi!

I cannot reproduce this. Just to make sure I understand correctly: Telegram launches/activates properly, but it also does not prevent the t from being typed into the currently active window?

So even a basic script like

#t::Return

does not prevent the t from being sent with win+t?

Is this behavior affected by the caps lock key?

Are you using version 0.5.1?

phil294 avatar Mar 17 '23 14:03 phil294

Hey!

That's it. Telegram launches/activates properly, but it also does not prevent the t from being typed into the currently active window. Even your basic script will type the letter t into the currently active window.

Grabación de pantalla desde 2023-03-17 18-33-39.webm

Is this behavior affected by the caps lock key? Yes it is.

Are you using version 0.5.1? Yes! Downloaded the new version yesterday.

dmnmsc avatar Mar 17 '23 17:03 dmnmsc

can you please run the #t::Return script in console and see if it outputs (besides other stuff) a message like

BadAccess (attempt to access private resource denied) (You can probably ignore this error)

?

phil294 avatar Mar 18 '23 05:03 phil294

can you please run the #t::Return script in console and see if it outputs (besides other stuff) a message like

Gtk-WARNING **: 12:40:39.045: Locale not supported by C library.
	Using the fallback 'C' locale.
Gtk-Message: 12:40:39.143: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:40:39.145: Failed to load module "canberra-gtk-module"
Interactive AHK_X11 console (REPL). Type any command. Multi-line text not supported. Press {CTRL}+C to exit.
ahk_x11>    

Sorry, I don't know why I just got the "BadAccess (attempt to access private resource denied) (You can probably ignore this error)" output once .I had two scripts with the same shortcut. But I'm unable to replicate again.

I renamed the new version to ahk_x11, btw. But as I said I'm using 0.5.1.

dmnmsc avatar Mar 18 '23 11:03 dmnmsc

Switching to right super key in keyboard tweaks settings solves the issue.

image

But then super key won't open activities/menu - so you need to install ksuperkey and set activities shortcut to ALT+F1.

It's and odd workaround. Maybe helps you to track the issue.

dmnmsc avatar Mar 18 '23 14:03 dmnmsc

ok, thanks, I'm out of ideas for now, might quickly test it in a VM. The weird BadAccess error only shows when the super+t hotkey was already "grabbed" by another application such as the desktop environment's global hotkeys. And if that other program somehow sends the k key artificially, it cannot be prevented. Unlikely though. That's also the reason why you saw it when you ran the script twice: First one grabbed the key combo, the second one could not. But usually it really doesn't matter.

In other words: IDK, but I'll check later

phil294 avatar Mar 18 '23 15:03 phil294

Don't worry. I can live with it thanks to the workaround. You are doing a great job.

Just waiting the InputBox implementation to use my most desired scripts!

dmnmsc avatar Mar 18 '23 15:03 dmnmsc

hi @dmnmsc, I have installed Ubuntu+Gnome in a VM but couldn't reproduce this. My bet is still that some other application has reserved the T key for you but I don't really know what's going on here. Perhaps my installation wasn't complete yet, but for now it looks like this is a wontfix because cannot reproduce.

Just waiting the InputBox implementation to use my most desired scripts!

InputBox is now available!

phil294 avatar Jul 20 '23 13:07 phil294