bikkelbroeders/TouchBarDemoApp

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

Closed this issue · 30 comments

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.

We've already committed some fixes for this:

  • there is now a timeout on the trigger key, so that it only toggles the Touch Bar if you're quickly pressing the key, not holding it.
  • a toggle is now also cancelled by mouse clicks; that means that if you set the toggle key to command and the cmd+click on something, it won't toggle the Touch Bar

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.

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

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

Hot key activation not work for any key

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

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

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.

'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 5268ec5

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.

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

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.

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

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

@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?

@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

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!

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.

OK, please try this git clone instead:

git clone https://github.com/bikkelbroeders/TouchBarDemoApp.git

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)
[74364d4] 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)
[960306b] Mouse events cancel modifier keypresses
suns-MacBook-Pro:TouchBarDemoApp sun$ git bisect bad
Bisecting: 1 revision left to test after this (roughly 1 step)
[96c3647] 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)
[fd31cc1] Extract modifier key handling to ModifierKeyController
suns-MacBook-Pro:TouchBarDemoApp sun$

Update
ok I will do it again after git bisect reset

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.

Ok

@robbertkl
Here is the result

24a6ecc is the first bad commit
commit 24a6ecc
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

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.

Oh it works. I suspect setting stick key cause that

Ahhhh, that explains it!

It really need sticker key to lockup special key

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

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

Thank you. I see.

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