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

macro(compose a ") and qt qcompleter #288

Closed
ville-h opened this issue Aug 16, 2022 · 21 comments
Closed

macro(compose a ") and qt qcompleter #288

ville-h opened this issue Aug 16, 2022 · 21 comments

Comments

@ville-h
Copy link

ville-h commented Aug 16, 2022

I've setup a = macro(compose a ") in /etc/keyd/default.conf and it mostly works as expected. However when used with a qt application which has a qcompleter active, that is it's showing a popup below a text input for example, the macro no longer works. Instead of inserting ä the individual characters a, " are inserted. I am guessing qt captures the keyboard when it shows the popup or some such.

@herrsimon
Copy link
Contributor

I'm writing in German daily and never had this issue, maybe because I'm using the slightly different macro macro(compose " a), and similar for the other umlauts. Could you please give examples of applications in which you experience the problem?

@ville-h
Copy link
Author

ville-h commented Aug 16, 2022

I tried with macro(compose " a) and the results are similar: ", a rather than a, ". The particular application is not publicly available, but I suppose I could whip up a dummy qt application that has just a text input with a completer.

@herrsimon
Copy link
Contributor

You could try using a = ä as this uses a different input method.

@ville-h
Copy link
Author

ville-h commented Aug 16, 2022

with a = ä input now fails in all applications and results in the string: 00100

@herrsimon
Copy link
Contributor

Oh, that sounds like a bug. I'm just an intensive user and unfortunately don't have any further recommendations (other than ugly workarounds like inserting modifier key presses into your original macro in order to dismiss the qt popup), but @rvaiya can surely help you. It might probably be helpful if you post your display server (X or wayland) and desktop environment if any.

@rvaiya
Copy link
Owner

rvaiya commented Aug 16, 2022

with a = ä input now fails in all applications and results in the string: 00100

For this to work you will need to symlink the keyd XCompose file. See the section on unicode support in the man page.

e setup a = macro(compose a ") in /etc/keyd/default.conf and it mostly works as expected. However when used with a qt application which has a qcompleter active,

This is likely a buffering issue in qt's input logic. You can try setting macro_sequence_timeout in [global] to remedy this.

E.G

[global]
macro_sequence_timeout = 1

The value is in microseconds and should probably be between 1 and 4000. If this works, I would appreciate if you could report the lowest value you used.

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

The value is in microseconds and should probably be between 1 and 4000. If this works, I would appreciate if you could report the lowest value you used.

I tried this with values up to macro_sequence_timeout = 256000, but couldn't observe a difference in behaviour.

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

For this to work you will need to symlink the keyd XCompose file. See the section on unicode support in the man page.

I tried this with /home/ville/.XCompose -> /usr/share/keyd/keyd.compose and ä now works in other programs, but the qt application still shows the string 00100.

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

A publicly available qt application demonstrating the issue would be kdevelop in its Project > Open / Import project... dialog for example. However qtcreator works correctly in its File > Open File or Project... dialog.

It's possible the difference could be that kdevelop uses qt5 and qtcreator uses qt6. The original application is a qt5 application as well.

@rvaiya
Copy link
Owner

rvaiya commented Aug 17, 2022

I tried this with values up to macro_sequence_timeout = 256000, but couldn't observe a difference in behaviour.

Does this work when you manually enter the sequence compose a "? If so, please post the output of sudo keyd -m while executing the compose sequence manually as well as the output using the bound macro sequence.

but the qt application still shows the string 00100.

Did you restart he application?

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

What does it mean to "manually enter the sequence compose a ""? Yes I did restart the application. I reboot the machine on every change. If I just sudo systemctl restart keyd I seem to have some issues with the macro-compose keys in general.

@rvaiya
Copy link
Owner

rvaiya commented Aug 17, 2022

What does it mean to "manually enter the sequence compose a ""?

It just means to enter the sequence you are trying to assign to a macro. Does the sequence <compose> <a> <"> actually produce ä on your system? If not, then it is not a keyd issue.

Note that by default the X server won't do anything with the compose keycode. You have to manually assign it using setxkbmap and friends. I'm assuming you've already done this.

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

what is <compose>?

@rvaiya
Copy link
Owner

rvaiya commented Aug 17, 2022

what is ?

The compose key (the thing you are trying to bind with a = macro(compose a "). Most keyboards don't actually have a compose key.

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

ok by <compose> you presumably mean whatever was used in setxkbmap -option compose:menu, so in this example the menu key? I don't think I've a menu key on this thinkpad keyboard so I can't press it physically.

@rvaiya
Copy link
Owner

rvaiya commented Aug 17, 2022

Yes. You can temporarily assign one using keyd (e.g capslock = compose). At which point pressing <capslock> <a> <"> should produce ä. If pressing that sequence manually still doesn't work, it is likely a bug in your application.

compose in keyd is actually what X calls the menu key and corresponds to what keyboards which have a physical compose key emit.

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

Still fails the same way when using capslock = compose and entering the compose a " sequence individually with the keyboard.

The sudo keyd -m output for triggering macro-compose:

keyd virtual device	0fac:0ade	compose down
keyd virtual device	0fac:0ade	compose up
keyd virtual device	0fac:0ade	a down
keyd virtual device	0fac:0ade	a up
keyd virtual device	0fac:0ade	leftshift down
keyd virtual device	0fac:0ade	' down
keyd virtual device	0fac:0ade	' up
keyd virtual device	0fac:0ade	leftshift up

The sudo keyd -m output for triggering compose a ":

keyd virtual device	0fac:0ade	compose down
keyd virtual device	0fac:0ade	compose up
keyd virtual device	0fac:0ade	a down
keyd virtual device	0fac:0ade	a up
keyd virtual device	0fac:0ade	leftshift down
keyd virtual device	0fac:0ade	' down
keyd virtual device	0fac:0ade	' up
keyd virtual device	0fac:0ade	leftshift up

Did you try to replicate with kdevelop if you're able to see the behaviour?

@herrsimon
Copy link
Contributor

You didn't answer whether you get ä when typing in a non-qt application, such as a terminal. I think this is the most important question to answer before investigating further.

@ville-h
Copy link
Author

ville-h commented Aug 17, 2022

You didn't answer whether you get ä when typing in a non-qt application

Thought I did in the very first post by specifically saying problem happens in qt application with completer popup active. So yes it works in non-qt programs and even in qt programs. The failure happens in qt programs with completer popup active. And seemingly limited to qt5 programs, but I've only tested 2 of them. Works in 1 qt6 program I tested.

@herrsimon
Copy link
Contributor

You didn't answer whether you get ä when typing in a non-qt application

Thought I did in the very first post

You are right, sorry for my insistence.

I just checked the emitted keycodes again using xev and everything is exactly as it should be. Keyd replicates exactly what a human on a physical keyboard would do to enter the compose sequence, especially when you set the macro timeout (like you already tried without the problem disappearing). Also, the problem apparently only occurs on qt5 with completer popup. All these facts are strong indicators that there is a problem with qt5 completer's input handling, so I would file a bug there.

@rvaiya
Copy link
Owner

rvaiya commented Aug 17, 2022

It doesn't look like anything can be done from keyd's side. Googling around suggests QT compose handling is at least partially broken. You might want to try experimenting with a different compose key (e.g setxkbmap -option compose:ralt) given that it seems to be menu related.

I'm closing this for now.

@rvaiya rvaiya closed this as completed Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants