mirror of
https://github.com/avatsaev/touchbar_nyancat
synced 2024-11-22 11:13:06 +00:00
Merge pull request #23 from ethanx94/master
fixed high sierra except for mute button
This commit is contained in:
commit
8e2cd89425
8 changed files with 48 additions and 32 deletions
|
@ -15,6 +15,9 @@
|
||||||
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A362A10B1DCE6D6B00737197 /* Main.storyboard */; };
|
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A362A10B1DCE6D6B00737197 /* Main.storyboard */; };
|
||||||
A3826CDA1DCE79B900B7C41E /* NyanCatCanvas.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */; };
|
A3826CDA1DCE79B900B7C41E /* NyanCatCanvas.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */; };
|
||||||
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */; };
|
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */; };
|
||||||
|
F3D5DE841F8AE06D00AD4767 /* nyan_music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */; };
|
||||||
|
F3D5DE861F8AE13A00AD4767 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE851F8AE11900AD4767 /* icon.png */; };
|
||||||
|
F3D5DE881F8AE20700AD4767 /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
@ -28,6 +31,9 @@
|
||||||
A362A10E1DCE6D6B00737197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
A362A10E1DCE6D6B00737197 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NyanCatCanvas.swift; sourceTree = "<group>"; };
|
A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NyanCatCanvas.swift; sourceTree = "<group>"; };
|
||||||
A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NyanCatCanvas.xib; sourceTree = "<group>"; };
|
A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NyanCatCanvas.xib; sourceTree = "<group>"; };
|
||||||
|
F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = nyan_music.mp3; sourceTree = "<group>"; };
|
||||||
|
F3D5DE851F8AE11900AD4767 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
|
||||||
|
F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon.icns; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -67,6 +73,7 @@
|
||||||
A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */,
|
A3826CD91DCE79B900B7C41E /* NyanCatCanvas.swift */,
|
||||||
A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */,
|
A3826CDB1DCE7B5000B7C41E /* NyanCatCanvas.xib */,
|
||||||
A362A1091DCE6D6B00737197 /* Assets.xcassets */,
|
A362A1091DCE6D6B00737197 /* Assets.xcassets */,
|
||||||
|
F3D5DE871F8AE1FD00AD4767 /* AppIcon.icns */,
|
||||||
A362A10B1DCE6D6B00737197 /* Main.storyboard */,
|
A362A10B1DCE6D6B00737197 /* Main.storyboard */,
|
||||||
A362A10E1DCE6D6B00737197 /* Info.plist */,
|
A362A10E1DCE6D6B00737197 /* Info.plist */,
|
||||||
);
|
);
|
||||||
|
@ -76,6 +83,7 @@
|
||||||
A3826CD61DCE73EA00B7C41E /* img */ = {
|
A3826CD61DCE73EA00B7C41E /* img */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
F3D5DE851F8AE11900AD4767 /* icon.png */,
|
||||||
A34053A11DCF56600081ABF1 /* ic_volume_off_3x.png */,
|
A34053A11DCF56600081ABF1 /* ic_volume_off_3x.png */,
|
||||||
A34053A31DCF56640081ABF1 /* ic_volume_up_3x.png */,
|
A34053A31DCF56640081ABF1 /* ic_volume_up_3x.png */,
|
||||||
);
|
);
|
||||||
|
@ -85,6 +93,7 @@
|
||||||
A3A050DA1DCE96B2009D9775 /* sound */ = {
|
A3A050DA1DCE96B2009D9775 /* sound */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
F3D5DE831F8AE00200AD4767 /* nyan_music.mp3 */,
|
||||||
);
|
);
|
||||||
name = sound;
|
name = sound;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -121,7 +130,8 @@
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
A362A1011DCE6D6B00737197 = {
|
A362A1011DCE6D6B00737197 = {
|
||||||
CreatedOnToolsVersion = 8.1;
|
CreatedOnToolsVersion = 8.1;
|
||||||
DevelopmentTeam = 9K2GY8824J;
|
DevelopmentTeam = CW482378P7;
|
||||||
|
LastSwiftMigration = 0900;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -149,6 +159,9 @@
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
F3D5DE881F8AE20700AD4767 /* AppIcon.icns in Resources */,
|
||||||
|
F3D5DE861F8AE13A00AD4767 /* icon.png in Resources */,
|
||||||
|
F3D5DE841F8AE06D00AD4767 /* nyan_music.mp3 in Resources */,
|
||||||
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */,
|
A3826CDC1DCE7B5000B7C41E /* NyanCatCanvas.xib in Resources */,
|
||||||
A362A10A1DCE6D6B00737197 /* Assets.xcassets in Resources */,
|
A362A10A1DCE6D6B00737197 /* Assets.xcassets in Resources */,
|
||||||
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */,
|
A362A10D1DCE6D6B00737197 /* Main.storyboard in Resources */,
|
||||||
|
@ -280,12 +293,12 @@
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
DEVELOPMENT_TEAM = 9K2GY8824J;
|
DEVELOPMENT_TEAM = CW482378P7;
|
||||||
INFOPLIST_FILE = touchbar_nyancat/Info.plist;
|
INFOPLIST_FILE = touchbar_nyancat/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 3.0;
|
SWIFT_VERSION = 4.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
@ -295,12 +308,12 @@
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
DEVELOPMENT_TEAM = 9K2GY8824J;
|
DEVELOPMENT_TEAM = CW482378P7;
|
||||||
INFOPLIST_FILE = touchbar_nyancat/Info.plist;
|
INFOPLIST_FILE = touchbar_nyancat/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.vatsaev.touchbar-nyancat";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 3.0;
|
SWIFT_VERSION = 4.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|
BIN
touchbar_nyancat/AppIcon.icns
Executable file
BIN
touchbar_nyancat/AppIcon.icns
Executable file
Binary file not shown.
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2659" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaDFRPlugin" version="7104"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaDFRPlugin" version="13038"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
<capability name="the Touch Bar" message="Use a version of macOS with Touch Bar support." minToolsVersion="8.1" minSystemVersion="10.12.1" requiredIntegratedClassName="NSTouchBar"/>
|
<capability name="the Touch Bar" message="Use a version of macOS with Touch Bar support." minToolsVersion="8.1" minSystemVersion="10.12.2" requiredIntegratedClassName="NSTouchBar"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--Window Controller-->
|
<!--Window Controller-->
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
|
||||||
<value key="minSize" type="size" width="480" height="270"/>
|
<value key="minSize" type="size" width="480" height="270"/>
|
||||||
<value key="maxSize" type="size" width="480" height="270"/>
|
<value key="maxSize" type="size" width="480" height="270"/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="B8D-0N-5wS" id="Qm7-gy-puM"/>
|
||||||
|
</connections>
|
||||||
</window>
|
</window>
|
||||||
<touchBar key="touchBar" id="xmN-zC-h8c">
|
<touchBar key="touchBar" id="xmN-zC-h8c">
|
||||||
<touchBarItems>
|
<touchBarItems>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string></string>
|
<string>AppIcon.icns</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class NyanCatCanvas: NSImageView {
|
class NyanCatCanvas: NSImageView {
|
||||||
var timer:Timer? = nil
|
@objc var timer:Timer? = nil
|
||||||
|
|
||||||
var imageLoaded:Bool = false;
|
@objc var imageLoaded:Bool = false;
|
||||||
|
|
||||||
var xPosition: CGFloat = -680 {
|
@objc var xPosition: CGFloat = -680 {
|
||||||
didSet {
|
didSet {
|
||||||
self.frame = CGRect(x: xPosition, y: 0, width: 680, height: 30)
|
self.frame = CGRect(x: xPosition, y: 0, width: 680, height: 30)
|
||||||
}
|
}
|
||||||
|
@ -47,13 +47,13 @@ class NyanCatCanvas: NSImageView {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func moveNyancat() {
|
@objc public func moveNyancat() {
|
||||||
if (xPosition < 0) {
|
if (xPosition < 0) {
|
||||||
xPosition += 1
|
xPosition += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadImage() {
|
@objc func downloadImage() {
|
||||||
|
|
||||||
let url = URL(string: "https://i.imgur.com/7pgdK28.gif")
|
let url = URL(string: "https://i.imgur.com/7pgdK28.gif")
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class NyanCatCanvas: NSImageView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDataFromUrl(url: URL, completion: @escaping (_ data: Data?, _ response: URLResponse?, _ error: Error?) -> Void) {
|
@objc func getDataFromUrl(url: URL, completion: @escaping (_ data: Data?, _ response: URLResponse?, _ error: Error?) -> Void) {
|
||||||
URLSession.shared.dataTask(with: url) {
|
URLSession.shared.dataTask(with: url) {
|
||||||
(data, response, error) in
|
(data, response, error) in
|
||||||
completion(data, response, error)
|
completion(data, response, error)
|
||||||
|
|
|
@ -13,11 +13,11 @@ import AVFoundation
|
||||||
|
|
||||||
class NyanCatViewController: NSViewController , NSTouchBarDelegate{
|
class NyanCatViewController: NSViewController , NSTouchBarDelegate{
|
||||||
|
|
||||||
var audio_player: AVAudioPlayer?
|
@objc var audio_player: AVAudioPlayer?
|
||||||
|
|
||||||
@IBOutlet weak var muteBtn: NSButton!
|
@IBOutlet weak var muteBtn: NSButton!
|
||||||
//NOTE: I fucking love Swift's computed properties!
|
//NOTE: I fucking love Swift's computed properties!
|
||||||
var sound: Bool = true {
|
@objc var sound: Bool = true {
|
||||||
|
|
||||||
didSet{
|
didSet{
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ class NyanCatViewController: NSViewController , NSTouchBarDelegate{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var sound_btn_image_on: NSImage?
|
@objc var sound_btn_image_on: NSImage?
|
||||||
var sound_btn_image_off: NSImage?
|
@objc var sound_btn_image_off: NSImage?
|
||||||
|
|
||||||
@IBOutlet weak var sound_btn: NSButtonCell!
|
@IBOutlet weak var sound_btn: NSButtonCell!
|
||||||
@IBOutlet weak var bkg: NSView!
|
@IBOutlet weak var bkg: NSView!
|
||||||
|
@ -59,21 +59,21 @@ class NyanCatViewController: NSViewController , NSTouchBarDelegate{
|
||||||
|
|
||||||
bkg.layer?.backgroundColor = NSColor(red:0.08, green:0.31, blue:0.55, alpha:1.00).cgColor
|
bkg.layer?.backgroundColor = NSColor(red:0.08, green:0.31, blue:0.55, alpha:1.00).cgColor
|
||||||
|
|
||||||
sound_btn_image_on = NSImage(named: "ic_volume_up_3x.png")
|
sound_btn_image_on = NSImage(named: NSImage.Name(rawValue: "ic_volume_up_3x.png"))
|
||||||
sound_btn_image_off = NSImage(named: "ic_volume_off_3x.png")
|
sound_btn_image_off = NSImage(named: NSImage.Name(rawValue: "ic_volume_off_3x.png"))
|
||||||
|
|
||||||
|
|
||||||
// let nyan_music = URL(fileURLWithPath: Bundle.main.path(forResource: "nyan_music", ofType: "mp3")!)
|
let nyan_music = URL(fileURLWithPath: Bundle.main.path(forResource: "nyan_music", ofType: "mp3")!)
|
||||||
//
|
|
||||||
// do {
|
|
||||||
//
|
|
||||||
// try audio_player = AVAudioPlayer(contentsOf: nyan_music)
|
|
||||||
// audio_player?.numberOfLoops = -1
|
|
||||||
// audio_player?.prepareToPlay()
|
|
||||||
//
|
|
||||||
// }catch{}
|
|
||||||
|
|
||||||
//sound = true
|
do {
|
||||||
|
|
||||||
|
try audio_player = AVAudioPlayer(contentsOf: nyan_music)
|
||||||
|
audio_player?.numberOfLoops = -1
|
||||||
|
audio_player?.prepareToPlay()
|
||||||
|
|
||||||
|
}catch{}
|
||||||
|
|
||||||
|
sound = true
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
BIN
touchbar_nyancat/icon.png
Executable file
BIN
touchbar_nyancat/icon.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
touchbar_nyancat/nyan_music.mp3
Executable file
BIN
touchbar_nyancat/nyan_music.mp3
Executable file
Binary file not shown.
Loading…
Reference in a new issue