@@ -205,7 +205,7 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
205205 brewStatusItem. target = self
206206 menu. addItem ( brewStatusItem)
207207 self . brewStatusMenuItem = brewStatusItem
208-
208+
209209 menu. addItem ( . separator( ) )
210210
211211 let updateItem = NSMenuItem ( title: " " , action: #selector( updateNow) , keyEquivalent: " " )
@@ -355,9 +355,9 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
355355
356356 // Get outdated formulae count
357357 let formulaeCount = await getBrewOutdatedCount ( brewPath: brewPath, type: " formulae " )
358- // Get outdated casks count
358+ // Get outdated casks count
359359 let casksCount = await getBrewOutdatedCount ( brewPath: brewPath, type: " casks " )
360-
360+
361361 let totalCount = formulaeCount + casksCount
362362 AppConstants . logger. info ( " Found \( formulaeCount) outdated formulae and \( casksCount) outdated casks (total: \( totalCount) ) " )
363363 return ( formulaeCount, casksCount)
@@ -366,7 +366,7 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
366366 private func getBrewOutdatedCount( brewPath: String , type: String ) async -> Int {
367367 let process = Process ( )
368368 process. executableURL = URL ( fileURLWithPath: " /bin/sh " )
369-
369+
370370 let command = switch type {
371371 case " formulae " :
372372 " \( brewPath) outdated --formula --quiet | wc -l "
@@ -375,9 +375,9 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
375375 default :
376376 " \( brewPath) outdated --quiet | wc -l "
377377 }
378-
378+
379379 process. arguments = [ " -c " , command]
380-
380+
381381 // Set environment variables including PATH
382382 var environment = ProcessInfo . processInfo. environment
383383 environment [ " PATH " ] = " /usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin "
@@ -500,7 +500,7 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
500500 } else if outdatedBrewCasks > 0 {
501501 tooltipParts. append ( " \( outdatedBrewCasks) brew casks outdated " )
502502 }
503-
503+
504504 if tooltipParts. isEmpty {
505505 statusItem? . button? . toolTip = " Sparkdock - Up to date "
506506 } else {
@@ -513,7 +513,7 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
513513 } else {
514514 sparkdockStatusMenuItem? . attributedTitle = createStatusTitle ( " Sparkdock is up to date " , color: . systemGreen)
515515 }
516-
516+
517517 // Update Brew status line
518518 if totalBrewCount > 0 {
519519 let brewStatusText = outdatedBrewFormulae > 0 && outdatedBrewCasks > 0 ?
@@ -557,7 +557,7 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
557557
558558 @objc private func upgradeBrew( ) {
559559 guard totalOutdatedBrewCount > 0 else { return }
560-
560+
561561 // Create a compound command that upgrades both formulae and casks
562562 let upgradeCommand = " brew upgrade && brew upgrade --cask "
563563 executeTerminalCommand ( upgradeCommand)
@@ -694,30 +694,30 @@ class SparkdockMenubarApp: NSObject, NSApplicationDelegate {
694694// MARK: - CLI Handling
695695private func checkForExistingInstance( ) -> Bool {
696696 let currentPID = ProcessInfo . processInfo. processIdentifier
697-
697+
698698 let process = Process ( )
699699 process. executableURL = URL ( fileURLWithPath: " /usr/bin/pgrep " )
700700 process. arguments = [ " -f " , " sparkdock-manager " ]
701-
701+
702702 let pipe = Pipe ( )
703703 process. standardOutput = pipe
704704 process. standardError = Pipe ( )
705-
705+
706706 do {
707707 try process. run ( )
708708 process. waitUntilExit ( )
709-
709+
710710 let data = pipe. fileHandleForReading. readDataToEndOfFile ( )
711711 let output = String ( data: data, encoding: . utf8) ?? " "
712-
712+
713713 // Parse PIDs from output and check if any other instance is running
714714 let pids = output. trimmingCharacters ( in: . whitespacesAndNewlines)
715715 . components ( separatedBy: . newlines)
716716 . compactMap { Int32 ( $0) }
717717 . filter { $0 != currentPID }
718-
718+
719719 return !pids. isEmpty
720-
720+
721721 } catch {
722722 AppConstants . logger. warning ( " Failed to check for existing instances: \( error. localizedDescription) " )
723723 return false
0 commit comments