MXStatusMenu shows the cpu and network load in the menubar of OS X similar to iStatMenus. Written in Swift.
- Implements the menubar item using
NSStatusBar
and aNSView
with a dynamic width - Reads the cpu load using
host_processor_info
/PROCESSOR_CPU_LOAD_INFO
- Reads the network load using
sysctl
/NET_RT_IFLIST2
- Shows how to alloc and dealloc Swift pointers of type
UnsafePointer
andUnsafeMutablePointer
- Includes a timer implementation using Grand Central Dispatch /
DISPATCH_SOURCE_TYPE_TIMER
- Does not require third-party code to compile. The only dependencies are
import Cocoa
andimport Darwin
.
Visual parameters, update intervals, and the maximum network load can be set in the file App.swift
Tested on OS X 10.10.3 (14D131). Compiles without errors or warnings using Xcode 6.3 (6D570).
This just is a simple app to test the capabilities of Swift and not intended to be used in production environments. If you are looking for a real app that monitors your Mac, i highly recommend iStatMenus.
Please notice that i'm not affiliated in any way with Bjango, the developer of iStatMenus.
Maximilian Götzfried (@mgoetzfried, maximiliangoetzfried.com)
MXStatusMenu is available under the MIT license. See the LICENSE file for more information.