Add TOML config, playerctl dep, and media button defaults; bump to v1.1.0

- Switch config format from JSON to TOML (tomllib built-in on 3.11+,
  tomli fallback for 3.10) so the generated config can include comments
- Write an annotated config.toml on first run with descriptions for every
  knob/button and hints for all available actions
- Promote playerctl from optdepends to depends so media buttons work
  out of the box
- Default buttons 1–3 now pre-configured for playerctl previous/play-pause/next
- Rename contrib/config.example.json → config.example.toml with full
  TOML rewrite including per-knob LED colour override examples
- Log a migration hint when a legacy config.json is detected
This commit is contained in:
Sean Doran committed 2026-02-27 14:38:36 -05:00
1 parent 2e77bf804e
commit 916541d815
9 files changed
+281 -117

No files matched your search

-56
View File
@@ -1,56 +0,0 @@
{
"port": "/dev/ttyACM0",
"baud": 115200,
"leds": {
"mode": "volume",
"low_color": [255, 0, 0],
"high_color": [0, 255, 0]
},
"knobs": {
"0": {
"action": "sink_volume",
"target": "default"
},
"1": {
"action": "group_volume",
"targets": ["vlc", "spotify", "Cider"],
"led": {
"mode": "volume",
"low_color": [255, 0, 0],
"high_color": [0, 0, 255]
}
},
"2": {
"action": "app_volume",
"target": "Brave",
"led": {
"mode": "static",
"high_color": [255, 165, 0]
}
},
"3": {
"action": "group_volume",
"targets": ["electron", "discord"],
"led": { "mode": "off" }
},
"4": {
"action": "source_volume",
"target": "default",
"led": {
"mode": "volume",
"low_color": [255, 0, 0],
"high_color": [0, 255, 255]
}
}
},
"buttons": {
"0": { "action": "mute_sink", "target": "default" },
"1": { "action": "command", "target": "playerctl previous" },
"2": { "action": "command", "target": "playerctl play-pause" },
"3": { "action": "command", "target": "playerctl next" },
"4": { "action": "mute_source", "target": "default" }
}
}
+98
View File
@@ -0,0 +1,98 @@
# turnup configuration — fully annotated example.
# Copy this file to ~/.config/turnup/config.toml and edit to taste.
# Changes are picked up automatically (no restart needed).
# Serial port your device enumerates as (check `ls /dev/ttyACM*`).
port = "/dev/ttyACM0"
baud = 115200
# ── LED settings ──────────────────────────────────────────────────────────────
[leds]
# Global LED behaviour — can be overridden per-knob via a [knobs.N.led] block.
#
# mode: "volume" — fade from low_color → high_color based on the knob position
# "static" — always show high_color regardless of volume
# "off" — LEDs disabled
mode = "volume"
low_color = [255, 0, 0] # red at 0 %
high_color = [0, 255, 0] # green at 100 %
# ── Knobs ─────────────────────────────────────────────────────────────────────
# Available actions:
# sink_volume — output device volume (0–150 %)
# source_volume — mic / input volume (0–100 %)
# app_volume — single application matched by name or binary; set target
# group_volume — multiple applications at once; set targets = ["app1", "app2"]
[knobs.0]
# Master output volume — uses global LED colours
action = "sink_volume"
target = "default"
[knobs.1]
# Media players — custom blue LED to distinguish from the others
action = "group_volume"
targets = ["vlc", "spotify", "Cider"]
[knobs.1.led]
mode = "volume"
low_color = [255, 0, 0]
high_color = [0, 0, 255] # blue at 100 %
[knobs.2]
# Browser — static orange LED (always on, no volume feedback)
action = "app_volume"
target = "Brave"
[knobs.2.led]
mode = "static"
high_color = [255, 165, 0]
[knobs.3]
# Chat apps — LED disabled for this knob
action = "group_volume"
targets = ["electron", "discord"]
[knobs.3.led]
mode = "off"
[knobs.4]
# Microphone / input — teal LED
action = "source_volume"
target = "default"
[knobs.4.led]
mode = "volume"
low_color = [255, 0, 0]
high_color = [0, 255, 255] # teal at 100 %
# ── Buttons ───────────────────────────────────────────────────────────────────
# Available actions:
# mute_sink — toggle output mute
# mute_source — toggle mic mute
# command — run an arbitrary shell command; set target = "command args"
[buttons.0]
# Mute output
action = "mute_sink"
target = "default"
[buttons.1]
# Previous track (requires playerctl)
action = "command"
target = "playerctl previous"
[buttons.2]
# Play / pause (requires playerctl)
action = "command"
target = "playerctl play-pause"
[buttons.3]
# Next track (requires playerctl)
action = "command"
target = "playerctl next"
[buttons.4]
# Mute microphone
action = "mute_source"
target = "default"