Skip to content

Commit

Permalink
feat(main): Add ujust cmd 'toggle-bt-mic' to fix upstream audio quali…
Browse files Browse the repository at this point in the history
…ty bug (#2090)

* feat: new ujust command 'toggle-bt-mic' to disable headphone mode in wireplumber, to mitigate upstream bug reducing audio quality

* feat: added toggle fix and sudo prompts, aligned with other ujust toggle cmds now

* fix(deck): update 'ujust changelogs' to pull latest release notes from GitHub (#2089)

* modified 'ujust changelogs' cmd to pull latest release from GH, instead of outdated changelog.md file that is no longer maintained.

* git commit -m "feat: add 'ujust changelogs-testing' for pre-release notes"

* chore(ci): Update rechunk version

* chore: Lint just file

* feat: Update to kernel 6.12.8-207

* fix: rm linebreaks for linter

* chore: 2 space indents and newline for linter

* chore: replace non standard dash for linter

---------

Co-authored-by: Kyle Gospodnetich <me@kylegospodneti.ch>
  • Loading branch information
xXJSONDeruloXx and KyleGospo authored Jan 8, 2025
1 parent 013a909 commit f8dcbdd
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,42 @@ fix-reset-steam:
sleep 1
bazzite-steam &
exit 0

# Toggle Bluetooth headset profile mode. If enabled, mic will be disabled on the Bluetooth device preventing the switch to headset profile, which has poor audio quality. Disable to restore mic functionality.
toggle-bt-mic:
#!/usr/bin/bash
CONFIG_FILE="/etc/wireplumber/wireplumber.conf.d/51-mitigate-annoying-profile-switch.conf"
# Check current status
CURRENT_STATE="Disabled"
if [ -f "$CONFIG_FILE" ]; then
CURRENT_STATE="Enabled"
fi
# Prompt user for action
echo "Bluetooth headset profile mitigation is currently: ${bold}${CURRENT_STATE}${normal}"
echo "Enable or Disable Bluetooth headset profile mitigation?"
OPTION=$(ugum choose Enable Disable)
if [[ "${OPTION,,}" == "enable" ]]; then
echo "You chose to enable mitigation. This will disable headset mic functionality."
echo "Requesting root privileges..."
sudo mkdir -p "$(dirname "$CONFIG_FILE")"
echo 'wireplumber.settings = {' | sudo tee "$CONFIG_FILE" > /dev/null
echo ' bluetooth.autoswitch-to-headset-profile = false' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo '}' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo '' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo 'monitor.bluez.properties = {' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo ' bluez5.roles = [ a2dp_sink a2dp_source ]' | sudo tee -a "$CONFIG_FILE" > /dev/null
echo '}' | sudo tee -a "$CONFIG_FILE" > /dev/null
systemctl --user restart wireplumber
echo "Mitigation has been ${green}${b}enabled${n}. Headset profile switching is now disabled."
elif [[ "${OPTION,,}" == "disable" ]]; then
echo "You chose to disable mitigation. This will restore headset mic functionality."
echo "Requesting root privileges..."
if sudo rm -f "$CONFIG_FILE"; then
systemctl --user restart wireplumber
echo "Mitigation has been ${red}${b}disabled${n}. Headset profile switching is now allowed."
else
echo "Failed to disable mitigation. Ensure you have sufficient permissions."
fi
else
echo "No changes were made."
fi

0 comments on commit f8dcbdd

Please sign in to comment.