Simplify btrestart to use pkill bluetoothd approach

- Replace complex launchctl approach with simple pkill bluetoothd
- macOS automatically restarts bluetoothd when killed
- Much more maintainable and future-proof
- Reduces from 6 commands to 1 command
- Less prone to OS changes and service discovery issues
- Cleaner, more readable implementation

Resolves #10934
This commit is contained in:
Paul Frederiksen 2025-10-07 16:33:28 -07:00
commit 23f825ff64

View file

@ -19,17 +19,9 @@ alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false &
# Bluetooth restart # Bluetooth restart
function btrestart() { function btrestart() {
# Kill audio and bluetooth processes echo "Restarting Bluetooth daemon..."
pgrep audio | xargs sudo kill 2>/dev/null || true sudo pkill bluetoothd
pgrep bluetooth | xargs sudo kill 2>/dev/null || true echo "Bluetooth daemon restarted."
# Restart bluetooth services using launchctl
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop 2>/dev/null || true
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start 2>/dev/null || true
# Restart audio services using launchctl
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl stop 2>/dev/null || true
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl start 2>/dev/null || true
} }
function _omz_macos_get_frontmost_app() { function _omz_macos_get_frontmost_app() {