diff --git a/.gitignore.save b/.gitignore.save
index 0cb092b..7f8f8c4 100644
--- a/.gitignore.save
+++ b/.gitignore.save
@@ -21,6 +21,7 @@ xcuserdata/
*.moved-aside
*.xccheckout
*.xcscmblueprint
+
## Obj-C/Swift specific
*.hmap
*.ipa
@@ -31,49 +32,4 @@ xcuserdata/
timeline.xctimeline
playground.xcworkspace
-# Swift Package Manager
-#
-# Add this line if you want to avoid checking in source code from Swift Pac$
-# Packages/
-# Package.pins
-.build/
-# CocoaPods
-#
-# We recommend against adding the Pods directory to your .gitignore. However
-# you should judge for yourself, the pros and cons are mentioned at:
-# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-th$
-#
-# Xcode
-#
-# gitignore contributors: remember to update Global/Xcode.gitignore, Object$
-
-## Build generated
-build/
-DerivedData/
-.DS_Store
-## Various settings
-*.pbxuser
-!default.pbxuser
-*.mode1v3
-!default.mode1v3
-*.mode2v3
-!default.mode2v3
-*.perspectivev3
-!default.perspectivev3
-xcuserdata/
-
-## Other
-*.moved-aside
-*.xccheckout
-*.xcscmblueprint
-
-## Obj-C/Swift specific
-*.hmap
-*.ipa
-*.SYM.zip
-*.dSYM
-
-## Playgrounds
-timeline.xctimeline
-pla
diff --git a/Time Remaining.xcodeproj/project.pbxproj b/Time Remaining.xcodeproj/project.pbxproj
index 0a7dfc5..eeaf7e0 100644
--- a/Time Remaining.xcodeproj/project.pbxproj
+++ b/Time Remaining.xcodeproj/project.pbxproj
@@ -405,7 +405,7 @@
DEVELOPMENT_TEAM = K4W5TXF9ZA;
INFOPLIST_FILE = "Time Remaining/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = "calisma.Time-Remaining";
+ PRODUCT_BUNDLE_IDENTIFIER = "resoft.Time-Remaining";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
@@ -419,7 +419,7 @@
DEVELOPMENT_TEAM = K4W5TXF9ZA;
INFOPLIST_FILE = "Time Remaining/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = "calisma.Time-Remaining";
+ PRODUCT_BUNDLE_IDENTIFIER = "resoft.Time-Remaining";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
diff --git a/Time Remaining.xcodeproj/project.xcworkspace/xcuserdata/firat.xcuserdatad/UserInterfaceState.xcuserstate b/Time Remaining.xcodeproj/project.xcworkspace/xcuserdata/firat.xcuserdatad/UserInterfaceState.xcuserstate
index 643447a..3d4c122 100644
Binary files a/Time Remaining.xcodeproj/project.xcworkspace/xcuserdata/firat.xcuserdatad/UserInterfaceState.xcuserstate and b/Time Remaining.xcodeproj/project.xcworkspace/xcuserdata/firat.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/Time Remaining/AppDelegate.swift b/Time Remaining/AppDelegate.swift
index 3fa4b4f..da4e8be 100644
--- a/Time Remaining/AppDelegate.swift
+++ b/Time Remaining/AppDelegate.swift
@@ -3,25 +3,20 @@
// Time Remaining
//
// Created by Firat on 21/03/2017.
-// Copyright © 2017 calisma. All rights reserved.
+// Copyright © 2017 resoft. All rights reserved.
//
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
-
-
-
+
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
-
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
-
-
}
diff --git a/Time Remaining/MainMenu.xib b/Time Remaining/MainMenu.xib
index c35447c..a81a664 100755
--- a/Time Remaining/MainMenu.xib
+++ b/Time Remaining/MainMenu.xib
@@ -37,7 +37,7 @@
-
+
diff --git a/Time Remaining/StatusMenuController.swift b/Time Remaining/StatusMenuController.swift
index 8808a27..3c3961b 100644
--- a/Time Remaining/StatusMenuController.swift
+++ b/Time Remaining/StatusMenuController.swift
@@ -3,7 +3,7 @@
// Time Remaining
//
// Created by Firat on 21/03/2017.
-// Copyright © 2017 calisma. All rights reserved.
+// Copyright © 2017 resoft. All rights reserved.
//
import Cocoa
@@ -11,8 +11,7 @@ import Foundation
import IOKit
class StatusMenuController: NSObject {
-
-
+
@IBOutlet weak var statusMenu: NSMenu!
let statusItem = NSStatusBar.system().statusItem(withLength: NSVariableStatusItemLength)
@@ -21,22 +20,25 @@ class StatusMenuController: NSObject {
}
override func awakeFromNib() {
- statusItem.menu?.font = NSFont(name: "Monaco", size: 3)
+ statusItem.menu?.font = NSFont(name: "Monaco", size: 12)
statusItem.menu = statusMenu
+ self.updateTime()
+ Timer.scheduledTimer(timeInterval: 60.0, target: self, selector: #selector(StatusMenuController.updateTime), userInfo: nil, repeats: true)
+ }
+
+ func updateTime() {
statusItem.title = getBatteryState()
-
}
- @IBAction func updateTimeRemaining(_ sender: NSMenuItem) {
+
+ @IBAction func updateTimeRemaining(_ sender: Any) {
statusItem.title = getBatteryState()
}
+
@IBAction func quit(_ sender: NSMenuItem) {
NSApplication.shared().terminate(self)
-
}
-
- func getBatteryState() -> String
- {
+ func getBatteryState() -> String {
let task = Process()
let pipe = Pipe()
task.launchPath = "/usr/bin/pmset"
@@ -52,12 +54,12 @@ class StatusMenuController: NSObject {
let state = batteryArray[1].trimmingCharacters(in: NSCharacterSet.whitespaces).capitalized
// let percent = String.init(batteryArray[0].components(separatedBy: ")")[1].trimmingCharacters(in: NSCharacterSet.whitespaces).characters.dropLast())
var remaining = String.init(batteryArray[2].characters.dropFirst().split(separator: " ")[0])
- if(remaining == "(no"){
+ if remaining == "(no" {
remaining = "Calculating"
}
// return "%" + percent + "\n" + remaining + " " + state
- return state + " " + remaining
+ return state + ", " + remaining
}
}