Comments (32)
It's an issue with Chromium, on which Atom is based. You can track it here. This is not to say that we can't find some workaround, but I just haven't been able to dedicate time to it yet. We need a way of detecting that Dvorak-Qwerty is enabled at the system level, then employ a hard-coded translation in the keymap if it is.
from atom-keymap.
Thanks Nathan – I'll keep an eye on the Chromium developments.
from atom-keymap.
I also have the same issue — I type in "Dvorak Qwerty" mode. It make Atom pretty unusable, as much as I like it.
@nathansobo It doesn't look like Chromium's issue you linked to is going to being resolved any time soon. Could we try a workaround? Maybe you don't need to detect the user's keyboard layout — just add a checkbox setting under Keybindings that translates all of the shortcuts where necessary. Dvorak Qwerty mode users can go to Keybindings and check the box. Not ideal, since Dvorak Qwerty users would have to find that setting, but it would make the app usable.
from atom-keymap.
I like this idea. Would you be interested in submitting a PR on the atom/atom-keymap repo with tests that adds it? I'm thinking it would be good to allow some kind of translation table to be assigned on the keymap. Maybe something like:
atom.keymap.translateKeystrokes
`cmd ctrl alt`:
`o`: `s`
# ...
Then we could use that from Atom. Just throwing things off the top of my head. We can definitely discuss other approaches. If you don't have time, that's totally cool, but it will be a while before I can add this because I'm focused on performance. I will get to it eventually though.
from atom-keymap.
That's a nice approach. Plus, it might allow Atom to support Dvorak-Qwerty on operating systems that only have the Dvorak layout natively (Windows + Linux), or even let Colemak typists (if they exist?) make their own translation table.
UPDATE:
Found something interesting. This is (part of) the keydown event that gets fired when I press the physical Cmd+C keys (which ideally would execute a copy on both Dvorak-Qwerty and Qwerty).
// KeyboardEvent
{
"keyCode": 67, // C
"keyIdentifier": "U+004A", // 74 = J
"metaKey": true,
"type": "keydown",
"which": 67
}
... which means that the keyCode
and which
properties are correctly converted to Qwerty, but the keyIdentifier is not. So this might be as simple as using the event.which
instead.
from atom-keymap.
Got it: https://github.com/donmccurdy/atom-keymap/commit/7c13fd07f29e10f14648e532279fe855f034a08f
Will spend a day or two testing this before I try a pull request, but it looks like everything is good on both Qwerty and Dvorak-Qwerty layouts. ..What I don't know, of course, is whether this does anything strange to Linux or Windows.. Based on the comments under charCodeFromHexCharCode(hexCharCode)
, it sounds like that could be an issue.
from atom-keymap.
Thanks for the merge! : )
from atom-keymap.
Suppose I might as well reopen this; haven't had the chance to look into the more detached solution we discussed (#22) but would like to do that eventually.
from atom-keymap.
It's alive! It would be great to have a volunteer to investigate what can be done at the Chromium level.
from atom-keymap.
I'm guessing that any really nice fix is going to require a good implementation of the event.key
spec from Chromium, the Dvorak-Qwerty issue seems very similar to the problem in foreign keyboard layouts, #37.
I took another look at this yesterday and put together a translation table. My approach is:
- If the user is on OSX and has any of the target modifier keys pressed (ctrl/alt/cmd), use
keyCode
to predict what DvorakcharCode
would be expected if the Chromium bug persists. - If
keyCode
/charCode
seem to be in sync, as you'd expect on any keyboard layout that doesn't dynamically remap with modifier keys, then nothing happens. - If they are mismatched, and that mismatch looks like a Dvorak/Qwerty relationship, then
keyCode
is used to generate a newcharCode
, and the event propagation goes on.
I've tested Qwerty, plain Dvorak, and Dvorak-Qwerty, and the keybindings seem to be working consistently (and not affecting the first two). There is some risk that an international keyboard layout might have mismatched keyCode
/ charCode
values as well, and if any of those differences happen to be the same as Dvorak-to-Qwerty, they'll get weird results from that key. No idea how to test that possibility. :|
Any translation table-based fix is probably going to look more or less like this, but I'm curious about your thoughts on where to put it. On one hand, it wouldn't seem to difficult to put something in the keymap API along the lines of a registerKeyEventTranslator()
function. But I don't love the idea of asking users to hunt down a plugin to fix a bug, either. On the other hand, if this were a standalone "Dvorak-Qwerty" plugin then maybe a feature could be added to remap shortcuts from Dvorak to Dvorak-Qwerty for Windows/Linux users, since they don't have a native layout that does the same thing.
from atom-keymap.
@donmccurdy We would only want to employ this mapping if Dvorak-Qwerty were enabled, right? Maybe we could start by adding a flag to the KeymapManager
that could be used to explicitly enable it, then enable it via a config option in Atom. A next step would be to use OS X APIs to detect the Dvorak-Qwerty mapping being enabled and automatically assign the flag. Thanks for staying on this. What are your thoughts?
from atom-keymap.
The mapping won't affect anything on a Qwerty keyboard (it only kicks in if the keyCode and keyIdentifier don't correspond), but all bets are off on international layouts. A config option might be a good way to go. If we could read from ~/Library/Preferences/ then we could detected the keyboard layout. Would Chromium support that?
A config option wouldn't have to be specific to Dvorak-Qwerty, if we made it a flag to look at keyCode instead of keyIdentifier when a modifier key is down. Kind of a long-shot but that might solve some things for international keyboards if they want shortcuts mapped to physical locations on the keyboard rather than character values.
from atom-keymap.
Here's a simpler fix, using a config option and without a Dvorak-Qwerty table:
https://github.com/donmccurdy/atom-keymap/commit/1cfd6109c3726360546687a0def117f08f7a1c34
This covers all case-insensitive shortcuts, but to have things like shift-$
work for the Vim plugin we would need to map the keyCode with WindowsAndLinuxCharCodeTranslations
, even on OSX. A more specific name for the option might be "Bind events to physical key location".
from atom-keymap.
@donmccurdy Hello. Can you explain how to install your fix in my Atom (OSX, Mavericks)? Should I build project by grunt and them put builded files somewhere?
from atom-keymap.
You'll need to build Atom from source, and then link to my fork of the keymap repository. There are instructions here:
https://atom.io/docs/v0.127.0/advanced/node-modules
You'll need to clone [email protected]:donmccurdy/atom-keymap.git
instead of the official keymap repo, and then check out the "patch.dvorak.v3" branch.
Once you've built Atom, the patch will add a checkbox in the settings for the Keymap module, and with that enabled your Dvorak shortcuts should work.
P.S. @nathansobo The linked instructions work for the initial build, but the way they describe updating the build after you modify the keymap isn't really working for me, I'm re-running "script/build" every time. Did something change?
from atom-keymap.
Thank you for fast respond.
from atom-keymap.
https://gist.github.com/cidevant/a7ab047c2c16174d1eb1
I can't find a Keymap module settings? Where is it? I see only: Settings, Keybindings, Packages, Themes in Settings viewer (CMD-,).
Update
I finally got it after reviewing your last commit! Keymap module settings
phrase was not absolutely clear for me. For others: just navigate Atom
-> Open your config
and add this line to the end of file:
'atom-keymap':
'bindEventsToKeycode': true
from atom-keymap.
Oh, nice! That actually isn't the way I'd meant, I was filtering packages by "keymap" and then clicking a checkbox there, but perhaps the keymap package wasn't showing up for some reason. Is the option working for you?
from atom-keymap.
No, I don`t see keymap package. When I filtering by "key" the only result I get is "Keybinding Resolver" package (I don't remember, if I manually installed it or it already was in default bundle of packages for Atom.io)
from atom-keymap.
I also am not seeing the the keymap package after following these instructions:
https://gist.github.com/cidevant/a7ab047c2c16174d1eb1
from atom-keymap.
If those instructions work then that's fine as a quick fix, but I suspect you'll need to rebuild Atom from source rather than just running commands inside the /Applications folder to get that option to show up. That would involve cloning the main https://github.com/atom/atom repository, doing the npm link
step, and then running script/build
. (At least until a fix is merged to master).
from atom-keymap.
There's a way to enable the dvorak support by hand? I'm using a custom Dvorak layout and doesn't works.
from atom-keymap.
You can try tossing this in your init script and see what happens.
atom.keymaps.dvorakQwertyWorkaroundEnabled = true
from atom-keymap.
@nathansobo I've tried, doesn't works
from atom-keymap.
Could anyone help me here?
@nathansobo There's a possibility to made a patch to allow enable the dvorak support by hand? I've been reading the code, so I tried to create a custom keyboard layout with the same layout ID that Atom verifies, but without success.
from atom-keymap.
Thanks so much for implementing this. Dropping the following to the init script now works:
atom.keymaps.dvorakQwertyWorkaroundEnabled = true
Also applicable to dvorak based custom layouts such as Programming Dvorak
from atom-keymap.
Thanks so much for this. Just made my life with atom on a Dvorak layout so much less frustrating
from atom-keymap.
I don't know why but I can't use my custom DVORAK-QWERTY with Atom anymore.
from atom-keymap.
I'm having the issue as well
from atom-keymap.
It seems the workaround for custom layouts has been removed:
#90 (comment)
from atom-keymap.
@Ben3eeE this is the original issue, do you want me do add details on how to reproduce it here or should I create a new issue?
from atom-keymap.
Hey!
I think it's better to open a new issue.
from atom-keymap.
Related Issues (20)
- Partial key mapping can get wrongly resolved HOT 1
- Some keybindings do not work using Greek keyboard on Linux HOT 17
- Uncaught TypeError: Cannot read property 'unmodified' of undefined (possible Mode_switch issue) HOT 2
- Polish letters - not work HOT 1
- Cmd+backslash isn't working yet in JIS keyboard on Mac. HOT 5
- Won't install on Windows HOT 5
- [windows] AltGr-characters collide with Ctrl+Alt hotkeys HOT 3
- On Linux, keymap does not work with Chinese input source enabled
- Question: Allowing simple keymaps to bubble up to native event as well. HOT 7
- Caps lock interferes with keybindings
- Keymap: Missing key binding for rendering Python graph with matplotlib in Atom HOT 1
- Don't use KeyboardEvent.code when resolving user keystrokes HOT 6
- Slovak QWERTZ does not resolve keys correctly on macOS HOT 16
- Support DVORAK-QWERTY custom keyboards in macOS HOT 2
- Numeric keypad bindings no longer work HOT 7
- `npm install` reports numerous warnings
- Multiple modifiers are not recognized correctly with non-latin characters due to uppercase checking HOT 8
- it keymap error HOT 2
- Multiple command actions in key map
- Atom confused by non-default keyboard layout and hijacks system keybinding
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-keymap.