GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Audio4Linux/PulseConnectionListener: Listen for sink changes in Pulseaudio

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
PulseManager.cpp
PulseManager.cpp
 
 
PulseManager.h
PulseManager.h
 
 
README.md
README.md
 
 
Utils.h
Utils.h
 
 
cxxopts.hpp
cxxopts.hpp
 
 
main.cpp
main.cpp
 
 

Repository files navigation

PulseConnectionListener

Listen for sink changes on the default Pulseaudio server

Build from sources

Clone repository:

git clone https://github.com/Audio4Linux/PulseConnectionListener
cd PulseConnectionListener

Install dependencies (glibmm-2.4, giomm-2.4 and libpulse):

# Arch Linux
sudo pacman -S glibmm pulseaudio

Compile project:

mkdir build && cd build
cmake ..
make

You should end up with a binary called pa_conn_watcher:

./pa_conn_watcher --help
Watch for pulseaudio sink changes
Usage:
  ./pa_conn_watcher [OPTION...]

  -o, --once        Wait for one event and exit
  -r, --run arg     Execute shell command on sink update
  -f, --filter arg  Filter by sink name
  -c, --contains    Filter modifier: don't require exact match
  -s, --silent      Disable output
  -h, --help        Print this message

Usage

First you need to find the name of the sink you want to watch:

pactl list sinks | grep "Name:" -A1

I'll use my Bluetooth earbuds (bluez_sink.80_7B_3E_21_79_EC.a2dp_sink) for the following examples. (You can also leave this filter out if you want to receive events from all sinks.)

Launch the pa_conn_watcher executable with the corresponding parameters:

./pa_conn_watcher --filter "bluez_sink.80_7B_3E_21_79_EC.a2dp_sink"

We can also run a shell command when an event has been received. For example, we can print something to stdout or run external scripts:

./pa_conn_watcher --run "echo 'Something happened!'" --silent --filter "bluez_sink.80_7B_3E_21_79_EC.a2dp_sink"

./pa_conn_watcher --run "viper restart" --once --filter "bluez_sink.80_7B_3E_21_79_EC.a2dp_sink"

NOTE: If you intend to use this program with Viper4Linux (viper restart), keep in mind that this causes an endless loop:

Watcher detects update -> restart viper -> restart causes sink update -> watcher detects update -> ...

To prevent this you can provide a --once flag and call the executable from a bash loop with sleep 5 appended to the command.

Debugging

You can enable debug output using this environment variable:

export G_MESSAGES_DEBUG=all

About

Listen for sink changes in Pulseaudio

Resources

Readme
GPL-3.0 license
Activity
Custom properties

Stars

3 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.