-
Notifications
You must be signed in to change notification settings - Fork 112
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
Release mapped modifiers after the original is released. Closes #70. #71
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d79a3bc
Added release mapped modifiers only when original modifier has been r…
rbreaves 567cfe0
Added an exception for Shift to not undo mapped or the original modif…
rbreaves 7ac29be
Updated release modifier fix to iterate and set var
rbreaves e495db8
Updated release modifier fix to support no new modifier remaps
rbreaves 6cf21fe
Updated release modifier fix to unset mode_maps properly
rbreaves 5cd22ed
Removed debug print statement
rbreaves File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm.. I am not really seeing or getting that error, but I will admit.. it seems like I should probably be having to define "modifier" within a loop, which I am not doing. Perhaps it only runs because of the prior for loop above it?
Is there a switch/argument I can run to get more debug like output when running it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though I am not sure how to generate the debug output you showed I went ahead and set it to iterate through the possible modifier keys. I am not 100% certain it covers all use cases though, nor previously to be honest. It does appear to work fine with my use cases though.
There is one minor issue with using the pass_through_key. If I hit f3 and then try to use another mapped key then that mapped key fails initially until I hit it a second time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug output I posted was just the exception that was spat out to the terminal that I started xkeysnail in. You can add print statements etc to help with debugging.
I just added in your most recent commit, and this patch seems broken. My bindings to allow C-v and M-v in Firefox for page down / page up no longer work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Admittedly, the branch I'm testing this on contains other patches I've been using for a while, so there could be other interactions. https://github.com/Lenbok/xkeysnail/tree/tmp-test-mod-release )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, with your latest commit the single key mappings are fixed.
It's still broken. E.g. I have added tmux-ish style bindings to firefox like this:
When I press grave followed by
c
, to create a new tab, the underlyingC-t
is issued but the control modifier is stuck down. (i.e. subsequently pressings
opens the save dialog). Is the problem that none of the input keys actually involved the modifier being issued?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've actually been wondering about nested scenarios, but I also haven't really tested any non-modifier key scenarios either I don't think. I will have to look into this more later. It's getting late for me.
I've been testing with this set of hotkeys.
https://github.com/rbreaves/kinto/blob/dev/xkeysnail/kinto.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Lenbok I updated my patch to include mode_maps or multiple stroke keybinds rather. I tested it against your keybindings and everything appeared to work except for Grave - p. I am not sure why, but even with xkeysnail not running I couldn't get C-Shift-Tab to work right off any ways, only after C-Tab starts the tab switching process.. so I dunno what was up with that. I guess adding C-Tab to the start of it might have fixed it for me, but I did not test that out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be a better way to handle setting when to mind multiple stroke keybinds, but I am basically just checking if _mode_map is anything but None, it is set when a multi stroke keybind is in play and if it is then I know to set a global boolean to remind the on_key function that it should manually release any mods set on the next go around.
Normally output.py would handle the release of mods that had been set, but I removed that bit of code completely as it interferes with proper remaps that would otherwise align properly with the length of the original modifier key being held.
Stuck mod keybinds are a risk I suppose with this change, but I think it is worth figuring out given the ability to remap keys like Alt and Ctrl-Tab can benefit due to the nature of how those keys work. Another alternative might be to create a similar but different K like function, maybe HK( ), to denote that keys being mapped via this function will attempt to Hold modifier keys until the original modifiers are released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now running my patch on a chromebook and have 1 or 2 other users using it as part of my Kinto (mac keybinding) app. It is part of my Alpha branch over there, after a few more days of testing and if I work out my wordwise support for browsers I'll merge into Kinto's dev branch. At least that is my plan.
@Lenbok If you still have any issues please let me know.
Initially I was going to work on a separate branch and integrate caret input detection directly into xkeysnail, but it is such a niche feature I really can't see the benefit of having it in xkeysnail directly. It would probably just introduce bugs and I still can't get IBus to work fully under Arch w/ Gnome, so there is that too.
I do have another ticket open for config py file update detection, which would also be beneficial. For now I am handling that via inotify-tools in bash as I don't think it can be implemented the same way that hotplug (watch) command is and would require another library to allow for a non-blocking while loop, I think. I tried already but it didn't go anywhere and I am not wanting to add a new library just for that.