bikkelbroeders / TouchBarDemoApp

Allows you to use your macOS Touch Bar from an iPad (through USB connection) or on-screen by pressing the Fn-key.
MIT License
1.65k stars 120 forks source link

[Feature/Bug] Allow Different Shortcuts/Fix Special Key activation #62

Closed ApplePerson closed 7 years ago

ApplePerson commented 7 years ago

Current version allows the user to toggle the Touch Bar using a single "special" key. When using the selected special key, the App will ignore the press if a different key is pressed in combination, it will not ignore the press of the special key when you either click or use an actual function key (e.g. F12), this causes the Touch Bar to appear at inconvenient times. Either this should be fixed or a more advanced preferences window should take care of the user being able to set a custom key combination to make the Touch Bar disappear so that the user doesn't have to sacrifice one of it's special keys.

robbertkl commented 7 years ago

We've already committed some fixes for this:

To get these changes, please download and build the latest source code. Alternatively, you can wait for the next release (v1.6) which will include these fixes.

sonvirgo commented 7 years ago

I downloaded the latest source and build it but it not work? [removed link to possible unsafe Debug.zip]

robbertkl commented 7 years ago

@sonvirgo What does not work? Please give us some more information.

sonvirgo commented 7 years ago

Hot key activation not work for any key

robbertkl commented 7 years ago

What key did you set it to and is not working? Please clarify as much as possible, so we can take a look.

sonvirgo commented 7 years ago

Have you tried my attached build in the debug.zip file?

robbertkl commented 7 years ago

No, for security reasons it's a very bad idea to run compiled code from strangers. If you tell me which commit you're on, I can build it myself.

sonvirgo commented 7 years ago

'To get these changes, please download and build the latest source code. Alternatively, you can wait for the next release (v1.6) which will include these fixes.' commit 5268ec5a6700dca2243368d718d96702904bbada

robbertkl commented 7 years ago

That commit works fine for me, but I don't know what to look for, since you still haven't explained what exactly doesn't work for you, and with what settings.

sonvirgo commented 7 years ago

I build it just with downloaded setting, I try all short cut key Fn, Ctl, Alt, Option, none work

gitguys commented 7 years ago

No hot keys working for me either. Tried them all and nothing happens. I'm just not able to use your app because of this issue. I'm using Sierra 10.12.1 (16B2657) on an early 2011 MacBook Pro 17" if that helps.

