Repository navigation
Enable mpris-proxy so when i take earbuds off the media pauses and vice versa (only to earbuds with this feature) #10980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
othchek
wants to merge
1
commit into
omacom:quattro
Choose a base branch
from
othchek:bluetooth-mpris-proxy
base: quattro
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+65
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
default/systemd/user/mpris-proxy.service.d/10-omarchy.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Let Bluetooth headsets drive the media player. | ||
| # | ||
| # Headsets send transport control as AVRCP passthrough: play/pause, next and | ||
| # previous from the buttons or stem gestures, and the pause that earbuds with | ||
| # in-ear detection emit when one is taken out. bluez only routes those to a | ||
| # player registered on org.bluez.Media1, and with nothing registered it drops | ||
| # them, so the buttons do nothing and playback runs on into an ear that is no | ||
| # longer listening. mpris-proxy is that registration, exporting session MPRIS | ||
| # players to bluez. | ||
| # | ||
| # bluez-utils ships the unit but leaves it disabled, and it carries no | ||
| # conditions or Restart=. mpris-proxy exits 1 ("Can't get on system bus") when | ||
| # bluetoothd is unreachable at startup, so enabling it as shipped leaves a | ||
| # failed unit on every machine without a usable adapter. The two conditions | ||
| # mirror bt-agent.service and skip it cleanly there instead. | ||
| # | ||
| # Restart= covers mpris-proxy itself dying, and nothing more. It does not | ||
| # recover a bluetoothd restart: a running proxy survives that without exiting, | ||
| # logging "org.bluez disappeared" and then "org.bluez appeared", so systemd is | ||
| # never involved. A user unit cannot order itself against the system | ||
| # bluetooth.service, so recovering that case is out of reach from here. | ||
| [Unit] | ||
| ConditionPathIsDirectory=/sys/class/bluetooth | ||
|
|
||
| [Service] | ||
| ExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.service | ||
| Restart=on-failure | ||
| RestartSec=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| echo "Enable the Bluetooth MPRIS proxy so headset transport controls reach the player" | ||
|
|
||
| # Only first-run enables the units we ship, so existing installs never picked | ||
| # this one up. The drop-in keeps it inert where there is no bluetooth, so it is | ||
| # safe to enable unconditionally here. | ||
|
|
||
| systemctl --user daemon-reload >/dev/null 2>&1 || true | ||
|
|
||
| # `systemctl enable` needs a live user manager, which an update from a TTY does | ||
| # not have, so fall back to writing the symlink it would have written. The unit | ||
| # bluez ships is WantedBy=default.target, not graphical-session.target. | ||
| if ! systemctl --user enable mpris-proxy.service >/dev/null 2>&1; then | ||
| wants_dir="$HOME/.config/systemd/user/default.target.wants" | ||
| mkdir -p "$wants_dir" | ||
| ln -sfn /usr/lib/systemd/user/mpris-proxy.service \ | ||
| "$wants_dir/mpris-proxy.service" | ||
| fi | ||
|
|
||
| # Nothing to start into over SSH; the next login handles it. A failed start | ||
| # only delays headset button support, so it stays quiet. | ||
| if systemctl --user is-active --quiet default.target; then | ||
| systemctl --user start mpris-proxy.service >/dev/null 2>&1 || true | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests check the repository copy of the drop-in, but not whether the package installs it where systemd reads it. If the package omits it, the tests still pass while users receive none of these guards. Add the drop-in and its destination to
package_defaultsinconfig-test.sh, which already checks package delivery for other service defaults.