mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 17:08:39 +00:00
#1 Now we already live in strip
#2 Added Volume and ESC buttons (volume via appleScript)
This commit is contained in:
parent
32232fcbb1
commit
b3ab0423b7
@ -7,12 +7,16 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
B059D622205E03F5006E6B86 /* TouchBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B059D621205E03F5006E6B86 /* TouchBarController.swift */; };
|
||||||
|
B059D624205E04F3006E6B86 /* TouchBarItems.swift in Sources */ = {isa = PBXBuildFile; fileRef = B059D623205E04F3006E6B86 /* TouchBarItems.swift */; };
|
||||||
|
B059D62D205F11E8006E6B86 /* DFRFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B059D62C205F11E8006E6B86 /* DFRFoundation.framework */; };
|
||||||
B082B253205C7D8000BC04DC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B252205C7D8000BC04DC /* AppDelegate.swift */; };
|
B082B253205C7D8000BC04DC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B252205C7D8000BC04DC /* AppDelegate.swift */; };
|
||||||
B082B255205C7D8000BC04DC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B254205C7D8000BC04DC /* ViewController.swift */; };
|
B082B255205C7D8000BC04DC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B254205C7D8000BC04DC /* ViewController.swift */; };
|
||||||
B082B257205C7D8000BC04DC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B082B256205C7D8000BC04DC /* Assets.xcassets */; };
|
B082B257205C7D8000BC04DC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B082B256205C7D8000BC04DC /* Assets.xcassets */; };
|
||||||
B082B25A205C7D8000BC04DC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B082B258205C7D8000BC04DC /* Main.storyboard */; };
|
B082B25A205C7D8000BC04DC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B082B258205C7D8000BC04DC /* Main.storyboard */; };
|
||||||
B082B266205C7D8000BC04DC /* MTMRTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B265205C7D8000BC04DC /* MTMRTests.swift */; };
|
B082B266205C7D8000BC04DC /* MTMRTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B265205C7D8000BC04DC /* MTMRTests.swift */; };
|
||||||
B082B271205C7D8000BC04DC /* MTMRUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B270205C7D8000BC04DC /* MTMRUITests.swift */; };
|
B082B271205C7D8000BC04DC /* MTMRUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B270205C7D8000BC04DC /* MTMRUITests.swift */; };
|
||||||
|
B0A7E9AA205D6AA400EEF070 /* KeyPress.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0A7E9A9205D6AA400EEF070 /* KeyPress.swift */; };
|
||||||
B0C1CFCA205C97D30021C862 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C1CFC9205C97D30021C862 /* WindowController.swift */; };
|
B0C1CFCA205C97D30021C862 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C1CFC9205C97D30021C862 /* WindowController.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@ -34,6 +38,11 @@
|
|||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
B059D621205E03F5006E6B86 /* TouchBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarController.swift; sourceTree = "<group>"; };
|
||||||
|
B059D623205E04F3006E6B86 /* TouchBarItems.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchBarItems.swift; sourceTree = "<group>"; };
|
||||||
|
B059D629205E13E5006E6B86 /* TouchBarPrivateApi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TouchBarPrivateApi.h; sourceTree = "<group>"; };
|
||||||
|
B059D62A205F0E7D006E6B86 /* TouchBarPrivateApi-Bridging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TouchBarPrivateApi-Bridging.h"; sourceTree = "<group>"; };
|
||||||
|
B059D62C205F11E8006E6B86 /* DFRFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DFRFoundation.framework; path = ../../../../../System/Library/PrivateFrameworks/DFRFoundation.framework; sourceTree = "<group>"; };
|
||||||
B082B24F205C7D8000BC04DC /* MTMR.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MTMR.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
B082B24F205C7D8000BC04DC /* MTMR.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MTMR.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B082B252205C7D8000BC04DC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
B082B252205C7D8000BC04DC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
B082B254205C7D8000BC04DC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
B082B254205C7D8000BC04DC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||||
@ -47,6 +56,7 @@
|
|||||||
B082B26C205C7D8000BC04DC /* MTMRUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MTMRUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
B082B26C205C7D8000BC04DC /* MTMRUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MTMRUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B082B270205C7D8000BC04DC /* MTMRUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MTMRUITests.swift; sourceTree = "<group>"; };
|
B082B270205C7D8000BC04DC /* MTMRUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MTMRUITests.swift; sourceTree = "<group>"; };
|
||||||
B082B272205C7D8000BC04DC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
B082B272205C7D8000BC04DC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
B0A7E9A9205D6AA400EEF070 /* KeyPress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyPress.swift; sourceTree = "<group>"; };
|
||||||
B0C1CFC9205C97D30021C862 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WindowController.swift; path = ../WindowController.swift; sourceTree = "<group>"; };
|
B0C1CFC9205C97D30021C862 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WindowController.swift; path = ../WindowController.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@ -55,6 +65,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
B059D62D205F11E8006E6B86 /* DFRFoundation.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -75,6 +86,14 @@
|
|||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
B059D62B205F11E8006E6B86 /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
B059D62C205F11E8006E6B86 /* DFRFoundation.framework */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
B082B246205C7D8000BC04DC = {
|
B082B246205C7D8000BC04DC = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -82,6 +101,7 @@
|
|||||||
B082B264205C7D8000BC04DC /* MTMRTests */,
|
B082B264205C7D8000BC04DC /* MTMRTests */,
|
||||||
B082B26F205C7D8000BC04DC /* MTMRUITests */,
|
B082B26F205C7D8000BC04DC /* MTMRUITests */,
|
||||||
B082B250205C7D8000BC04DC /* Products */,
|
B082B250205C7D8000BC04DC /* Products */,
|
||||||
|
B059D62B205F11E8006E6B86 /* Frameworks */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@ -98,10 +118,15 @@
|
|||||||
B082B251205C7D8000BC04DC /* MTMR */ = {
|
B082B251205C7D8000BC04DC /* MTMR */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
B0C1CFC9205C97D30021C862 /* WindowController.swift */,
|
||||||
|
B059D629205E13E5006E6B86 /* TouchBarPrivateApi.h */,
|
||||||
|
B059D62A205F0E7D006E6B86 /* TouchBarPrivateApi-Bridging.h */,
|
||||||
B082B252205C7D8000BC04DC /* AppDelegate.swift */,
|
B082B252205C7D8000BC04DC /* AppDelegate.swift */,
|
||||||
B082B254205C7D8000BC04DC /* ViewController.swift */,
|
B082B254205C7D8000BC04DC /* ViewController.swift */,
|
||||||
B0C1CFC9205C97D30021C862 /* WindowController.swift */,
|
|
||||||
B082B256205C7D8000BC04DC /* Assets.xcassets */,
|
B082B256205C7D8000BC04DC /* Assets.xcassets */,
|
||||||
|
B0A7E9A9205D6AA400EEF070 /* KeyPress.swift */,
|
||||||
|
B059D623205E04F3006E6B86 /* TouchBarItems.swift */,
|
||||||
|
B059D621205E03F5006E6B86 /* TouchBarController.swift */,
|
||||||
B082B258205C7D8000BC04DC /* Main.storyboard */,
|
B082B258205C7D8000BC04DC /* Main.storyboard */,
|
||||||
B082B25B205C7D8000BC04DC /* Info.plist */,
|
B082B25B205C7D8000BC04DC /* Info.plist */,
|
||||||
B082B25C205C7D8000BC04DC /* MTMR.entitlements */,
|
B082B25C205C7D8000BC04DC /* MTMR.entitlements */,
|
||||||
@ -260,9 +285,12 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
B059D622205E03F5006E6B86 /* TouchBarController.swift in Sources */,
|
||||||
B082B255205C7D8000BC04DC /* ViewController.swift in Sources */,
|
B082B255205C7D8000BC04DC /* ViewController.swift in Sources */,
|
||||||
B0C1CFCA205C97D30021C862 /* WindowController.swift in Sources */,
|
B0C1CFCA205C97D30021C862 /* WindowController.swift in Sources */,
|
||||||
B082B253205C7D8000BC04DC /* AppDelegate.swift in Sources */,
|
B082B253205C7D8000BC04DC /* AppDelegate.swift in Sources */,
|
||||||
|
B059D624205E04F3006E6B86 /* TouchBarItems.swift in Sources */,
|
||||||
|
B0A7E9AA205D6AA400EEF070 /* KeyPress.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -423,10 +451,15 @@
|
|||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
DEVELOPMENT_TEAM = D6D8BR2QNB;
|
DEVELOPMENT_TEAM = D6D8BR2QNB;
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
|
||||||
|
);
|
||||||
INFOPLIST_FILE = MTMR/Info.plist;
|
INFOPLIST_FILE = MTMR/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = Toxblh.MTMR;
|
PRODUCT_BUNDLE_IDENTIFIER = Toxblh.MTMR;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_OBJC_BRIDGING_HEADER = "MTMR/TouchBarPrivateApi-Bridging.h";
|
||||||
SWIFT_VERSION = 4.0;
|
SWIFT_VERSION = 4.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@ -439,10 +472,15 @@
|
|||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
DEVELOPMENT_TEAM = D6D8BR2QNB;
|
DEVELOPMENT_TEAM = D6D8BR2QNB;
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
|
||||||
|
);
|
||||||
INFOPLIST_FILE = MTMR/Info.plist;
|
INFOPLIST_FILE = MTMR/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = Toxblh.MTMR;
|
PRODUCT_BUNDLE_IDENTIFIER = Toxblh.MTMR;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_OBJC_BRIDGING_HEADER = "MTMR/TouchBarPrivateApi-Bridging.h";
|
||||||
SWIFT_VERSION = 4.0;
|
SWIFT_VERSION = 4.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
|
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||||
|
TouchBarController.shared.setupControlStripPresence()
|
||||||
// Insert code here to initialize your application
|
// Insert code here to initialize your application
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
6
MTMR/Assets.xcassets/Contents.json
Normal file
6
MTMR/Assets.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
21
MTMR/Assets.xcassets/Strip.imageset/Contents.json
vendored
Normal file
21
MTMR/Assets.xcassets/Strip.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "mtmrIcon.pdf",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
MTMR/Assets.xcassets/Strip.imageset/mtmrIcon.pdf
vendored
Normal file
BIN
MTMR/Assets.xcassets/Strip.imageset/mtmrIcon.pdf
vendored
Normal file
Binary file not shown.
@ -1,10 +1,8 @@
|
|||||||
<?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="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaDFRPlugin" version="13752"/>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
|
||||||
<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.2" requiredIntegratedClassName="NSTouchBar"/>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--Application-->
|
<!--Application-->
|
||||||
@ -695,92 +693,7 @@
|
|||||||
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
|
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
|
||||||
</connections>
|
</connections>
|
||||||
</window>
|
</window>
|
||||||
<touchBar key="touchBar" id="KGL-kc-E9i">
|
|
||||||
<touchBarItems>
|
|
||||||
<touchBarItem id="3Do-Il-Q1x">
|
|
||||||
<viewController key="viewController" id="OCg-jd-s21">
|
|
||||||
<button key="view" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vvP-5H-1Yg">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="78" height="30"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
||||||
<buttonCell key="cell" type="push" title="Br-" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="2er-8P-5gB">
|
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
||||||
<font key="font" usesAppearanceFont="YES"/>
|
|
||||||
</buttonCell>
|
|
||||||
<connections>
|
|
||||||
<action selector="brightDown:" target="B8D-0N-5wS" id="wuk-7q-qeV"/>
|
|
||||||
</connections>
|
|
||||||
</button>
|
|
||||||
</viewController>
|
|
||||||
<size key="designTimeSize" width="78" height="30"/>
|
|
||||||
</touchBarItem>
|
|
||||||
<touchBarItem id="Rzo-4M-1wA">
|
|
||||||
<viewController key="viewController" id="IuE-pb-gUk">
|
|
||||||
<button key="view" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2r0-2P-mnY">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="72" height="30"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
||||||
<buttonCell key="cell" type="push" title="Br+" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="pIW-fA-W4y">
|
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
||||||
<font key="font" usesAppearanceFont="YES"/>
|
|
||||||
</buttonCell>
|
|
||||||
<connections>
|
|
||||||
<action selector="brightUp:" target="B8D-0N-5wS" id="c7w-Z9-PzQ"/>
|
|
||||||
</connections>
|
|
||||||
</button>
|
|
||||||
</viewController>
|
|
||||||
<size key="designTimeSize" width="72" height="30"/>
|
|
||||||
</touchBarItem>
|
|
||||||
<touchBarSpacerItem identifier="NSTouchBarItemIdentifierFlexibleSpace" id="OX4-WR-RJ9"/>
|
|
||||||
<touchBarTextViewItem identifier="NSTouchBarItemIdentifierCharacterPicker" id="w5M-Xs-LTe"/>
|
|
||||||
<touchBarItem id="isc-Lf-YUm">
|
|
||||||
<viewController key="viewController" id="mQc-tv-gz0">
|
|
||||||
<button key="view" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Whf-MB-0a6">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="90" height="30"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
||||||
<buttonCell key="cell" type="push" title="V-" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="xxU-x6-QNC">
|
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
||||||
<font key="font" usesAppearanceFont="YES"/>
|
|
||||||
<connections>
|
|
||||||
<action selector="volumeDown:" target="B8D-0N-5wS" id="Lr3-0y-KOi"/>
|
|
||||||
</connections>
|
|
||||||
</buttonCell>
|
|
||||||
</button>
|
|
||||||
</viewController>
|
|
||||||
<size key="designTimeSize" width="90" height="30"/>
|
|
||||||
</touchBarItem>
|
|
||||||
<touchBarItem id="2DJ-1v-Ouf">
|
|
||||||
<viewController key="viewController" id="dZv-qg-JOF">
|
|
||||||
<button key="view" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="35m-sH-wKn">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="72" height="30"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
|
||||||
<buttonCell key="cell" type="push" title="V+" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="R7V-bf-Xfp">
|
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
|
||||||
<font key="font" usesAppearanceFont="YES"/>
|
|
||||||
</buttonCell>
|
|
||||||
<connections>
|
|
||||||
<action selector="volumeUp:" target="B8D-0N-5wS" id="OiI-yp-f57"/>
|
|
||||||
</connections>
|
|
||||||
</button>
|
|
||||||
</viewController>
|
|
||||||
<size key="designTimeSize" width="72" height="30"/>
|
|
||||||
</touchBarItem>
|
|
||||||
<touchBarItem id="7cd-7x-dM6">
|
|
||||||
<viewController key="viewController" id="x4N-uo-h50">
|
|
||||||
<textField key="view" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ON1-ps-5VI">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="46" height="24"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<textFieldCell key="cell" borderStyle="bezel" alignment="left" title="time" drawsBackground="YES" id="kEu-LJ-2nz">
|
|
||||||
<font key="font" usesAppearanceFont="YES"/>
|
|
||||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
|
||||||
</textFieldCell>
|
|
||||||
</textField>
|
|
||||||
</viewController>
|
|
||||||
<size key="designTimeSize" width="46" height="24"/>
|
|
||||||
</touchBarItem>
|
|
||||||
</touchBarItems>
|
|
||||||
</touchBar>
|
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="timeLabel" destination="ON1-ps-5VI" id="fLx-xf-WcI"/>
|
|
||||||
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
|
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
|
||||||
</connections>
|
</connections>
|
||||||
</windowController>
|
</windowController>
|
||||||
@ -793,13 +706,24 @@
|
|||||||
<objects>
|
<objects>
|
||||||
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="MTMR" customModuleProvider="target" sceneMemberID="viewController">
|
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="MTMR" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
|
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
<rect key="frame" x="0.0" y="0.0" width="178" height="57"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<subviews>
|
||||||
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bso-ZY-Qqn">
|
||||||
|
<rect key="frame" x="18" y="20" width="142" height="17"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="My TouchBar. My rules" id="cmP-Ef-Jrj">
|
||||||
|
<font key="font" metaFont="system"/>
|
||||||
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
</textField>
|
||||||
|
</subviews>
|
||||||
</view>
|
</view>
|
||||||
</viewController>
|
</viewController>
|
||||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="75" y="655"/>
|
<point key="canvasLocation" x="74" y="613"/>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
30
MTMR/KeyPress.swift
Normal file
30
MTMR/KeyPress.swift
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// KeyPress.swift
|
||||||
|
// MTMR
|
||||||
|
//
|
||||||
|
// Created by Anton Palgunov on 17/03/2018.
|
||||||
|
// Copyright © 2018 Anton Palgunov. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
func KeyPress (keyCode: CGKeyCode) {
|
||||||
|
let keyDown = CGEvent(keyboardEventSource: nil, virtualKey: keyCode, keyDown: true)
|
||||||
|
let keyUp = CGEvent(keyboardEventSource: nil, virtualKey: keyCode, keyDown: false)
|
||||||
|
|
||||||
|
keyDown?.post(tap: .cghidEventTap)
|
||||||
|
keyUp?.post(tap: .cghidEventTap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ESCKeyPress() {
|
||||||
|
KeyPress(keyCode: 53)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BrightnessUpPress() {
|
||||||
|
KeyPress(keyCode: 107)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BrightnessDownPress() {
|
||||||
|
KeyPress(keyCode: 113)
|
||||||
|
}
|
||||||
103
MTMR/TouchBarController.swift
Normal file
103
MTMR/TouchBarController.swift
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//
|
||||||
|
// TouchBar.swift
|
||||||
|
// MTMR
|
||||||
|
//
|
||||||
|
// Created by Anton Palgunov on 18/03/2018.
|
||||||
|
// Copyright © 2018 Anton Palgunov. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Cocoa
|
||||||
|
|
||||||
|
class TouchBarController: NSObject, NSTouchBarDelegate {
|
||||||
|
|
||||||
|
static let shared = TouchBarController()
|
||||||
|
|
||||||
|
let touchBar = NSTouchBar()
|
||||||
|
|
||||||
|
private override init() {
|
||||||
|
super.init()
|
||||||
|
touchBar.delegate = self
|
||||||
|
touchBar.defaultItemIdentifiers = [.escButton, .volumeUp, .volumeDown, .time, .preferences]
|
||||||
|
self.presentTouchBar()
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupControlStripPresence() {
|
||||||
|
DFRSystemModalShowsCloseBoxWhenFrontMost(true)
|
||||||
|
let item = NSCustomTouchBarItem(identifier: .controlStripItem)
|
||||||
|
item.view = NSButton(image: #imageLiteral(resourceName: "Strip"), target: self, action: #selector(presentTouchBar))
|
||||||
|
NSTouchBarItem.addSystemTrayItem(item)
|
||||||
|
DFRElementSetControlStripPresenceForIdentifier(.controlStripItem, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateControlStripPresence() {
|
||||||
|
DFRElementSetControlStripPresenceForIdentifier(.controlStripItem, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func presentTouchBar() {
|
||||||
|
NSTouchBar.presentSystemModalFunctionBar(touchBar, systemTrayItemIdentifier: .controlStripItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func dismissTouchBar() {
|
||||||
|
NSTouchBar.minimizeSystemModalFunctionBar(touchBar)
|
||||||
|
}
|
||||||
|
|
||||||
|
func touchBar(_ touchBar: NSTouchBar, makeItemForIdentifier identifier: NSTouchBarItem.Identifier) -> NSTouchBarItem? {
|
||||||
|
switch identifier {
|
||||||
|
case .escButton:
|
||||||
|
let item = NSCustomTouchBarItem(identifier: identifier)
|
||||||
|
item.view = NSButton(title: "ESC", target: self, action: #selector(handleEsc))
|
||||||
|
return item
|
||||||
|
case .volumeDown:
|
||||||
|
let item = NSCustomTouchBarItem(identifier: identifier)
|
||||||
|
item.view = NSButton(title: "V-", target: self, action: #selector(handleVolumeDown))
|
||||||
|
return item
|
||||||
|
case .volumeUp:
|
||||||
|
let item = NSCustomTouchBarItem(identifier: identifier)
|
||||||
|
item.view = NSButton(title: "V+", target: self, action: #selector(handleVolumeUp))
|
||||||
|
return item
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func handleEsc() {
|
||||||
|
ESCKeyPress()
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func handleVolumeUp() {
|
||||||
|
self.volume(directon: "up")
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func handleVolumeDown() {
|
||||||
|
self.volume(directon: "down")
|
||||||
|
}
|
||||||
|
|
||||||
|
func volume(directon: String) {
|
||||||
|
var myAppleScript = "set volume output volume (output volume of (get volume settings) - 5)"
|
||||||
|
|
||||||
|
if (directon == "up") {
|
||||||
|
myAppleScript = "set volume output volume (output volume of (get volume settings) + 5)"
|
||||||
|
}
|
||||||
|
|
||||||
|
var error: NSDictionary?
|
||||||
|
if let scriptObject = NSAppleScript(source: myAppleScript) {
|
||||||
|
let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error)
|
||||||
|
|
||||||
|
print(output.stringValue as Any)
|
||||||
|
|
||||||
|
if (error != nil) {
|
||||||
|
print("error: \(String(describing: error))")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func brightness(directon: String) {
|
||||||
|
if (directon == "up") {
|
||||||
|
BrightnessUpPress()
|
||||||
|
print("BR - Up")
|
||||||
|
} else {
|
||||||
|
BrightnessDownPress()
|
||||||
|
print("BR - Down")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
MTMR/TouchBarItems.swift
Normal file
19
MTMR/TouchBarItems.swift
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// TouchBarItems.swift
|
||||||
|
// MTMR
|
||||||
|
//
|
||||||
|
// Created by Anton Palgunov on 18/03/2018.
|
||||||
|
// Copyright © 2018 Anton Palgunov. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Cocoa
|
||||||
|
|
||||||
|
extension NSTouchBarItem.Identifier {
|
||||||
|
static let escButton = NSTouchBarItem.Identifier("com.toxblh.mtmr.escButton")
|
||||||
|
static let time = NSTouchBarItem.Identifier("com.toxblh.mtmr.time")
|
||||||
|
static let volumeUp = NSTouchBarItem.Identifier("com.toxblh.mtmr.volumeUp")
|
||||||
|
static let volumeDown = NSTouchBarItem.Identifier("com.toxblh.mtmr.volumeDown")
|
||||||
|
static let preferences = NSTouchBarItem.Identifier("com.toxblh.mtmr.preferences")
|
||||||
|
|
||||||
|
static let controlStripItem = NSTouchBarItem.Identifier("com.toxblh.mtmr.controlStrip")
|
||||||
|
}
|
||||||
9
MTMR/TouchBarPrivateApi-Bridging.h
Normal file
9
MTMR/TouchBarPrivateApi-Bridging.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//
|
||||||
|
// TouchBarPrivateApi-Bridging.h
|
||||||
|
// MTMR
|
||||||
|
//
|
||||||
|
// Created by Anton Palgunov on 18/03/2018.
|
||||||
|
// Copyright © 2018 Anton Palgunov. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "TouchBarPrivateApi.h"
|
||||||
27
MTMR/TouchBarPrivateApi.h
Normal file
27
MTMR/TouchBarPrivateApi.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
extern void DFRElementSetControlStripPresenceForIdentifier(NSTouchBarItemIdentifier, BOOL);
|
||||||
|
|
||||||
|
extern void DFRSystemModalShowsCloseBoxWhenFrontMost(BOOL);
|
||||||
|
|
||||||
|
@interface NSTouchBarItem (PrivateMethods)
|
||||||
|
|
||||||
|
+ (void)addSystemTrayItem:(NSTouchBarItem *)item;
|
||||||
|
|
||||||
|
+ (void)removeSystemTrayItem:(NSTouchBarItem *)item;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSTouchBar (PrivateMethods)
|
||||||
|
|
||||||
|
// presentSystemModalFunctionBar:placement:systemTrayItemIdentifier:
|
||||||
|
+ (void)presentSystemModalFunctionBar:(NSTouchBar *)touchBar placement:(long long)placement systemTrayItemIdentifier:(NSTouchBarItemIdentifier)identifier;
|
||||||
|
|
||||||
|
+ (void)presentSystemModalFunctionBar:(NSTouchBar *)touchBar systemTrayItemIdentifier:(NSTouchBarItemIdentifier)identifier;
|
||||||
|
|
||||||
|
+ (void)dismissSystemModalFunctionBar:(NSTouchBar *)touchBar;
|
||||||
|
|
||||||
|
+ (void)minimizeSystemModalFunctionBar:(NSTouchBar *)touchBar;
|
||||||
|
|
||||||
|
@end
|
||||||
16
README.md
16
README.md
@ -1 +1,17 @@
|
|||||||
|
<p align="center">
|
||||||
|
<img src="Resources/logo.png" width="120">
|
||||||
|
</p>
|
||||||
|
|
||||||
# My TouchBar. My rules
|
# My TouchBar. My rules
|
||||||
|
|
||||||
|
My the idea is to create the program like a platform for plugins for customization TouchBar. I very like BTT and a full custom TouchBar. And I want to create it. And it's my the first Swift project for MacOS :)
|
||||||
|
|
||||||
|
### Roadmap
|
||||||
|
- [x] Create the first prototype with TouchBar in Storyboard
|
||||||
|
- [x] Put in stripe menu on startup the application
|
||||||
|
- [ ] Find how to simulate real buttons like brightness, volume, night shift and etc.
|
||||||
|
- [ ] First the weather plugin
|
||||||
|
- [ ] Create the same panel like in my [BTT preset](https://github.com/Toxblh/btt-touchbar-preset)
|
||||||
|
- [ ] Find how to open full-screen TouchBar without the cross and stripe menu
|
||||||
|
- [ ] Find how to add haptic feedback
|
||||||
|
- [ ] Refactoring the application on packages (AppleScript, JavaScript? and Swift?)
|
||||||
|
|||||||
BIN
Resources/MTMRicon.sketch
Normal file
BIN
Resources/MTMRicon.sketch
Normal file
Binary file not shown.
BIN
Resources/logo.png
Normal file
BIN
Resources/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
@ -10,73 +10,8 @@ import Cocoa
|
|||||||
|
|
||||||
class WindowController: NSWindowController {
|
class WindowController: NSWindowController {
|
||||||
|
|
||||||
func volume(directon: String) {
|
|
||||||
var myAppleScript = "set volume output volume (output volume of (get volume settings) - 5)"
|
|
||||||
|
|
||||||
if (directon == "up") {
|
|
||||||
myAppleScript = "set volume output volume (output volume of (get volume settings) + 5)"
|
|
||||||
}
|
|
||||||
|
|
||||||
var error: NSDictionary?
|
|
||||||
if let scriptObject = NSAppleScript(source: myAppleScript) {
|
|
||||||
if let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(
|
|
||||||
&error) {
|
|
||||||
print(output.stringValue as Any)
|
|
||||||
} else if (error != nil) {
|
|
||||||
print("error: \(String(describing: error))")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func brightness(directon: String) {
|
|
||||||
let CodeUp: UInt16 = 107
|
|
||||||
let CodeDown: UInt16 = 113
|
|
||||||
let src = CGEventSource(stateID: .hidSystemState)
|
|
||||||
|
|
||||||
let upd = CGEvent(keyboardEventSource: src, virtualKey: CodeUp, keyDown: true)
|
|
||||||
let upu = CGEvent(keyboardEventSource: src, virtualKey: CodeUp, keyDown: false)
|
|
||||||
let downd = CGEvent(keyboardEventSource: src, virtualKey: CodeDown, keyDown: true)
|
|
||||||
let downu = CGEvent(keyboardEventSource: src, virtualKey: CodeDown, keyDown: false)
|
|
||||||
|
|
||||||
let loc = CGEventTapLocation.cghidEventTap
|
|
||||||
|
|
||||||
if (directon == "up") {
|
|
||||||
upd?.post(tap: loc)
|
|
||||||
upu?.post(tap: loc)
|
|
||||||
print(CodeUp)
|
|
||||||
} else {
|
|
||||||
downd?.post(tap: loc)
|
|
||||||
downu?.post(tap: loc)
|
|
||||||
print(CodeDown)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@IBAction func brightUp(_ sender: Any) {
|
|
||||||
NSHapticFeedbackManager.defaultPerformer.perform(.generic, performanceTime: .now)
|
|
||||||
brightness(directon: "up")
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func brightDown(_ sender: Any) {
|
|
||||||
NSHapticFeedbackManager.defaultPerformer.perform(.alignment, performanceTime: .now)
|
|
||||||
brightness(directon: "down")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@IBAction func volumeUp(_ sender: Any) {
|
|
||||||
NSHapticFeedbackManager.defaultPerformer.perform(.levelChange, performanceTime: .now);
|
|
||||||
self.volume(directon: "up")
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func volumeDown(_ sender: Any) {
|
|
||||||
NSHapticFeedbackManager.defaultPerformer.perform(.generic, performanceTime: .now)
|
|
||||||
self.volume(directon: "down")
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBOutlet weak var timeLabel: NSTextField!
|
|
||||||
|
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
super.windowDidLoad()
|
super.windowDidLoad()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user