All Projects → ChimeHQ → Nicertouchbar

ChimeHQ / Nicertouchbar

Licence: bsd-3-clause
Utilities for a more pleasant NSTouchBar development experience

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Nicertouchbar

PockKit
Core framework for building Pock widgets
Stars: ✭ 64 (+106.45%)
Mutual labels:  touchbar
Coinpricebar
💰 Cryptocurrency prices on MacBook Touch Bar
Stars: ✭ 290 (+835.48%)
Mutual labels:  touchbar
Knighttouchbar2000
KITT 2000 chaser animation for your MacBook Pro TouchBar
Stars: ✭ 471 (+1419.35%)
Mutual labels:  touchbar
short-touch
Application to easily generate short cut buttons on MacBooks with the touch bar.
Stars: ✭ 12 (-61.29%)
Mutual labels:  touchbar
TouchBarServer
Touch Bar over VNC
Stars: ✭ 77 (+148.39%)
Mutual labels:  touchbar
Touchbreakout
Play Breakout game on your MacBook Pro with Touch Bar, using SpriteKit. 用 Touch Bar 在 Mac 上玩打砖块游戏
Stars: ✭ 318 (+925.81%)
Mutual labels:  touchbar
btt
Low level MacOS management in JavaScript via BetterTouchTool
Stars: ✭ 92 (+196.77%)
Mutual labels:  touchbar
Zsh Iterm Touchbar
Display feedback of terminal in the 🍏 Touchbar
Stars: ✭ 632 (+1938.71%)
Mutual labels:  touchbar
Zsh Apple Touchbar
Make your touchbar more powerful.
Stars: ✭ 261 (+741.94%)
Mutual labels:  touchbar
Awesome Touchbar
👉 🌟 delightful macOS resources for your touchbar
Stars: ✭ 366 (+1080.65%)
Mutual labels:  touchbar
touchtest
MacOS Touch Bar Control Strip daemon
Stars: ✭ 22 (-29.03%)
Mutual labels:  touchbar
touchbar-emoji
使用touchbar来控制飘落emoji表情雨。
Stars: ✭ 18 (-41.94%)
Mutual labels:  touchbar
Thief
一款创新跨平台摸鱼神器,支持小说、股票、网页、视频、直播、PDF、游戏等摸鱼模式,为上班族打造的上班必备神器,使用此软件可以让上班倍感轻松,远离 ICU。
Stars: ✭ 3,974 (+12719.35%)
Mutual labels:  touchbar
btt-touchbar-preset
🧰 My TouchBar BTT preset
Stars: ✭ 18 (-41.94%)
Mutual labels:  touchbar
Macos Ui Kit
💎 The most detailed and accurate macOS UI Kit for Sketch. This Sketch Library includes common Mac interface elements, cursors, and a Touch Bar UI Kit.
Stars: ✭ 551 (+1677.42%)
Mutual labels:  touchbar
ButOSX
CSGO Cheat Base for MacOSX. Written in C++ & Objective C. Menu Powered by ImGui. Includes Apple TouchBar API.
Stars: ✭ 58 (+87.1%)
Mutual labels:  touchbar
Mtmr
🌟 [My TouchBar My rules]. The Touch Bar Customisation App for your MacBook Pro
Stars: ✭ 3,547 (+11341.94%)
Mutual labels:  touchbar
Energybar
Supercharge your Mac's Touch Bar.
Stars: ✭ 720 (+2222.58%)
Mutual labels:  touchbar
Muse
An open-source Spotify controller with TouchBar support
Stars: ✭ 594 (+1816.13%)
Mutual labels:  touchbar
Touchbar
Apple MacBook Pro TouchBar (NSTouchBar) Cheatsheet and Swift examples
Stars: ✭ 339 (+993.55%)
Mutual labels:  touchbar

Github CI Carthage compatible

NicerTouchBar

NicerTouchBar includes useful utilities for NSTouchBar/NSTouchBarItem validation, as well as some convenience methods for influencing NSTouchBar behavior/setup.

Validation

While we have NSMenuItemValidation and NSUserInterfaceValidations, as of 10.15, NSTouchBar doesn't have a good validation system. This library introduces a TouchBarItemValidations protocol, which is checked first during the touch bar validation process. As a fallback, NSUserInterfaceValidations is checked if appropriate.

public protocol TouchBarItemValidations {
    @available(OSX 10.12.2, *)
    func validateTouchBarItem(_ item: NSTouchBarItem) -> Bool
}

Validation is NSTouchBarItem-subclass dependent. Currently, NSGroupTouchBarItem and NSPopoverTouchBarItem are supported. NSCustomTouchBarItem is supported if its view property is a subclass of NSControl.

Triggering Validation

Because this validation isn't provided by the system, you have to do some work to wire it up. You can just use the validate method on NSTouchBar directly. This is manual, but can be efficient, especially if your validation needs are simple.

A fancier way is to hook into NSWindow/NSApplication's didUpdateNotification. This gives you a easy way to run your validation automatically as the window/app processes events.

And, as a convenience, there are a few functions/extensions that make it easier to manually validate.

class MyViewController: NSViewController {
    func myFunction() {
        // this can be called safely before 10.12.2
        validateTouchBar()
        // or (cannot be called before 10.12.2)
        touchbar?.validate()
    }
}

Overriding a Window's TouchBar

It sometimes happens that you need to override a window's default touch bar. Instead of messing with binding, you can use a handy extension on NSViewController.

deinit {
    restoreParentWindowTouchBar()
}

override func viewWillAppear() {
    super.viewWillAppear()

    becomeParentWindowTouchBarProvider()
}

Installation

Carthage:

You can use Carthage to intall this as a static library. However, because the library relies on Objective-C categories to extend AppKit classes, you must include "-ObjC" in your OTHER_LDFLAGS setting.

github "ChimeHQ/NicerTouchBar"

Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/ChimeHQ/NicerTouchBar.git")
]

Suggestions or Feedback

We'd love to hear from you! Get in touch via twitter, an issue, or a pull request.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].