I just tried the Touché 1.0.1 app (https://red-sweater.com/touche/) and it works great (with keyboard shortcut: control-option-command-spacebar) or just by clicking the Touché app itself in my Dock to toggle it, but I'd prefer to use your app.

Come to think of it, shouldn't it turn on just by using the checkmark here too? Because that's not working, either.

example

UPDATE -- It works now, I just had to log out of my computer and log back in again. Hopefully if anyone else runs into this issue, they'll see my post.

sonvirgo commented 7 years ago

Why logout and log back on should work? It doesn't work for me though. For the pre-built release, I have to run a script to activate Touch bar because I use PC keyboard without Apple compatible Fn key Update I confirm that V1.6 pre-built or source download doesn't work for me. Only from V1.5 downward

robbertkl commented 7 years ago

@sonvirgo Could you try v1.5 again if it's still working, or if that one also stopped working now?

robbertkl commented 7 years ago

@sonvirgo Can you check one more thing for us? If you open the Keyboard Viewer app (see here for how to do that), do you see the key being highlighted when you press the A key on your physical keyboard? And how about if you press the shift key on your physical keyboard?

sonvirgo commented 7 years ago

@robbertkl V1.3 upto V1.5 work The A key and shift work well with my PC keyboard This is the screen capture https://drive.google.com/file/d/0B1KNH_A4Fos6eDRNUXBHMllMOGc/view?usp=sharing

robbertkl commented 7 years ago

OK, that confirms that these are actually 2 separate issues. I just had the issue myself, but with me the keyboard viewer key highlighting was broken as well, at least for regular keys. Also none of the older versions were working anymore. This means there was an issue with the machine state and not so much with the recent code changes. I could not figure out what the cause was for this issue, but a logout+login fixed this. This must have been the same issue @gitguys had.

As for the issue @sonvirgo has, it's obviously different. It does relate to a code change somewhere between the v1.5 and v1.6 tag. Logout+login won't help. Since I can't reproduce the issue, it will make it hard to debug.

@sonvirgo, can you try the following:

git clone git@github.com:bikkelbroeders/TouchBarDemoApp.git
cd TouchBarDemoApp
git bisect start v1.6 v1.5

Then do this iteratively:

open TouchBar.xcodeproj
# run the TouchBarServer target and see if it works
# quit Xcode again
# run this if it DID NOT work:
git bisect bad
# or this if it DID work:
git bisect good
# repeat the above

Repeat these steps until you get output like this:

XXXXXXXXXXXXXXXXXXXXXXXX is the first bad commit

After this, you can return your local git repo to normal, by typing:

git bisect reset

Send us the ID of the first bad commit and we have a clue where to look at. Thanks!

sonvirgo commented 7 years ago

I can not clone the git

Cloning into 'TouchBarDemoApp'... Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

robbertkl commented 7 years ago

OK, please try this git clone instead:

git clone https://github.com/bikkelbroeders/TouchBarDemoApp.git
sonvirgo commented 7 years ago

Found a working commit but I make a mistake, I enter 'git bisect bad' twice. Can I do it from the beginning? suns-MacBook-Pro:Downloads sun$ cd TouchBarDemoApp suns-MacBook-Pro:TouchBarDemoApp sun$ git bisect start v1.6 v1.5 Bisecting: 9 revisions left to test after this (roughly 3 steps) [74364d4a67200c7ff9fa956cac92e410bfb77646] Move key up fallback to GlobalEventApplication suns-MacBook-Pro:TouchBarDemoApp sun$ open TouchBar.xcodeproj suns-MacBook-Pro:TouchBarDemoApp sun$ git bisect bad Bisecting: 4 revisions left to test after this (roughly 2 steps) [960306b70eae19f704792717e6ed17a296072094] Mouse events cancel modifier keypresses suns-MacBook-Pro:TouchBarDemoApp sun$ git bisect bad Bisecting: 1 revision left to test after this (roughly 1 step) [96c36475e9ff96d58e0d1251d7c956ae08ecfec8] Show release summary suns-MacBook-Pro:TouchBarDemoApp sun$ open TouchBar.xcodeproj suns-MacBook-Pro:TouchBarDemoApp sun$ git bisect good Bisecting: 0 revisions left to test after this (roughly 0 steps) [fd31cc181c66228a6b4a38db7393aa5c99f0032d] Extract modifier key handling to ModifierKeyController suns-MacBook-Pro:TouchBarDemoApp sun$

Update ok I will do it again after git bisect reset

robbertkl commented 7 years ago

You can do git bisect reset and then start over with the bisect start command.

Also, if you've found a working version, type git bisect good and keep testing other versions until git says XXXXXXXXXXXXXXXXXXXXXXXX is the first bad commit.

sonvirgo commented 7 years ago

Ok

sonvirgo commented 7 years ago

@robbertkl Here is the result

24a6eccb61e3d20387f703850a2a8114a32ed280 is the first bad commit commit 24a6eccb61e3d20387f703850a2a8114a32ed280 Author: Robbert Klarenbeek robbertkl@renbeek.nl Date: Thu Nov 17 02:26:29 2016 +0100

Add max duration for modifier keypresses

:040000 040000 abb886e4778a5a2977b79305038ef5465abfaa8e 87efe554c5aff0941af9eea609f86d5a04104c2b M TouchBarServer

robbertkl commented 7 years ago

Great work, thanks. Can you try pressing the modifier key you've set real quick? So don't hold the key down but press the key down and let it go as quickly as possible. If that works, we know that's the problem.

sonvirgo commented 7 years ago

Oh it works. I suspect setting stick key cause that

robbertkl commented 7 years ago

Ahhhh, that explains it!

sonvirgo commented 7 years ago

It really need sticker key to lockup special key

sonvirgo commented 7 years ago

Can you make it V 1.6 to work with sticker key.

robbertkl commented 7 years ago

You can change this line in your code to 100 instead of 0.3 to make it work for sticky keys.

sonvirgo commented 7 years ago

Thank you. I see.

sonvirgo commented 7 years ago

Solved. I confirm set timer to 100 re-enable sticky key for V 1.6