mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2026-03-25 13:40:08 +01:00
✨ Fix issue with $PATH, adds boot checks
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
phpmon.xcodeproj/project.xcworkspace
|
phpmon.xcodeproj/project.xcworkspace
|
||||||
|
phpmon.xcodeproj/xcuserdata
|
||||||
|
|||||||
@@ -13,8 +13,10 @@
|
|||||||
C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3C22B0098000E7CF16 /* Main.storyboard */; };
|
C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3C22B0098000E7CF16 /* Main.storyboard */; };
|
||||||
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4622B009A400E7CF16 /* Shell.swift */; };
|
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4622B009A400E7CF16 /* Shell.swift */; };
|
||||||
C41C1B4922B00A9800E7CF16 /* ImageGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4822B00A9800E7CF16 /* ImageGenerator.swift */; };
|
C41C1B4922B00A9800E7CF16 /* ImageGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4822B00A9800E7CF16 /* ImageGenerator.swift */; };
|
||||||
C41C1B4B22B019FF00E7CF16 /* PhpVersionExtractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4A22B019FF00E7CF16 /* PhpVersionExtractor.swift */; };
|
C41C1B4B22B019FF00E7CF16 /* PHPVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4A22B019FF00E7CF16 /* PHPVersion.swift */; };
|
||||||
C41C1B4D22B0215A00E7CF16 /* Services.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4C22B0215A00E7CF16 /* Services.swift */; };
|
C41C1B4D22B0215A00E7CF16 /* Services.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4C22B0215A00E7CF16 /* Services.swift */; };
|
||||||
|
C476FF9822B0DD830098105B /* Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476FF9722B0DD830098105B /* Alert.swift */; };
|
||||||
|
C4D8016622B1584700C6DA1B /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4D8016522B1584700C6DA1B /* Environment.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -27,8 +29,10 @@
|
|||||||
C41C1B4022B0098000E7CF16 /* phpmon.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = phpmon.entitlements; sourceTree = "<group>"; };
|
C41C1B4022B0098000E7CF16 /* phpmon.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = phpmon.entitlements; sourceTree = "<group>"; };
|
||||||
C41C1B4622B009A400E7CF16 /* Shell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shell.swift; sourceTree = "<group>"; };
|
C41C1B4622B009A400E7CF16 /* Shell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shell.swift; sourceTree = "<group>"; };
|
||||||
C41C1B4822B00A9800E7CF16 /* ImageGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageGenerator.swift; sourceTree = "<group>"; };
|
C41C1B4822B00A9800E7CF16 /* ImageGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageGenerator.swift; sourceTree = "<group>"; };
|
||||||
C41C1B4A22B019FF00E7CF16 /* PhpVersionExtractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpVersionExtractor.swift; sourceTree = "<group>"; };
|
C41C1B4A22B019FF00E7CF16 /* PHPVersion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PHPVersion.swift; sourceTree = "<group>"; };
|
||||||
C41C1B4C22B0215A00E7CF16 /* Services.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Services.swift; sourceTree = "<group>"; };
|
C41C1B4C22B0215A00E7CF16 /* Services.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Services.swift; sourceTree = "<group>"; };
|
||||||
|
C476FF9722B0DD830098105B /* Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Alert.swift; sourceTree = "<group>"; };
|
||||||
|
C4D8016522B1584700C6DA1B /* Environment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Environment.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -77,8 +81,10 @@
|
|||||||
children = (
|
children = (
|
||||||
C41C1B4622B009A400E7CF16 /* Shell.swift */,
|
C41C1B4622B009A400E7CF16 /* Shell.swift */,
|
||||||
C41C1B4822B00A9800E7CF16 /* ImageGenerator.swift */,
|
C41C1B4822B00A9800E7CF16 /* ImageGenerator.swift */,
|
||||||
C41C1B4A22B019FF00E7CF16 /* PhpVersionExtractor.swift */,
|
C41C1B4A22B019FF00E7CF16 /* PHPVersion.swift */,
|
||||||
C41C1B4C22B0215A00E7CF16 /* Services.swift */,
|
C41C1B4C22B0215A00E7CF16 /* Services.swift */,
|
||||||
|
C476FF9722B0DD830098105B /* Alert.swift */,
|
||||||
|
C4D8016522B1584700C6DA1B /* Environment.swift */,
|
||||||
);
|
);
|
||||||
path = Helpers;
|
path = Helpers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -153,12 +159,14 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
C4D8016622B1584700C6DA1B /* Environment.swift in Sources */,
|
||||||
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */,
|
C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */,
|
||||||
C41C1B4D22B0215A00E7CF16 /* Services.swift in Sources */,
|
C41C1B4D22B0215A00E7CF16 /* Services.swift in Sources */,
|
||||||
C41C1B4922B00A9800E7CF16 /* ImageGenerator.swift in Sources */,
|
C41C1B4922B00A9800E7CF16 /* ImageGenerator.swift in Sources */,
|
||||||
C41C1B3922B0097F00E7CF16 /* ViewController.swift in Sources */,
|
C41C1B3922B0097F00E7CF16 /* ViewController.swift in Sources */,
|
||||||
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */,
|
C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */,
|
||||||
C41C1B4B22B019FF00E7CF16 /* PhpVersionExtractor.swift in Sources */,
|
C41C1B4B22B019FF00E7CF16 /* PHPVersion.swift in Sources */,
|
||||||
|
C476FF9822B0DD830098105B /* Alert.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,26 +11,41 @@ import Cocoa
|
|||||||
@NSApplicationMain
|
@NSApplicationMain
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
|
|
||||||
var timer: Timer?
|
|
||||||
var version: PhpVersionExtractor? = nil
|
|
||||||
var availablePhpVersions : [String] = []
|
|
||||||
var busy: Bool = false
|
|
||||||
|
|
||||||
let statusItem = NSStatusBar.system.statusItem(
|
let statusItem = NSStatusBar.system.statusItem(
|
||||||
withLength: 32
|
withLength: 32
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var timer: Timer?
|
||||||
|
var version: PHPVersion? = nil
|
||||||
|
var availablePhpVersions : [String] = []
|
||||||
|
var busy: Bool = false
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||||
|
// Start with the ducky
|
||||||
|
self.setStatusBar(image: NSImage(named: NSImage.Name("StatusBarIcon"))!)
|
||||||
|
// Perform environment boot checks
|
||||||
|
DispatchQueue.global(qos: .userInitiated).async {
|
||||||
|
Environment.performBootChecks()
|
||||||
|
}
|
||||||
|
// Check if the correct stuff is installed
|
||||||
self.availablePhpVersions = Services.detectPhpVersions()
|
self.availablePhpVersions = Services.detectPhpVersions()
|
||||||
self.setStatusBarImage(version: "???")
|
|
||||||
self.updatePhpVersionInStatusBar()
|
self.updatePhpVersionInStatusBar()
|
||||||
// Schedule a request to fetch the PHP version every 15 seconds
|
// Schedule a request to fetch the PHP version every 15 seconds
|
||||||
Timer.scheduledTimer(timeInterval: 15, target: self, selector: #selector(updatePhpVersionInStatusBar), userInfo: nil, repeats: true)
|
Timer.scheduledTimer(
|
||||||
|
timeInterval: 15,
|
||||||
|
target: self,
|
||||||
|
selector: #selector(updatePhpVersionInStatusBar),
|
||||||
|
userInfo: nil,
|
||||||
|
repeats: true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setStatusBarImage(version: String) {
|
func setStatusBarImage(version: String) {
|
||||||
|
self.setStatusBar(image: ImageGenerator.generateImageForStatusBar(width: 32.0, text: version))
|
||||||
|
}
|
||||||
|
|
||||||
|
func setStatusBar(image: NSImage) {
|
||||||
if let button = statusItem.button {
|
if let button = statusItem.button {
|
||||||
let image = ImageGenerator.generateImageForStatusBar(width: 32.0, text: version)
|
|
||||||
image.isTemplate = true
|
image.isTemplate = true
|
||||||
button.image = image
|
button.image = image
|
||||||
}
|
}
|
||||||
@@ -41,41 +56,51 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc func updatePhpVersionInStatusBar() {
|
@objc func updatePhpVersionInStatusBar() {
|
||||||
self.version = PhpVersionExtractor()
|
self.version = PHPVersion()
|
||||||
self.setStatusBarImage(version: self.busy ? "🏗" : self.version!.short)
|
if (self.busy) {
|
||||||
|
self.setStatusBar(image: NSImage(named: NSImage.Name("StatusBarIcon"))!)
|
||||||
|
} else {
|
||||||
|
self.setStatusBarImage(version: self.version!.short)
|
||||||
|
}
|
||||||
|
|
||||||
self.updateMenu()
|
self.updateMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateMenu() {
|
func updateMenu() {
|
||||||
let menu = NSMenu()
|
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
||||||
var string = "We are not sure what version of PHP you are running."
|
let menu = NSMenu()
|
||||||
if (version != nil) {
|
var string = "We are not sure what version of PHP you are running."
|
||||||
string = "You are running PHP \(version!.long)"
|
if (self.version != nil) {
|
||||||
}
|
string = "You are running PHP \(self.version!.long)"
|
||||||
menu.addItem(NSMenuItem(title: string, action: nil, keyEquivalent: ""))
|
|
||||||
menu.addItem(NSMenuItem.separator())
|
|
||||||
if (self.availablePhpVersions.count > 0 && !busy) {
|
|
||||||
for index in (0..<self.availablePhpVersions.count) {
|
|
||||||
let version = self.availablePhpVersions[index]
|
|
||||||
let action = #selector(self.switchToPhpVersion(sender:))
|
|
||||||
let menuItem = NSMenuItem(title: "Switch to PHP \(version)", action: (version == self.version?.short) ? nil : action, keyEquivalent: "\(index + 1)")
|
|
||||||
menuItem.tag = index
|
|
||||||
menu.addItem(menuItem)
|
|
||||||
}
|
}
|
||||||
|
menu.addItem(NSMenuItem(title: string, action: nil, keyEquivalent: ""))
|
||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
}
|
if (self.availablePhpVersions.count > 0 && !self.busy) {
|
||||||
if (self.busy) {
|
for index in (0..<self.availablePhpVersions.count) {
|
||||||
menu.addItem(NSMenuItem(title: "Switching PHP versions...", action: nil, keyEquivalent: ""))
|
let version = self.availablePhpVersions[index]
|
||||||
|
let action = #selector(self.switchToPhpVersion(sender:))
|
||||||
|
let menuItem = NSMenuItem(title: "Switch to PHP \(version)", action: (version == self.version?.short) ? nil : action, keyEquivalent: "\(index + 1)")
|
||||||
|
menuItem.tag = index
|
||||||
|
menu.addItem(menuItem)
|
||||||
|
}
|
||||||
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
}
|
||||||
|
if (self.busy) {
|
||||||
|
menu.addItem(NSMenuItem(title: "Switching PHP versions...", action: nil, keyEquivalent: ""))
|
||||||
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
}
|
||||||
|
menu.addItem(NSMenuItem(title: Services.mysqlIsRunning() ? "You are running MySQL" : "MySQL is not active", action: nil, keyEquivalent: ""))
|
||||||
|
menu.addItem(NSMenuItem(title: Services.nginxIsRunning() ? "You are running nginx" : "nginx is not active", action: nil, keyEquivalent: ""))
|
||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
// menu.addItem(NSMenuItem(title: "About phpmon", action: #selector(NSApplication.terminate(_:)), keyEquivalent: ""))
|
||||||
|
menu.addItem(NSMenuItem(title: "Quit phpmon", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.statusItem.menu = menu
|
||||||
|
}
|
||||||
}
|
}
|
||||||
menu.addItem(NSMenuItem(title: Services.mysqlIsRunning() ? "You are running MySQL" : "MySQL is not active", action: nil, keyEquivalent: ""))
|
|
||||||
menu.addItem(NSMenuItem(title: Services.nginxIsRunning() ? "You are running nginx" : "nginx is not active", action: nil, keyEquivalent: ""))
|
|
||||||
menu.addItem(NSMenuItem.separator())
|
|
||||||
menu.addItem(NSMenuItem(title: "Quit phpmon", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
|
|
||||||
statusItem.menu = menu
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func switchToPhpVersion(sender: AnyObject) {
|
@objc public func switchToPhpVersion(sender: AnyObject) {
|
||||||
let index = sender.tag!
|
let index = sender.tag!
|
||||||
let version = self.availablePhpVersions[index]
|
let version = self.availablePhpVersions[index]
|
||||||
self.busy = true
|
self.busy = true
|
||||||
|
|||||||
22
phpmon/Assets.xcassets/StatusBarIcon.imageset/Contents.json
vendored
Normal file
22
phpmon/Assets.xcassets/StatusBarIcon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "phpmon.png",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "phpmon@2x.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
phpmon/Assets.xcassets/StatusBarIcon.imageset/phpmon.png
vendored
Normal file
BIN
phpmon/Assets.xcassets/StatusBarIcon.imageset/phpmon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 432 B |
BIN
phpmon/Assets.xcassets/StatusBarIcon.imageset/phpmon@2x.png
vendored
Normal file
BIN
phpmon/Assets.xcassets/StatusBarIcon.imageset/phpmon@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 801 B |
23
phpmon/Helpers/Alert.swift
Normal file
23
phpmon/Helpers/Alert.swift
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// Alert.swift
|
||||||
|
// phpmon
|
||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 12/06/2019.
|
||||||
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Cocoa
|
||||||
|
|
||||||
|
class Alert {
|
||||||
|
public static func present(
|
||||||
|
messageText: String,
|
||||||
|
informativeText: String,
|
||||||
|
buttonTitle: String = "OK"
|
||||||
|
) {
|
||||||
|
let alert = NSAlert.init()
|
||||||
|
alert.messageText = messageText
|
||||||
|
alert.informativeText = informativeText
|
||||||
|
alert.addButton(withTitle: buttonTitle)
|
||||||
|
alert.runModal()
|
||||||
|
}
|
||||||
|
}
|
||||||
39
phpmon/Helpers/Environment.swift
Normal file
39
phpmon/Helpers/Environment.swift
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// Environment.swift
|
||||||
|
// phpmon
|
||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 12/06/2019.
|
||||||
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class Environment {
|
||||||
|
public static func performBootChecks()
|
||||||
|
{
|
||||||
|
if (!Shell.execute(command: "which php").contains("/usr/local/bin/php")) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
Alert.present(
|
||||||
|
messageText: "PHP is not correctly installed",
|
||||||
|
informativeText: "You must install PHP via brew. Try running `which php` in Terminal, it should return `/usr/local/bin/php`. The app will not work correctly until you resolve this issue."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Shell.execute(command: "ls /usr/local/opt | grep php@7.3").contains("php@7.3")) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
Alert.present(
|
||||||
|
messageText: "PHP 7.3 is not correctly installed",
|
||||||
|
informativeText: "PHP 7.3 alias was not found in `/usr/local/opt`. The app will not work correctly until you resolve this issue."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Shell.execute(command: "which valet").contains("/usr/local/bin/valet")) {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
Alert.present(
|
||||||
|
messageText: "Laravel Valet is not correctly installed",
|
||||||
|
informativeText: "You must install Valet via brew. Try running `which valet` in Terminal, it should return `/usr/local/bin/valet`. The app will not work correctly until you resolve this issue."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class PhpVersionExtractor {
|
class PHPVersion {
|
||||||
|
|
||||||
var short : String = "???"
|
var short : String = "???"
|
||||||
var long : String = "???"
|
var long : String = "???"
|
||||||
@@ -17,7 +17,7 @@ class PhpVersionExtractor {
|
|||||||
// Get the info about the PHP installation
|
// Get the info about the PHP installation
|
||||||
let output = Shell.execute(command: "php -v")
|
let output = Shell.execute(command: "php -v")
|
||||||
// Get everything before "(cli)" (PHP X.X.X (cli) ...)
|
// Get everything before "(cli)" (PHP X.X.X (cli) ...)
|
||||||
var version = output!.components(separatedBy: " (cli)")[0]
|
var version = output.components(separatedBy: " (cli)")[0]
|
||||||
// Strip away the text before the version number
|
// Strip away the text before the version number
|
||||||
version = version.components(separatedBy: "PHP ")[1]
|
version = version.components(separatedBy: "PHP ")[1]
|
||||||
self.long = version
|
self.long = version
|
||||||
@@ -27,7 +27,7 @@ class Services {
|
|||||||
|
|
||||||
public static func detectPhpVersions() -> [String] {
|
public static func detectPhpVersions() -> [String] {
|
||||||
let files = Shell.execute(command: "ls /usr/local/opt | grep php@")
|
let files = Shell.execute(command: "ls /usr/local/opt | grep php@")
|
||||||
var versions = files!.components(separatedBy: "\n")
|
var versions = files.components(separatedBy: "\n")
|
||||||
// Remove all empty strings
|
// Remove all empty strings
|
||||||
versions.removeAll { (string) -> Bool in
|
versions.removeAll { (string) -> Bool in
|
||||||
return (string == "")
|
return (string == "")
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class Shell {
|
class Shell {
|
||||||
public static func execute(command: String) -> String?
|
public static func execute(command: String) -> String
|
||||||
{
|
{
|
||||||
let task = Process()
|
let task = Process()
|
||||||
task.launchPath = "/bin/bash"
|
task.launchPath = "/bin/bash"
|
||||||
task.arguments = ["-c", command]
|
task.arguments = ["--login", "-c", command]
|
||||||
|
|
||||||
let pipe = Pipe()
|
let pipe = Pipe()
|
||||||
task.standardOutput = pipe
|
task.standardOutput = pipe
|
||||||
|
|||||||
@@ -19,16 +19,16 @@
|
|||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>2</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
|
<key>LSUIElement</key>
|
||||||
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2019 Nico Verbruggen. All rights reserved.</string>
|
<string>Copyright © 2019 Nico Verbruggen. All rights reserved.</string>
|
||||||
<key>NSMainStoryboardFile</key>
|
<key>NSMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
<key>LSUIElement</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
Reference in New Issue
Block a user