Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Want to monitor disk activity instead of network activity? Check out the sister

--silent, -s - Silences command-line output

--trackpad, -t - Adds trackpad haptic feedback

--version, -v - Displays the current version of netcaps

--help, -h - Shows the help menu
Expand Down
15 changes: 15 additions & 0 deletions Sources/netcaps/netcaps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,22 @@ class CapsLockLEDManager {
}
}
@MainActor let ledManager = CapsLockLEDManager()

// MARK: - Haptic Feedback
@MainActor
func performHapticFeedback() {
if trackpadHaptic {
NSHapticFeedbackManager.defaultPerformer.perform(
NSHapticFeedbackManager.FeedbackPattern.alignment,
performanceTime: NSHapticFeedbackManager.PerformanceTime.now
)
}
}

@MainActor
func blinkCapsLock(times: Int = 1, interval: TimeInterval = legitInterval) {
ledManager?.blink(times: times, interval: interval)
performHapticFeedback()
}

// MARK: - Network Monitoring
Expand Down Expand Up @@ -224,6 +237,7 @@ func blinkCapsLock(times: Int = 1, interval: TimeInterval = legitInterval) {
// This is really goofy.
let args = CommandLine.arguments
let silent = args.contains("-s") || args.contains("--silent")
let trackpadHaptic = args.contains("-t") || args.contains("--trackpad")

@main
struct main {
Expand Down Expand Up @@ -265,6 +279,7 @@ struct main {
print("")
print("Arguments:")
print(" --silent, -s - silences command-line output")
print(" --trackpad, -t - adds trackpad haptic feedback")
print(" --local-only, -L - only listen on loX")
print(" --en-only, -E - only listen on enX")
print(" --peers-only, -P - only listen on awdlX and llwX")
Expand Down