├── README.md ├── nyancat-touchbar-mac.gif ├── touchbar_nyancat.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── avatsaev.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── touchbar_nyancat.xcscheme │ └── xcschememanagement.plist └── touchbar_nyancat ├── AppDelegate.swift ├── AppIcon.icns ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── Base.lproj └── Main.storyboard ├── Info.plist ├── NyanCatCanvas.swift ├── NyanCatCanvas.xib ├── NyanCatViewController.swift ├── ic_volume_off_3x.png ├── ic_volume_up_3x.png ├── icon.png └── nyan_music.mp3 /README.md: -------------------------------------------------------------------------------- 1 | # Touchbar Nyancat 2 | Stupid Nyan Cat animation on your +$2k MacBook Pro's Touchbar. Enjoy. 3 | 4 | 5 | ![nyancat-touchbar-mac.gif](nyancat-touchbar-mac.gif) 6 | 7 | 8 | 9 | [Download ⬇️](https://github.com/avatsaev/touchbar_nyancat/releases) 10 | 11 | 12 | # Instructions 13 | - Download the app 14 | - The app is not signed, if GateKeeper refuses to run it, you can bypass the Gatekeeper by right-clicking the app and then chose `Open` in context menu (one time operation). 15 | - The animation appers in the TouchBar only when to app is in focus. 16 | 17 | ![](http://i.imgur.com/mHYg4vE.jpeg) 18 | 19 | 20 | ## Other awesome TouchBar apps 21 | 22 | * [TouchFart][touchfart] - by @hungtruong 23 | * [KnightTouchBar2000][KnightTouchBar2000] - by @AkdM 24 | * [TouchBarSpaceFight][TouchBarSpaceFight] - by @insidegui 25 | 26 | [touchfart]: 27 | [KnightTouchBar2000]: 28 | [TouchBarSpaceFight]: 29 | 30 | 31 | -------------------------------------------------------------------------------- /nyancat-touchbar-mac.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avatsaev/touchbar_nyancat/189e2e174fe0de381edd6ccf0aa00008b1d2638d/nyancat-touchbar-mac.gif -------------------------------------------------------------------------------- /touchbar_nyancat.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A34053A21DCF56600081ABF1 /* ic_volume_off_3x.png in Resources */ = {isa = PBXBuildFile; fileRef = A34053A11DCF56600081ABF1 /* ic_volume_off_3x.png */; }; 11 | A34053A41DCF56640081ABF1 /* ic_volume_up_3x.png in Resources */ = {isa = PBXBuildFile; fileRef = A34053A31DCF56640081ABF1 /* ic_volume_up_3x.png */; }; 12 | A362A1061DCE6D6B00737197 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A362A1051DCE6D6B00737197 /* AppDelegate.swift */; }; 13 | A362A1081DCE6D6B00737197 /* NyanCatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A362A1071DCE6D6B00737197 /* NyanCatViewController.swift */; }; 14 | A362A10A1DCE6D6B00737197 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A362A1091DCE6D6B00737197 /* Assets.xcassets */; }; 15 | A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A362A10B1DCE6D6B00737197 /* Main.storyboard */; }; 16 | A3826CDA1DCE79B900B7C41E /* NyanCatCanvas.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */; }; 17 | A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */; }; 18 | F3D5DE841F8AE06D00AD4767 /* nyan_music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */; }; 19 | F3D5DE861F8AE13A00AD4767 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE851F8AE11900AD4767 /* icon.png */; }; 20 | F3D5DE881F8AE20700AD4767 /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | A34053A11DCF56600081ABF1 /* ic_volume_off_3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_volume_off_3x.png; sourceTree = ""; }; 25 | A34053A31DCF56640081ABF1 /* ic_volume_up_3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_volume_up_3x.png; sourceTree = ""; }; 26 | A362A1021DCE6D6B00737197 /* touchbar_nyancat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = touchbar_nyancat.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | A362A1051DCE6D6B00737197 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 28 | A362A1071DCE6D6B00737197 /* NyanCatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NyanCatViewController.swift; sourceTree = ""; }; 29 | A362A1091DCE6D6B00737197 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | A362A10C1DCE6D6B00737197 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | A362A10E1DCE6D6B00737197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NyanCatCanvas.swift; sourceTree = ""; }; 33 | A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NyanCatCanvas.xib; sourceTree = ""; }; 34 | F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = nyan_music.mp3; sourceTree = ""; }; 35 | F3D5DE851F8AE11900AD4767 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; 36 | F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon.icns; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | A362A0FF1DCE6D6B00737197 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | A362A0F91DCE6D6B00737197 = { 51 | isa = PBXGroup; 52 | children = ( 53 | A362A1041DCE6D6B00737197 /* touchbar_nyancat */, 54 | A362A1031DCE6D6B00737197 /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | A362A1031DCE6D6B00737197 /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | A362A1021DCE6D6B00737197 /* touchbar_nyancat.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | A362A1041DCE6D6B00737197 /* touchbar_nyancat */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | A3A050DA1DCE96B2009D9775 /* sound */, 70 | A3826CD61DCE73EA00B7C41E /* img */, 71 | A362A1051DCE6D6B00737197 /* AppDelegate.swift */, 72 | A362A1071DCE6D6B00737197 /* NyanCatViewController.swift */, 73 | A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */, 74 | A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */, 75 | A362A1091DCE6D6B00737197 /* Assets.xcassets */, 76 | F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */, 77 | A362A10B1DCE6D6B00737197 /* Main.storyboard */, 78 | A362A10E1DCE6D6B00737197 /* Info.plist */, 79 | ); 80 | path = touchbar_nyancat; 81 | sourceTree = ""; 82 | }; 83 | A3826CD61DCE73EA00B7C41E /* img */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | F3D5DE851F8AE11900AD4767 /* icon.png */, 87 | A34053A11DCF56600081ABF1 /* ic_volume_off_3x.png */, 88 | A34053A31DCF56640081ABF1 /* ic_volume_up_3x.png */, 89 | ); 90 | name = img; 91 | sourceTree = ""; 92 | }; 93 | A3A050DA1DCE96B2009D9775 /* sound */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */, 97 | ); 98 | name = sound; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | A362A1011DCE6D6B00737197 /* touchbar_nyancat */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = A362A1111DCE6D6B00737197 /* Build configuration list for PBXNativeTarget "touchbar_nyancat" */; 107 | buildPhases = ( 108 | A362A0FE1DCE6D6B00737197 /* Sources */, 109 | A362A0FF1DCE6D6B00737197 /* Frameworks */, 110 | A362A1001DCE6D6B00737197 /* Resources */, 111 | ); 112 | buildRules = ( 113 | ); 114 | dependencies = ( 115 | ); 116 | name = touchbar_nyancat; 117 | productName = touchbar_nyancat; 118 | productReference = A362A1021DCE6D6B00737197 /* touchbar_nyancat.app */; 119 | productType = "com.apple.product-type.application"; 120 | }; 121 | /* End PBXNativeTarget section */ 122 | 123 | /* Begin PBXProject section */ 124 | A362A0FA1DCE6D6B00737197 /* Project object */ = { 125 | isa = PBXProject; 126 | attributes = { 127 | LastSwiftUpdateCheck = 0810; 128 | LastUpgradeCheck = 1120; 129 | ORGANIZATIONNAME = AVatsaev; 130 | TargetAttributes = { 131 | A362A1011DCE6D6B00737197 = { 132 | CreatedOnToolsVersion = 8.1; 133 | DevelopmentTeam = 9K2GY8824J; 134 | LastSwiftMigration = 1120; 135 | ProvisioningStyle = Automatic; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = A362A0FD1DCE6D6B00737197 /* Build configuration list for PBXProject "touchbar_nyancat" */; 140 | compatibilityVersion = "Xcode 3.2"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = A362A0F91DCE6D6B00737197; 148 | productRefGroup = A362A1031DCE6D6B00737197 /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | A362A1011DCE6D6B00737197 /* touchbar_nyancat */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | A362A1001DCE6D6B00737197 /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | F3D5DE881F8AE20700AD4767 /* AppIcon.icns in Resources */, 163 | F3D5DE861F8AE13A00AD4767 /* icon.png in Resources */, 164 | F3D5DE841F8AE06D00AD4767 /* nyan_music.mp3 in Resources */, 165 | A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */, 166 | A362A10A1DCE6D6B00737197 /* Assets.xcassets in Resources */, 167 | A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */, 168 | A34053A21DCF56600081ABF1 /* ic_volume_off_3x.png in Resources */, 169 | A34053A41DCF56640081ABF1 /* ic_volume_up_3x.png in Resources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXResourcesBuildPhase section */ 174 | 175 | /* Begin PBXSourcesBuildPhase section */ 176 | A362A0FE1DCE6D6B00737197 /* Sources */ = { 177 | isa = PBXSourcesBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | A362A1081DCE6D6B00737197 /* NyanCatViewController.swift in Sources */, 181 | A3826CDA1DCE79B900B7C41E /* NyanCatCanvas.swift in Sources */, 182 | A362A1061DCE6D6B00737197 /* AppDelegate.swift in Sources */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXSourcesBuildPhase section */ 187 | 188 | /* Begin PBXVariantGroup section */ 189 | A362A10B1DCE6D6B00737197 /* Main.storyboard */ = { 190 | isa = PBXVariantGroup; 191 | children = ( 192 | A362A10C1DCE6D6B00737197 /* Base */, 193 | ); 194 | name = Main.storyboard; 195 | sourceTree = ""; 196 | }; 197 | /* End PBXVariantGroup section */ 198 | 199 | /* Begin XCBuildConfiguration section */ 200 | A362A10F1DCE6D6B00737197 /* Debug */ = { 201 | isa = XCBuildConfiguration; 202 | buildSettings = { 203 | ALWAYS_SEARCH_USER_PATHS = NO; 204 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 205 | CLANG_ANALYZER_NONNULL = YES; 206 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 207 | CLANG_CXX_LIBRARY = "libc++"; 208 | CLANG_ENABLE_MODULES = YES; 209 | CLANG_ENABLE_OBJC_ARC = YES; 210 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 211 | CLANG_WARN_BOOL_CONVERSION = YES; 212 | CLANG_WARN_COMMA = YES; 213 | CLANG_WARN_CONSTANT_CONVERSION = YES; 214 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 215 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 216 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INFINITE_RECURSION = YES; 220 | CLANG_WARN_INT_CONVERSION = YES; 221 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 222 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 223 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 226 | CLANG_WARN_STRICT_PROTOTYPES = YES; 227 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 228 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 229 | CLANG_WARN_UNREACHABLE_CODE = YES; 230 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 231 | CODE_SIGN_IDENTITY = "-"; 232 | COPY_PHASE_STRIP = NO; 233 | DEBUG_INFORMATION_FORMAT = dwarf; 234 | ENABLE_STRICT_OBJC_MSGSEND = YES; 235 | ENABLE_TESTABILITY = YES; 236 | GCC_C_LANGUAGE_STANDARD = gnu99; 237 | GCC_DYNAMIC_NO_PIC = NO; 238 | GCC_NO_COMMON_BLOCKS = YES; 239 | GCC_OPTIMIZATION_LEVEL = 0; 240 | GCC_PREPROCESSOR_DEFINITIONS = ( 241 | "DEBUG=1", 242 | "$(inherited)", 243 | ); 244 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 245 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 246 | GCC_WARN_UNDECLARED_SELECTOR = YES; 247 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 248 | GCC_WARN_UNUSED_FUNCTION = YES; 249 | GCC_WARN_UNUSED_VARIABLE = YES; 250 | MACOSX_DEPLOYMENT_TARGET = 10.12; 251 | MTL_ENABLE_DEBUG_INFO = YES; 252 | ONLY_ACTIVE_ARCH = YES; 253 | SDKROOT = macosx; 254 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 255 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 256 | }; 257 | name = Debug; 258 | }; 259 | A362A1101DCE6D6B00737197 /* Release */ = { 260 | isa = XCBuildConfiguration; 261 | buildSettings = { 262 | ALWAYS_SEARCH_USER_PATHS = NO; 263 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 264 | CLANG_ANALYZER_NONNULL = YES; 265 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 266 | CLANG_CXX_LIBRARY = "libc++"; 267 | CLANG_ENABLE_MODULES = YES; 268 | CLANG_ENABLE_OBJC_ARC = YES; 269 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 270 | CLANG_WARN_BOOL_CONVERSION = YES; 271 | CLANG_WARN_COMMA = YES; 272 | CLANG_WARN_CONSTANT_CONVERSION = YES; 273 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 276 | CLANG_WARN_EMPTY_BODY = YES; 277 | CLANG_WARN_ENUM_CONVERSION = YES; 278 | CLANG_WARN_INFINITE_RECURSION = YES; 279 | CLANG_WARN_INT_CONVERSION = YES; 280 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 282 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 283 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 284 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 285 | CLANG_WARN_STRICT_PROTOTYPES = YES; 286 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 287 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 288 | CLANG_WARN_UNREACHABLE_CODE = YES; 289 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 290 | CODE_SIGN_IDENTITY = "-"; 291 | COPY_PHASE_STRIP = NO; 292 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 293 | ENABLE_NS_ASSERTIONS = NO; 294 | ENABLE_STRICT_OBJC_MSGSEND = YES; 295 | GCC_C_LANGUAGE_STANDARD = gnu99; 296 | GCC_NO_COMMON_BLOCKS = YES; 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | MACOSX_DEPLOYMENT_TARGET = 10.12; 304 | MTL_ENABLE_DEBUG_INFO = NO; 305 | SDKROOT = macosx; 306 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 307 | }; 308 | name = Release; 309 | }; 310 | A362A1121DCE6D6B00737197 /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 314 | CODE_SIGN_IDENTITY = "Apple Development"; 315 | COMBINE_HIDPI_IMAGES = YES; 316 | DEVELOPMENT_TEAM = 9K2GY8824J; 317 | ENABLE_HARDENED_RUNTIME = YES; 318 | INFOPLIST_FILE = touchbar_nyancat/Info.plist; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 320 | PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat"; 321 | PRODUCT_NAME = "$(TARGET_NAME)"; 322 | SWIFT_VERSION = 5.0; 323 | }; 324 | name = Debug; 325 | }; 326 | A362A1131DCE6D6B00737197 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 330 | CODE_SIGN_IDENTITY = "Apple Development"; 331 | COMBINE_HIDPI_IMAGES = YES; 332 | DEVELOPMENT_TEAM = 9K2GY8824J; 333 | ENABLE_HARDENED_RUNTIME = YES; 334 | INFOPLIST_FILE = touchbar_nyancat/Info.plist; 335 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 336 | PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat"; 337 | PRODUCT_NAME = "$(TARGET_NAME)"; 338 | SWIFT_VERSION = 5.0; 339 | }; 340 | name = Release; 341 | }; 342 | /* End XCBuildConfiguration section */ 343 | 344 | /* Begin XCConfigurationList section */ 345 | A362A0FD1DCE6D6B00737197 /* Build configuration list for PBXProject "touchbar_nyancat" */ = { 346 | isa = XCConfigurationList; 347 | buildConfigurations = ( 348 | A362A10F1DCE6D6B00737197 /* Debug */, 349 | A362A1101DCE6D6B00737197 /* Release */, 350 | ); 351 | defaultConfigurationIsVisible = 0; 352 | defaultConfigurationName = Release; 353 | }; 354 | A362A1111DCE6D6B00737197 /* Build configuration list for PBXNativeTarget "touchbar_nyancat" */ = { 355 | isa = XCConfigurationList; 356 | buildConfigurations = ( 357 | A362A1121DCE6D6B00737197 /* Debug */, 358 | A362A1131DCE6D6B00737197 /* Release */, 359 | ); 360 | defaultConfigurationIsVisible = 0; 361 | defaultConfigurationName = Release; 362 | }; 363 | /* End XCConfigurationList section */ 364 | }; 365 | rootObject = A362A0FA1DCE6D6B00737197 /* Project object */; 366 | } 367 | -------------------------------------------------------------------------------- /touchbar_nyancat.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /touchbar_nyancat.xcodeproj/xcuserdata/avatsaev.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /touchbar_nyancat.xcodeproj/xcuserdata/avatsaev.xcuserdatad/xcschemes/touchbar_nyancat.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /touchbar_nyancat.xcodeproj/xcuserdata/avatsaev.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | touchbar_nyancat.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A362A1011DCE6D6B00737197 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /touchbar_nyancat/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // touchbar_nyancat 4 | // 5 | // Created by Aslan Vatsaev on 05/11/2016. 6 | // Copyright © 2016 AVatsaev. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | 15 | 16 | func applicationDidFinishLaunching(_ aNotification: Notification) { 17 | // Insert code here to initialize your application 18 | 19 | } 20 | 21 | func applicationWillTerminate(_ aNotification: Notification) { 22 | // Insert code here to tear down your application 23 | } 24 | 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /touchbar_nyancat/AppIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avatsaev/touchbar_nyancat/189e2e174fe0de381edd6ccf0aa00008b1d2638d/touchbar_nyancat/AppIcon.icns -------------------------------------------------------------------------------- /touchbar_nyancat/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /touchbar_nyancat/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /touchbar_nyancat/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /touchbar_nyancat/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | AppIcon.icns 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2016 AVatsaev. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /touchbar_nyancat/NyanCatCanvas.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NyanCatCanvas.swift 3 | // touchbar_nyancat 4 | // 5 | // Created by Aslan Vatsaev on 05/11/2016. 6 | // Copyright © 2016 AVatsaev. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class NyanCatCanvas: NSImageView { 12 | @objc var timer:Timer? = nil 13 | 14 | @objc var imageLoaded:Bool = false; 15 | 16 | @objc var xPosition: CGFloat = -680 { 17 | didSet { 18 | self.frame = CGRect(x: xPosition, y: 0, width: 680, height: 30) 19 | } 20 | } 21 | 22 | override func draw(_ dirtyRect: NSRect) { 23 | super.draw(dirtyRect) 24 | 25 | // Drawing code here. 26 | 27 | self.animates = true 28 | 29 | if(self.timer == nil) { 30 | timer = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(self.moveNyancat), userInfo: nil, repeats: true) 31 | } 32 | 33 | if(!self.imageLoaded){ 34 | self.downloadImage() 35 | } 36 | 37 | self.canDrawSubviewsIntoLayer = true 38 | // self.frame = CGRect(x: xPosition, y: 0, width: 680, height: 30) 39 | } 40 | 41 | override func touchesBegan(with event: NSEvent) { 42 | // Calling super causes the cat to jump back to its original position 🤔 43 | //super.touchesBegan(with: event) 44 | } 45 | 46 | override func didAddSubview(_ subview: NSView) { 47 | 48 | } 49 | 50 | var direction: CGFloat = 1 51 | @objc public func moveNyancat() { 52 | xPosition += direction 53 | if xPosition > 0 { 54 | direction = -1 55 | } else if xPosition < -680 { 56 | direction = 1 57 | } 58 | } 59 | 60 | @objc func downloadImage() { 61 | 62 | let url = URL(string: "https://i.imgur.com/7pgdK28.gif") 63 | 64 | getDataFromUrl(url: url!) { (data, response, error) in 65 | guard let data = data, error == nil else { return } 66 | 67 | DispatchQueue.main.async() { () -> Void in 68 | self.image = NSImage(data: data) 69 | self.imageLoaded = true; 70 | } 71 | } 72 | } 73 | 74 | @objc func getDataFromUrl(url: URL, completion: @escaping (_ data: Data?, _ response: URLResponse?, _ error: Error?) -> Void) { 75 | URLSession.shared.dataTask(with: url) { 76 | (data, response, error) in 77 | completion(data, response, error) 78 | }.resume() 79 | } 80 | 81 | 82 | 83 | override func touchesMoved(with event: NSEvent) { 84 | if #available(OSX 10.12.2, *) { 85 | let current = event.allTouches().first?.location(in: self).x ?? 0 86 | let previous = event.allTouches().first?.previousLocation(in: self).x ?? 0 87 | 88 | let dX = (current - previous) 89 | 90 | xPosition += dX 91 | } else { 92 | // Fallback on earlier versions 93 | } 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /touchbar_nyancat/NyanCatCanvas.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /touchbar_nyancat/NyanCatViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // touchbar_nyancat 4 | // 5 | // Created by Aslan Vatsaev on 05/11/2016. 6 | // Copyright © 2016 AVatsaev. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import AVFoundation 11 | 12 | 13 | 14 | class NyanCatViewController: NSViewController , NSTouchBarDelegate, NSWindowDelegate { 15 | 16 | @objc var audio_player: AVAudioPlayer? 17 | 18 | @IBOutlet weak var muteBtn: NSButton! 19 | //NOTE: I fucking love Swift's computed properties! 20 | @objc var sound: Bool = true { 21 | 22 | didSet{ 23 | 24 | if sound { 25 | audio_player?.play() 26 | sound_btn.image = sound_btn_image_on 27 | }else{ 28 | audio_player?.pause() 29 | sound_btn.image = sound_btn_image_off 30 | } 31 | 32 | } 33 | 34 | } 35 | 36 | @objc var sound_btn_image_on: NSImage? 37 | @objc var sound_btn_image_off: NSImage? 38 | 39 | @IBOutlet weak var sound_btn: NSButtonCell! 40 | @IBOutlet weak var bkg: NSView! 41 | 42 | 43 | override func viewDidLoad() { 44 | super.viewDidLoad() 45 | 46 | self.view.wantsLayer = true 47 | self.muteBtn.isHidden = false 48 | 49 | } 50 | 51 | 52 | @IBAction func toggle_sound(_ sender: Any) { 53 | 54 | //NOTE: Swift's computed properties FTW! 55 | sound = !sound 56 | } 57 | 58 | func windowWillClose(_ notification: Notification) { 59 | NSApplication.shared.terminate(self) 60 | } 61 | 62 | override func viewWillAppear() { 63 | 64 | super.viewWillAppear() 65 | view.window?.delegate = self 66 | 67 | bkg.layer?.backgroundColor = NSColor(red:0.08, green:0.31, blue:0.55, alpha:1.00).cgColor 68 | 69 | sound_btn_image_on = NSImage(named: "ic_volume_up_3x.png") 70 | sound_btn_image_off = NSImage(named: "ic_volume_off_3x.png") 71 | 72 | 73 | let nyan_music = URL(fileURLWithPath: Bundle.main.path(forResource: "nyan_music", ofType: "mp3")!) 74 | 75 | do { 76 | 77 | try audio_player = AVAudioPlayer(contentsOf: nyan_music) 78 | audio_player?.numberOfLoops = -1 79 | audio_player?.prepareToPlay() 80 | 81 | }catch{} 82 | 83 | sound = true 84 | 85 | } 86 | 87 | override var representedObject: Any? { 88 | didSet { 89 | // Update the view, if already loaded. 90 | } 91 | } 92 | 93 | } 94 | 95 | -------------------------------------------------------------------------------- /touchbar_nyancat/ic_volume_off_3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avatsaev/touchbar_nyancat/189e2e174fe0de381edd6ccf0aa00008b1d2638d/touchbar_nyancat/ic_volume_off_3x.png -------------------------------------------------------------------------------- /touchbar_nyancat/ic_volume_up_3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avatsaev/touchbar_nyancat/189e2e174fe0de381edd6ccf0aa00008b1d2638d/touchbar_nyancat/ic_volume_up_3x.png -------------------------------------------------------------------------------- /touchbar_nyancat/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avatsaev/touchbar_nyancat/189e2e174fe0de381edd6ccf0aa00008b1d2638d/touchbar_nyancat/icon.png -------------------------------------------------------------------------------- /touchbar_nyancat/nyan_music.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avatsaev/touchbar_nyancat/189e2e174fe0de381edd6ccf0aa00008b1d2638d/touchbar_nyancat/nyan_music.mp3 --------------------------------------------------------------------------------