mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
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:
parent
cb932fe914
commit
23f825ff64
1 changed files with 3 additions and 11 deletions
|
|
@ -19,17 +19,9 @@ alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false &
|
|||
|
||||
# Bluetooth restart
|
||||
function btrestart() {
|
||||
# Kill audio and bluetooth processes
|
||||
pgrep audio | xargs sudo kill 2>/dev/null || true
|
||||
pgrep bluetooth | xargs sudo kill 2>/dev/null || true
|
||||
|
||||
# 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
|
||||
echo "Restarting Bluetooth daemon..."
|
||||
sudo pkill bluetoothd
|
||||
echo "Bluetooth daemon restarted."
|
||||
}
|
||||
|
||||
function _omz_macos_get_frontmost_app() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue