configs

configs
git clone https://git.prime8.dev/configs.git
Log | Files | Refs | README

commit e25f74fa290cf82c02d156897080c07e17d9e94d
parent 89e0ae5944c2df354a95c7d19dc992aac4c9e4e4
Author: Damian Myrda <damian@prime8.dev>
Date:   Fri, 23 Jan 2026 13:20:11 -0600

add g14-volume-sync systemd user service

Diffstat:
Mlink.sh | 8++++++++
Aprograms/systemd/g14-volume-sync | 41+++++++++++++++++++++++++++++++++++++++++
Aprograms/systemd/user/g14-volume-sync.service | 13+++++++++++++
3 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/link.sh b/link.sh @@ -55,4 +55,12 @@ link_config "$PROGRAMS_DIR/karabiner/assets" "$CONFIG_DIR/karabiner/assets" link_config "$PROGRAMS_DIR/zed/settings.json" "$HOME/.var/app/dev.zed.Zed/config/zed/settings.json" link_config "$PROGRAMS_DIR/zed/keymap.json" "$HOME/.var/app/dev.zed.Zed/config/zed/keymap.json" +# Systemd user services +link_config "$PROGRAMS_DIR/systemd/user/g14-volume-sync.service" "$CONFIG_DIR/systemd/user/g14-volume-sync.service" +mkdir -p "$HOME/.local/bin" +link_config "$PROGRAMS_DIR/systemd/g14-volume-sync" "$HOME/.local/bin/g14-volume-sync" +chmod +x "$HOME/.local/bin/g14-volume-sync" +systemctl --user daemon-reload +systemctl --user enable --now g14-volume-sync.service 2>/dev/null || true + echo "✅ Config symlinks complete!" diff --git a/programs/systemd/g14-volume-sync b/programs/systemd/g14-volume-sync @@ -0,0 +1,41 @@ +#!/bin/bash +# Sync AMP1/AMP2 Speaker volume with Master volume for ASUS G14 2025 +# Scales bass to maintain balance across volume range + +sync_volume() { + # Get Master volume percentage (0-100) + master_vol=$(amixer -c 3 sget Master | grep -oP '\[\d+%\]' | head -1 | tr -d '[]%') + + if [[ -n $master_vol ]]; then + # AMP range is 0-448, where 400 = 0dB (unity gain) + # At low master volumes, bass needs to be reduced more aggressively + # to maintain balance with tweeters + # + # Formula: Scale AMP volume so bass doesn't overpower at low volumes + # At master 100% -> AMP at 400 (0dB) + # At master 50% -> AMP at ~350 + # At master 10% -> AMP at ~200 + # This gives roughly matched perceived loudness + + # Calculate AMP value: base of 150 + scaled portion up to 250 more + amp_val=$((150 + (master_vol * 250 / 100))) + + # Clamp to valid range + if ((amp_val > 400)); then + amp_val=400 + fi + if ((amp_val < 50)); then + amp_val=50 + fi + + amixer -c 3 -q sset 'AMP1 Speaker' "$amp_val" + amixer -c 3 -q sset 'AMP2 Speaker' "$amp_val" + fi +} + +# Use pactl subscribe to watch for volume changes +pactl subscribe | grep --line-buffered "sink" | while read -r line; do + if [[ $line == *"change"* ]]; then + sync_volume + fi +done diff --git a/programs/systemd/user/g14-volume-sync.service b/programs/systemd/user/g14-volume-sync.service @@ -0,0 +1,13 @@ +[Unit] +Description=Sync G14 bass speaker volume with master volume +After=pipewire.service wireplumber.service +Wants=pipewire.service + +[Service] +Type=simple +ExecStart=/var/home/moncheeta/.local/bin/g14-volume-sync +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=default.target