[中文](README.zh_CN.md) | English

# ukui-media

Media utilities for the [UKUI](https://www.ukui.org/) desktop environment.

## Overview

ukui-media provides the core audio management components for UKUI, including a
system tray volume control, a control center audio settings plugin, sound theme
playback, login sound, and hardware mute LED control. It originated as a fork of
MATE Media and has been substantially rewritten with Qt 6 and PulseAudio
integration.

## Components

| Directory | Binary / Plugin | Description |
|-----------|----------------|-------------|
| `ukui-volume-control-applet-qt/` | `ukui-volume-control-applet-qt` | System tray applet with volume slider, per-application controls, OSD, headset selection popup, and Bluetooth battery monitoring. Exposes `org.ukui.media` on the session D-Bus. |
| `audio/` | `libaudio.so` (plugin) | Audio settings plugin for **ukui-control-center**. Provides output/input device selection, volume & balance, sound effects/themes, mono audio, noise reduction, and boot/shutdown sound toggles. |
| `sound-theme-player/` | `sound-theme-player` | D-Bus service (`org.ukui.sound.theme.player`) that plays sound theme events (volume changes, notifications) via libcanberra. |
| `ukui-login-sound/` | `ukui-login-sound` | Plays the startup sound using ALSA directly. Supports per-user configuration and first-login detection. |
| `ukui-media-control-led/` | `ukui-media-control-led` | Daemon that listens for mute state signals on the system D-Bus and drives hardware mute/mic-mute LEDs via sysfs. Runs as a systemd service. |
| `common/` | (shared source) | Shared utilities: volume conversion, system version detection, JSON config I/O, GSettings/D-Bus constants. |
| `configuration/` | (data) | PulseAudio ALSA mixer path and profile-set configurations for specific hardware (USB audio devices, Chinese-market PCs). Includes udev rules. |
| `scripts/` | (shell scripts) | Sound card adaptation script and output-mode detection helper. |
| `data/` | (data) | GSettings schemas, icons, desktop files, systemd unit. |
| `tests/` | (unit tests) | Google Test suites for each component with gcov coverage support. |

## D-Bus Interfaces

- **`org.ukui.media`** (session bus, `/org/ukui/media`) — Volume control applet.
  Get/set default devices, volume, mute; per-application audio routing;
  Bluetooth battery level (`org.ukui.media.bluetooth`).

- **`org.ukui.sound.theme.player`** (session bus) — Sound theme player.
  `playAlertSound(QString soundEvent)`.

- **`org.ukui.media`** (system bus) — LED control daemon.
  Listens for `systemOutputVolumeIsMute` / `systemInputVolumeIsMute` signals.

## Build Dependencies

**Qt 6:** `qt6-base-dev` `qt6-svg-dev` `qt6-tools-dev-tools`

**Audio:** `libasound2-dev` `libcanberra-dev` `libpulse-dev` `libsndfile1-dev`

**GLib / GIO:** `libglib2.0-dev` `libdconf-dev`

**UKUI / Kylin SDK:** `libukcc-dev` `libukui-log4qt-dev` `libgsettings-qt6-dev`
`libkysdk-applications-dev` `libkysdk-system-dev` `libkf6windowsystem-dev`

**Other:** `libxml2-dev` `libxext-dev` `intltool`

**Testing (optional):** `libgtest-dev`

## Building

### Quick build

```bash
qmake6 PREFIX=/usr
make -j$(nproc)
```

### Install

```bash
sudo make install
```

### Debian package

```bash
sudo apt build-dep .
debuild -us -uc
```

## Running Tests

```bash
cd tests
qmake6
make -j$(nproc)
./unit_test_sound_theme_player/unit_test_sound_theme_player
# ... or run all test binaries
```

## Project Structure

```
ukui-media/
├── audio/                          # Control center audio plugin
├── ukui-volume-control-applet-qt/  # System tray volume applet
├── sound-theme-player/             # Sound theme D-Bus service
├── ukui-login-sound/               # Login sound player
├── ukui-media-control-led/         # Hardware mute LED daemon
├── common/                         # Shared library code
├── configuration/                  # PulseAudio hardware configs
├── scripts/                        # Sound card adaptation scripts
├── data/                           # Schemas, icons, desktop files
├── tests/                          # Unit tests (gtest)
├── man/                            # Manual pages
├── debian/                         # Debian packaging
└── ukui-media.pro                  # Top-level qmake project
```

## License

ukui-media is licensed under the GNU General Public License v2.0 or later.
See [COPYING](COPYING) for the full license text. Individual components may
carry different licenses — see [debian/copyright](debian/copyright) for
details.

## Links

- Homepage: <https://gitee.com/openkylin/ukui-media>
- Bug tracker: <https://gitee.com/openkylin/ukui-media/issues>
- Debian packaging: <https://salsa.debian.org/kylin-team/ukui-media>
