Bug 507007 - Support new MacBook Pro Touch Bar
Summary: Support new MacBook Pro Touch Bar
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.7   Edit
Hardware: PC Mac OS X
: P3 enhancement with 11 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 546328
Blocks:
  Show dependency tree
 
Reported: 2016-11-03 17:16 EDT by Luke deGruchy CLA
Modified: 2020-09-15 02:19 EDT (History)
22 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke deGruchy CLA 2016-11-03 17:16:12 EDT
This is a very broad feature request that will most likely get broken down into several new features.

Apple recently announced new MacBook Pros with an LED touch bar replacing the row of function keys.

This represents both a problem and an opportunity.

Preliminary (and not very deeply thought) suggestions for taking advantage of such functionality:

1) Retaining the existing F* key shortcuts for all platforms, including macOS since the majority of Mac hardware will have function keys.
2) Detecting when in debug mode and showing stop/step over/step into icons in the same places as the familiar F6-F7-F8-etc keys.
3) Detecting that a JUnit file is open and exposing Run/Debug/Show previous results icons.
4) When editing a Java file, expose icons exposing refactoring and generate source (getters/setters) options normally buried under the right-click context menu.
5) Expose an icon for the right-click context menu in all instances.

These are just preliminary suggestions, and I'm sure there ideas out there way better than mine.

Also, since the hardware isn't yet even in the hands of reviewers, there are many unanswered questions about the implementation, details which need to be understood to implement this new functionality.
Comment 1 Reinier Zwitserloot CLA 2017-05-09 07:21:46 EDT
Pretty sure you'd mix up using this library:

http://solutions.weblite.ca/java-objective-c-bridge/docs/

to access this API:

https://developer.apple.com/reference/appkit/nstouchbar

Mirroring the toolbar buttons to the touchbar is probably not a great idea; the touchbar has very limited space, and part of the point is that the widgets have a different interface (touch, not mouse). Thus, some thought would have to be put into what widgets go in the touchbar.

A first attempt could simply add a 'hardcoded' set of widgets depending on context, but optimally there'd be a separate customization section.
Comment 2 Jesper Moller CLA 2018-10-11 16:15:36 EDT
FWIW: There's a Java library in progress for the touch bar now: https://github.com/Thizzer/JTouchBar
Comment 3 Till Brychcy CLA 2018-11-18 05:52:59 EST
Note: Its possible that different solution for bug 538377 has to be found when trying to implement this.
Comment 4 Nobody - feel free to take it CLA 2019-04-08 09:41:58 EDT
Today we have tried to implemented a prototype to use the mentioned Java library to execute an action in eclipse. Basically, we have used the button example from https://github.com/Thizzer/jtouchbar.

While doing so we have encountered two big questions:

1. How could the native calls made available within eclipse. Is it possible to add the JTouchbar as a dependency to the Eclipse Project? Another option would be to implement an own wrapper for the native calls as part of Eclipse SWT?

2. How to enable plugins to contribute elements to the Touchbar and how to make this configurable? 


We have had a look into VS Code and how they provide their Touchbar support. It seems that the Touchbar library is part of the IDE itself and that individual plugins can consume the Touchbar API. The element contributions to the Touchbar can be configured via the preferences in VS Code.
Comment 5 Karsten Thoms CLA 2019-04-08 12:01:47 EDT
(In reply to Ivo Gosemann from comment #4)
> 1. How could the native calls made available within eclipse. Is it possible
> to add the JTouchbar as a dependency to the Eclipse Project? 

I don't think that this is worth adding a 3rd party library dependency for a library with only 1 contributor to a core library as SWT. I think this should be solved like all other Cocoa integrations.

>Another option
> would be to implement an own wrapper for the native calls as part of Eclipse
> SWT?

I had discussion with Lakshmi at ECE2018 about this. IIRC this is requires
- selectors to access NSTouchbar in org.eclipse.swt.internal.cocoa.OS / Selector
  This is generated code and there exists a generator tool for that
- Likely a NSTouchbar class to be added to package org.eclipse.swt.internal.cocoa
I though that a bug for that was opened, but I could not find it yet.


> 
> 2. How to enable plugins to contribute elements to the Touchbar and how to
> make this configurable? 

One idea was to mark UI commands to contribute to the Touchbar. It could be decided from the active commands which are potentially visible in the touchbar. This would require addition to the extension point for commands. That's just a rough idea though.


> 
> 
> We have had a look into VS Code and how they provide their Touchbar support.
> It seems that the Touchbar library is part of the IDE itself and that
> individual plugins can consume the Touchbar API. The element contributions
> to the Touchbar can be configured via the preferences in VS Code.
Comment 6 Nobody - feel free to take it CLA 2019-04-09 07:08:10 EDT
(In reply to Karsten Thoms from comment #5)
This sounds like there is also a general interest from your side to support the Touchbar in Eclipse.
How do you propose to go forward with this? 
I am interested in contributing towards the implementation.
Comment 7 Karsten Thoms CLA 2019-04-11 06:21:36 EDT
Personally, I don't use the touchbar except for regulating sound volume and display brightness. I thought it would be a very useful extension, but am disillusioned. But I can understand that my personal preference does not reflect others, and supporting the touchbar is a logical addition.

We are willing to support you in contributing here. Please ask whatever you need. First, we need to open an enhancement bug to SWT to support the touchbar selector. Next, you could try to follow the hints I gave, but make your own mind about that. The first step is very clear, while the second is just vague.
Comment 8 Karsten Thoms CLA 2019-04-11 06:25:45 EDT
Opened SWT bug#546328
Comment 9 Mirko Raner CLA 2020-09-01 21:34:22 EDT
I think this would be a nice feature to help people remember the useful functionality that can be accessed via the function keys. Personally, I use the F-keys all the time, and the first thing I did when I got my new MacBook was to switch it from the sound/brightness/etc. controls back to regular function keys. But clearly it's a matter of personal preference.

Has anyone been able to make some progress with this feature since the last discussion? I might have some spare cycles to contribute, but I don't want to duplicate any work that has already been done :-)
Comment 10 Gayan Perera CLA 2020-09-14 14:32:02 EDT
Seems like no body is working on this, i would really appreciate if we can at least get the function keys when eclipse is active to start with, because otherwise when debugging you need to press FN + touch bar to get going.

may be second step might be to support actions in the touchbar and when FN key is press switch to function keys for a moment.
Comment 11 Daniel Haas CLA 2020-09-15 02:19:21 EDT
(In reply to Gayan Perera from comment #10)
> Seems like no body is working on this, i would really appreciate if we can
> at least get the function keys when eclipse is active to start with, because
> otherwise when debugging you need to press FN + touch bar to get going.
> 
> may be second step might be to support actions in the touchbar and when FN
> key is press switch to function keys for a moment.

It would be handy if that would work, but what I use in the meantime is switching it to Fn keys whenever Eclipse is open:
https://support.apple.com/guide/mac-help/customize-the-touch-bar-mchl5a63b060/