initial bits for dotBeatBar \o/

This commit is contained in:
Aaron Bieber 2019-07-26 21:44:43 -06:00
parent 7508a84f4d
commit f100218a41
5 changed files with 54 additions and 49 deletions

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 52;
objects = {
/* Begin PBXBuildFile section */
@ -13,6 +13,7 @@
9987EE2B22EBF09A00C95AC0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9987EE2922EBF09A00C95AC0 /* Main.storyboard */; };
9987EE3722EBF09A00C95AC0 /* dotBeatBar_oldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9987EE3622EBF09A00C95AC0 /* dotBeatBar_oldTests.swift */; };
9987EE4222EBF09A00C95AC0 /* dotBeatBar_oldUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9987EE4122EBF09A00C95AC0 /* dotBeatBar_oldUITests.swift */; };
9987EE5122EBF27F00C95AC0 /* Beat in Frameworks */ = {isa = PBXBuildFile; productRef = 9987EE5022EBF27F00C95AC0 /* Beat */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -53,6 +54,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9987EE5122EBF27F00C95AC0 /* Beat in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -140,6 +142,9 @@
dependencies = (
);
name = dotBeatBar_old;
packageProductDependencies = (
9987EE5022EBF27F00C95AC0 /* Beat */,
);
productName = dotBeatBar_old;
productReference = 9987EE2022EBF09900C95AC0 /* dotBeatBar_old.app */;
productType = "com.apple.product-type.application";
@ -212,6 +217,9 @@
Base,
);
mainGroup = 9987EE1722EBF09900C95AC0;
packageReferences = (
9987EE4F22EBF27F00C95AC0 /* XCRemoteSwiftPackageReference "Beat" */,
);
productRefGroup = 9987EE2122EBF09900C95AC0 /* Products */;
projectDirPath = "";
projectRoot = "";
@ -577,6 +585,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
9987EE4F22EBF27F00C95AC0 /* XCRemoteSwiftPackageReference "Beat" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/qbit/Beat";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.1;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
9987EE5022EBF27F00C95AC0 /* Beat */ = {
isa = XCSwiftPackageProductDependency;
package = 9987EE4F22EBF27F00C95AC0 /* XCRemoteSwiftPackageReference "Beat" */;
productName = Beat;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 9987EE1822EBF09900C95AC0 /* Project object */;
}

View File

@ -7,20 +7,31 @@
//
import Cocoa
import Beat
import Foundation
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var timer = Timer()
let si = NSStatusBar.system.statusItem(withLength:NSStatusItem.variableLength)
@objc func updateStatBar(_ sender: Any?) {
if let button = si.button {
button.title = "@\(Beat(Date().timeIntervalSince1970).text())"
}
}
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
updateStatBar(self)
timer = Timer.scheduledTimer(timeInterval: 60, target: self, selector: #selector(updateStatBar), userInfo: nil, repeats: true)
let menu = NSMenu()
menu.addItem(NSMenuItem(title: "Quit", action:
#selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
si.menu = menu
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
timer.invalidate()
}
}

View File

@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14835.7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14835.7"/>
</dependencies>
<scenes>
<!--Application-->
<scene sceneID="JPo-4y-FX3">
<objects>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="dotBeatBar_old" customModuleProvider="target"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<application id="hnw-xV-0zn" sceneMemberID="viewController">
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
@ -673,45 +676,8 @@
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider="target"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
</connections>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
</connections>
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
</document>

View File

@ -30,6 +30,8 @@
<string>NSApplication</string>
<key>NSSupportsAutomaticTermination</key>
<true/>
<key>LSUIElement</key>
<true/>
<key>NSSupportsSuddenTermination</key>
<true/>
</dict>

View File

@ -12,7 +12,6 @@ class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}