headset-bt

0

Описание

The utility to quickly switch bluetooth headset between A2DP (high-quality playback, no microphone) and HFP (low-quality sound, microphone enabled)

Языки

  • Python100%
2 года назад
2 года назад
2 года назад
README.md

headset-bt

РУССКАЯ ДОКУМЕНТАЦИЯ НИЖЕ / THE RUSSIAN TEXT FOLLOWS

This utility allows quick switching Bluetooth™ headsets between A2DP (high-quality playback, no microphone) and HFP (low-quality sound, microphone enabled) modes.

Usage

usage: headset-bt [-h] [-d] [-l] [-c] [-x] [--version] [mode] Switch the mode of a Bluetooth device positional arguments: mode Switch the card to the specified mode; if omitted, switch to the next mode in round-robin order options: -h, --help show this help message and exit -d, --daemonize Start daemon with tray icon and exit -l, --list List available modes -c, --current Show current mode (may also be used with -l) -x, --extended Show extended info (to use with -l and -c) --version show program's version number and exit

Installation

The utility controls Bluetooth device using PulseAudio interface through the

library. Please install it with the following command:

To run the daemon showing tray icons, the program requires

and
pillow
libraries. Please install them by running

The

pillow
library will be downloaded and installed automatically as a dependency of
pystray
.

After than, just copy the

headset-bt
file to your disk and run it.

Credits

The utility was inspired by the “How to keep the audio profile at A2DP while using a mic with Bluetooth headset? (Push-to-talk)” article on AskUbuntu.com

The daemon uses icons from the Font Awesome icon pack by Dave Gandy

Release history

  • 0.1 (September, 2024)
    • initial release
  • 0.2 (October, 2024)
    • #!/usr/bin/python
      changed to
      #!/usr/bin/env python
      to use locally managed python environment
    • -c
      and
      -x
      options added
    • the algorithm of selecting tray icon has changed; the «unknown» icon has removed
    • the round-robin logic has changed

Программа для быстрого переключения Bluetooth™-наушников между режимами A2DP (качественное воспроизведение звука, микрофон отключен) и HFP (режим гарнитуры, низкое качество звука).

Использование

Запуск: headset-bt [-h] [-d] [-l] [-c] [-x] [--version] [mode] Переключение режима Bluetooth-устройства Позиционные аргументы: mode Режим, в который следует переключить карту; если не задан, выбирается следующий режим по списку Опции: -h, --help показать справку -d, --daemonize запустить фоновый процесс, показывающий индикатор текущего режима в трее -l, --list показать список доступных режимов -c, --current показать текущий режим (можно использовать вместе с -l) -x, --extended показывать расширенную информацию о режиме (использовать с -l и -c) --version показать версию программы

Установка

Для управления Bluetooth-устройствами используется интерфейс PulseAudio при помощи библиотеки

library. Чтобы установить эту библиотеку, используйте команду:

Для показа статуса в трее требуются библиотеки

и
pillow
. Установите их:

Библиотека

pillow
будет установлена автоматически, т. к.
pystray
её использует и зависит от неё.

Затем просто скопируйте файл

headset-bt
и запустите его.

Благодарности

Идея написания программы навеяна топиком «How to keep the audio profile at A2DP while using a mic with Bluetooth headset? (Push-to-talk)» на сайте AskUbuntu.com

Использованы иконки из набора Font Awesome; автор — Dave Gandy

История выпусков

  • 0.1 (сентябрь 2024)

    • первая версия
  • 0.2 (October, 2024)

    • шебанг

      #!/usr/bin/python
      заменен на
      #!/usr/bin/env python
      для использования локальной среды python

    • добавлены опции

      -c
      и
      -x

    • изменён алгоритм выбора иконки в трее; иконка «неизвестный режим» удалена

    • изменён алгоритм перебора режимов