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

Globally unmap Alt key #82

Open
thiagoa opened this issue May 10, 2020 · 7 comments
Open

Globally unmap Alt key #82

thiagoa opened this issue May 10, 2020 · 7 comments

Comments

@thiagoa
Copy link

thiagoa commented May 10, 2020

I'm sorry for this issue because it might not relate to xkeysnail directly. Please, close it if it's not relevant.

There are a few GTK applications like Slack and Franz that really ruin my keyboard remapping experience because they capture the Alt key, which moves the focus to the menu bar (just like Firefox, but Firefox has an easy solution). This produces really annoying behavior where I trigger a shortcut with the Alt key and I'm not able to type anything else because the focus has moved to the menu bar.

I've done some research, and every issue I find in open source applications related to this problem is either stale or closed due to inactivity. I've also thought it could be related to gtk's gtk-enable-mnemonics setting, but putting this setting in settings.ini, in many places (such as /etc/gtk-3.0/settings.ini, theme folder, .config/gtk-3.0/settings.ini, etc.,) has no effect at all.

Does anyone know a workaround for this problem, or is it hardcoded behavior in each affected application?

@thiagoa
Copy link
Author

thiagoa commented May 13, 2020

I still haven't found a solution for this problem. What I've done, though, is not to use Electron for web apps. For Slack and WhatsApp, for instance, I'm running them as Chrome apps with specific WM_CLASS that I can match with xkeysnail:

# P.S.: --class will only work if you set a --user-data-dir
$ /opt/google/chrome/google-chrome --app=https://app.slack.com/client --class="Slack" --user-data-dir=/home/USER/.config/slack
$ /opt/google/chrome/google-chrome --app=https://web.whatsapp.com --class="WhatsApp" --user-data-dir=/home/USER/.config/whatsapp

One can also create .desktop files with icons to launch these applications (I've done it in gnome-shell), which makes them look really first-class.

@Lenbok
Copy link
Contributor

Lenbok commented May 21, 2020

Nice! I run slack in the browser for this reason (it's a shame the browser version doesn't support multiple workspaces like the app does), so may give this a go.

@thiagoa
Copy link
Author

thiagoa commented May 23, 2020

@Lenbok You can probably create one app for each workspace and let your window manager manage the workspaces. I only use one workspace though.

@joshgoebel
Copy link

My new fork/project resolves this https://github.com/joshgoebel/xkeysnail. Though it's still a bit early. I'd call it alpha heading towards beta very fast. It has a small test suite, but I've been coding on it initially more than using it.

What one has to do is "suspend" certain keypresses (like alt) for a small delay to see what the intention is... perhaps it's to access a menu, but perhaps it's to use a hotkey. My fork has a hard-coded 1 second suspend delay and it seems to work really well... if you complete a combo then release the keys involved Alt is never registered on the output device at all (unless it was meant to be part of the combo).

It would work far less well if you wanted to say "press and hold CMD" and wanted an immediate response - because you would be waiting a second for the key to unsuspend... but ultimately we should make the delay configurable (perhaps even per key) so I think we can have our cake and eat it too.

I suppose you might still have this issue if the combo LED with alt (I'm unsure) but if you just made it the second key of the combo I think you'd be alright?

@joshgoebel
Copy link

or is it hardcoded behavior in each affected application?

I think it is... which is why the solution seems to be just not to register the Alt (on the output) until we know the intent.

@joshgoebel
Copy link

@thiagoa If you'd want to join the new discussion on this issue at my fork (where I've been trying to fix this):

joshgoebel/keyszer#9

I'd truly like to fix this, but turns out it's a hard problem. Your feedback might be helpful. Please see issue 9 and at least read the recent update, which is a summary. Then if you have any thoughts please share.

@joshgoebel
Copy link

Ok, now (after my post) I see this is trying to solve the problem from an entirely different angle - but of course fixing Alt won't fix Super... so if you'd happen to have any thoughts on my approach - I'd still love to hear them. Of course if someone could just magically change all the software to ignroe singular Alt and Super clicks that would be another way to go about this - but I'm not sure how practical that is since the number of pieces of software is innumerable.

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

Successfully merging a pull request may close this issue.

3 participants