Created
September 14, 2021 00:27
-
-
Save leogama/35961ec0d279e6cf409f783c3851569e to your computer and use it in GitHub Desktop.
Script to setup PulseAudio equalizer module + qpaeq GUI as a desktop application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -ux | |
# This is a small script to setup the PulseAudio equalizer as a desktop | |
# application that runs just when the 'qpaeq' GUI is open. | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or distribute | |
# this software, either in source code form or as a compiled binary, for any | |
# purpose, commercial or non-commercial, and by any means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors of | |
# this software dedicate any and all copyright interest in the software to | |
# the public domain. We make this dedication for the benefit of the public | |
# at large and to the detriment of our heirs and successors. We intend this | |
# dedication to be an overt act of relinquishment in perpetuity of all | |
# present and future rights to this software under copyright law. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
# THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | |
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
# | |
# For more information, please refer to <https://unlicense.org> | |
pulseaudio_dir="${XDG_CONFIG_HOME:-$HOME/.config}/pulse" | |
executable_dir="$HOME/.local/bin" | |
application_dir="${XDG_DATA_HOME:-$HOME/.local/share}/applications" | |
executable_name=pulseaudio-equalizer | |
case ":$PATH:" in | |
*:"$executable_dir":*) | |
app_exec=$executable_name | |
;; | |
*) | |
executable_dir="$(dirname $application_dir)" | |
app_exec="$executable_dir/$executable_name" | |
;; | |
esac | |
pulseaudio_file="$pulseaudio_dir/default.pa" | |
executable_file="$executable_dir/$executable_name" | |
application_file="$application_dir/pulseaudio-equalizer.desktop" | |
mkdir -p "$pulseaudio_dir" "$executable_dir" "$application_dir" | |
cat >"$pulseaudio_file" <<EOF | |
.include /etc/pulse/default.pa | |
# Needed by module-equalizer-sink. | |
load-module module-dbus-protocol | |
EOF | |
cat >"$executable_file" <<'EOF' | |
#!/bin/sh | |
pactl load-module module-equalizer-sink | |
pactl set-default-sink "$(pactl list sinks short | awk '/equalizer/ { print $2 }')" | |
qpaeq | |
pactl unload-module module-equalizer-sink | |
EOF | |
cat >"$application_file" <<EOF | |
[Desktop Entry] | |
Name=PulseAudio Equalizer | |
GenericName=Sound Equalizer | |
Type=Application | |
Terminal=false | |
Exec=${app_exec} | |
TryExec=qpaeq | |
StartupWMClass=qpaeq | |
Icon=audio-headphones | |
Categories=Qt;AudioVideo; | |
EOF | |
chmod +x "$executable_file" | |
pulseaudio --kill | |
pulseaudio --start | |
echo 'Setup finished!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Criziz21 Why? How? If something went wrong, simply delete the created files and restart your PC at most. You should be fine.