Bluetooth: Difference between revisions

Qweered (talk | contribs)
m better link
QuBe (talk | contribs)
m Make "happy path" for installing mpris the first example. Also add missing code formatting
 
(2 intermediate revisions by 2 users not shown)
Line 10: Line 10:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.blueman.enable = true;
services.blueman.enable = true;
</syntaxhighlight>Another option for a GUI based Bluetooth management GUI can be [https://search.nixos.org/packages?channel=unstable&show=overskride&from=0&size=50&sort=relevance&type=packages&query=overskride overskirde]
</syntaxhighlight>Another option for a GUI based Bluetooth management GUI can be [https://search.nixos.org/packages?channel=unstable&show=overskride&from=0&size=50&sort=relevance&type=packages&query=overskride overskride]


Alternatively if you wish to use a TUI<ref>https://en.wikipedia.org/wiki/Text-based_user_interface</ref> then check out [https://github.com/bluetuith-org/bluetuith bluetuith] or [https://github.com/pythops/bluetui bluetui]
Alternatively if you wish to use a TUI<ref>https://en.wikipedia.org/wiki/Text-based_user_interface</ref> then check out [https://github.com/bluetuith-org/bluetuith bluetuith] or [https://github.com/pythops/bluetui bluetui]
Line 53: Line 53:
To make these buttons usable with media players supporting the dbus-based [https://specifications.freedesktop.org/mpris-spec/latest/ MPRIS] standard,
To make these buttons usable with media players supporting the dbus-based [https://specifications.freedesktop.org/mpris-spec/latest/ MPRIS] standard,
one can use <code>mpris-proxy</code> that is part of bluez package.
one can use <code>mpris-proxy</code> that is part of bluez package.
The following snippet can be used in [[Home Manager]] to start this program as a daemon:
It can be used as a daemon in [[Home Manager]]:<syntaxhighlight lang="nix">
services.mpris-proxy.enable = true;
</syntaxhighlight>For versions preceding Home Manager 21.05, the following snippet can be used:


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 63: Line 65:
};
};
</syntaxHighlight>
</syntaxHighlight>
Or, starting with Home Manager 21.05, enable the <code>mpris-proxy</code> service.


Some headsets (such as Sony's WH-1000XM series) also support AVRCP directly and as such <code>mpris-proxy</code> is not required for this functionality, as headset button presses will register as media key presses. If you are using a WM or a desktop environment which doesn't support media keys, you will have to set up keybindigs yourself; the keys are typically called <code>XF86AudioPlay</code>, <code>XF86AudioPause</code>, <code>XF86AudioNext</code>, and <code>XF86AudioPrev</code>. However, note that some functionality, such as "take off headphones to pause" on WH-1000XM4/5 requires two-way AVRCP communication to work properly, so `mpris-proxy` is still recommended if you wish to use it. It also may or may not help with Bluetooth multipoint.
Some headsets (such as Sony's WH-1000XM series) also support AVRCP directly and as such <code>mpris-proxy</code> is not required for this functionality, as headset button presses will register as media key presses. If you are using a WM or a desktop environment which doesn't support media keys, you will have to set up keybindigs yourself; the keys are typically called <code>XF86AudioPlay</code>, <code>XF86AudioPause</code>, <code>XF86AudioNext</code>, and <code>XF86AudioPrev</code>. However, note that some functionality, such as "take off headphones to pause" on WH-1000XM4/5 requires two-way AVRCP communication to work properly, so `mpris-proxy` is still recommended if you wish to use it. It also may or may not help with Bluetooth multipoint.
Line 103: Line 103:


<syntaxhighlight lang="nix">{
<syntaxhighlight lang="nix">{
...
   hardware.bluetooth.settings = {
   hardware.bluetooth.settings = {
     General = {
     General = {
Line 108: Line 109:
     };
     };
   };
   };
...
}</syntaxhighlight>
}</syntaxhighlight>
This configuration may be unnecessary and does not work with bluez5 (<tt>Unknown key Enable for group General</tt> ).
This configuration may be unnecessary and does not work with bluez5 (<tt>Unknown key Enable for group General</tt> ).