billziss-gh / EnergyBar

Supercharge your Mac's Touch Bar.
GNU General Public License v3.0
749 stars 34 forks source link

Option to highlight active app #45

Open iamLoi opened 5 years ago

iamLoi commented 5 years ago

Hi,

Thanks for creating this, amazing utility! I was wondering if a good feature would be an option to highlight active app in the dock. Currently one can add the active app widget, but that takes up space which can be used for other widgets. How about an option to highlight the currently active app on the dock icons itself (for example, with a gray background)?

Thanks

billziss-gh commented 5 years ago

@iamLoi that is a good idea! I am wondering if you would like to take a stab at it?

iamLoi commented 5 years ago

@iamLoi that is a good idea! I am wondering if you would like to take a stab at it?

I can try, although I have no previous experience with Objective-C. If I can have some pointers on which methods/classes which codes the icons on the dock and its status, I can tinker around but it may take a while.

billziss-gh commented 5 years ago

The code for the Dock widget is in DockWidget.m.

The code is unfortunately not straightforward, but perhaps the most important class for your task is DockWidgetItemView. You could perhaps add a new active property that visually modifies the widget by adding a border or other visual effect. The code already has an example of adding a shadow for "prominent" views, which are views that can accept dragged files (e.g. when you drag a file from your desktop into the touch bar).

iamLoi commented 5 years ago

Thanks for directing to the specific class! I will take look.

iamLoi commented 5 years ago

I've cloned the project into Xcode and made some minor changes, how do I run it in a simulator type environment where I can see the changes I've made live?