Plays a short tone to keep bluetooth speakers on.
Find a file
2026-03-28 18:08:36 +01:00
finish init 2026-03-28 17:56:43 +01:00
install.sh init 2026-03-28 17:56:43 +01:00
README.md init 2026-03-28 17:56:43 +01:00
run lil tweak 2026-03-28 18:08:36 +01:00

Speaker Keepalive Service for Void Linux

A runit service that keeps a Bluetooth speaker connected by playing an inaudible tone periodically.

Quick Installation

sudo ./install.sh

The installer will:

  • Copy service files to /etc/sv/speaker_keepalive/
  • Create an env file with auto-detected user
  • Enable the service via symlink to /var/service/

Manual Installation

  1. Copy the service directory to /etc/sv/:

    sudo cp -r speaker_keepalive /etc/sv/
    
  2. Make the scripts executable:

    sudo chmod +x /etc/sv/speaker_keepalive/run
    sudo chmod +x /etc/sv/speaker_keepalive/finish
    
  3. Enable the service (symlink to /var/service/):

    sudo ln -s /etc/sv/speaker_keepalive /var/service/
    

Configuration

The service auto-detects the user with an active PipeWire session. To specify a particular user, edit /etc/sv/speaker_keepalive/env:

SPEAKER_USER=yourusername

Then restart the service:

sudo sv restart speaker_keepalive

Service Management Commands

  • Check service status:

    sudo sv status speaker_keepalive
    
  • Stop the service:

    sudo sv stop speaker_keepalive
    
  • Start the service:

    sudo sv start speaker_keepalive
    
  • Restart the service:

    sudo sv restart speaker_keepalive
    
  • Disable (remove from runit):

    sudo sv stop speaker_keepalive
    sudo rm /var/service/speaker_keepalive
    

View Logs

Logs are available at /var/log/speaker_keepalive/:

tail -f /var/log/speaker_keepalive/current

Requirements

  • sox package (provides the play command):

    sudo xbps-install sox
    
  • PipeWire audio system (the service connects to the user's PipeWire session)

  • chpst from runit (usually included with runit installation)

How It Works

The service runs as root but drops privileges to the target user to access their PipeWire audio session. Every 4 minutes, it plays a 100Hz sine wave at very low volume (0.1) for 1 second to keep the Bluetooth speaker active and prevent auto-disconnect.