billziss-gh / EnergyBar

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

Enable certain apps to overide touchbar #52

Open andrewwilliam26 opened 4 years ago

andrewwilliam26 commented 4 years ago

I usually use the touchbar on some apps such as safari or photoshop, so making a setting to let specific apps overide the touchbar would be great

DominikBucher12 commented 4 years ago

you can fix this yourself -> Fork the project and then observe which applications are on foreground with these observers:

    [
      NSWorkspace.didLaunchApplicationNotification,
      NSWorkspace.didTerminateApplicationNotification,
      NSWorkspace.didActivateApplicationNotification
    ]
    .forEach {
      NSWorkspace.shared.notificationCenter.addObserver(
        self,
        selector: #selector(hideOrShowXTouchBar),
        name: $0,
        object: nil
      )
    }
  }

on hideOrShowTouchBar Check the application AppID (You need to little hacking of the app you want to hide touchbar for. for example:

if let appID = NSWorkspace.shared.frontmostApplication?.bundleIdentifier,
    appID == "com.adobe.photoshop" /* Probably wrong, you need to find yourself*/ { 
    dismissSystemModal(NSApp.touchBar!)
}
knives-repo commented 3 years ago

Where did you add this code on the project?

DominikBucher12 commented 3 years ago

@knives-repo nowhere. I didnt create any pull request because the repo seems dead

knives-repo commented 3 years ago

@DominikBucher12 ok, but if I were to add it in myself, where would I add it?

DominikBucher12 commented 3 years ago

@knives-repo check out how my tool XTouchBar does it https://github.com/DominikBucher12/XTouchBar you simply observe those applications in AppDelegate...