-
Notifications
You must be signed in to change notification settings - Fork 298
Feature/set press and hold on macOS #2331
base: master
Are you sure you want to change the base?
Conversation
main/src/main.ts
Outdated
) | ||
|
||
if (!pressAndHold) { | ||
systemPreferences.setUserDefault("ApplePressAndHoldEnabled", "boolean", "true") |
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.
Wow, super cool! Didn't know we could do this. This will alleviate a common pain point on OSX. Nice find @Akin909 💯
Wow, very cool! Didn't know about the One thing I did notice though is that it looks like your submodules are out-of-date - you might need to run |
@bryphe thanks for the heads up re the submodules |
Codecov Report
@@ Coverage Diff @@
## master #2331 +/- ##
=========================================
+ Coverage 37.34% 38.2% +0.85%
=========================================
Files 298 300 +2
Lines 12352 12518 +166
Branches 1632 1647 +15
=========================================
+ Hits 4613 4782 +169
+ Misses 7490 7481 -9
- Partials 249 255 +6
Continue to review full report at Codecov.
|
Does this setting get changed globally for How are we reading input in Oni? Is it from this file https://github.com/onivim/oni/blob/master/browser/src/Input/KeyboardInput.tsx which uses an If we attach key event handlers on window, there should be no rate-limiting on keys being held. I tried this in the Oni devtools console (on mac os) and it correctly spams keys being held down: Are we using |
@Breja the documentation regarding that tbh is a bit ambiguous I still need to test the behaviour of this locally, but from what I have seen even if it were the case that the action were global which I agree would be unexpectedly weird, there are additional methods available to restore a users setting before the window is closed. I personally would cc @bryphe re. the input handling side of things its not a part of the code base I've looked at much |
Ah ya, good question @Breja! It does seem like the behavior is different when using Originally we only used As far as I could tell, there wasn't a good way to handle these cases from just the |
And good point about the setting - we definitely shouldn't be setting it globally! We should validate that the API only sets it for our app. |
@bryphe ah interesting. I did not know that - learn something new everyday. Thanks for taking the time to answer my question. 😃 |
For completeness sake, now I've looked into it there is also For something so critical, I think this being a set makes sense, since otherwise we'd have to do it every time. |
@CrossR its cool to have it confirmed thanks for having a look 👍 , is this working for you locally personally it throws an error for me re. the third argument not being able to be converted to a boolean, couldn't find any reason to explain why ended up trawling through the code to find out why but never got to the bottom of 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.
I made the changes specified to my local install that didn't have anything set, it updated Oni fine to have the correct settings.
Should relieve a big pain point!
main/src/main.ts
Outdated
) | ||
|
||
if (!pressAndHold) { | ||
systemPreferences.setUserDefault("ApplePressAndHoldEnabled", "boolean", "true") |
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.
This should be false
not "true"
, since it needs to be a bool
and it should be setting this value to false.
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.
yeah that bit is quite confusing as the type for it from electron and the docs state the argument is a string got stuck on that for a while, seems like an issue for electron and their types for this function
main/src/main.ts
Outdated
"boolean", | ||
) | ||
|
||
if (!pressAndHold) { |
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.
This should be pressAndHold
(no !
), since if ApplePressAndHoldEnabled
is enabled, we want to disable it.
@Akin909 I originally got that error, but have added the changes I made as review comments, which then made this work. |
@CrossR thanks for checking in on this I kind of let this one fall by the wayside anyway all up to date just built it locally with no issues as well 👍 |
Great to see platform adequate handling for this! One nit: for future reference and the sake of searchability, this PR should not reference “iOS” in its title: that is the iPhone / iPad OS. The desktop OS was called, until recently, “OS X” and is now called “macOS”. Mac users are highly unlikely to search for a different OS when looking up issues for their platform. |
This PR has Changes Requested by @CrossR but it looks like they were resolved. Is this PR waiting on anything? |
I think its waiting on one of us testing it again now with the changes. I was unable to get it to work, but I'm not convinced that its the codes problem and more me deleting the old key caused this way to not work. |
@CrossR tbh the same goes for me I'm not entirely sure what a good way to test this specific functionality would be I have globally on my mac already turned |
Set a
mac
users press and hold setting to facilitate ease of use of oni for new users fixes #1888, @CrossR thanks for locating this setting 👍 this PR adds a call tomain.ts
to see if the setting is false if so it applies it.Todo