Pause Spotify when the mute
key is pressed on Debian-based operating systems.
- go 1.23.0 or above
- make (if you want to use the
Makefile
provided) - Debian based OS e.g. Ubuntu
- Spotify installed from https://www.spotify.com/us/download/linux/ (NOT the snap version)
Build the binary pausefy
executable to the directory ./bin
i.e. ./bin/pausefy
.
make
Starts the application ./bin/pausefy
as a background process and stores the process ID (PID) to the file ./scripts/pid. The process output i.e. STDOUT is written to the file ./scripts/nohup.out.
make start
Stops the application ./bin/pausefy
, using the process ID (PID) stored in the file ./scripts/pid as well as removing the files ./scripts/pid and ./scripts/nohup.out.
make stop
Display the version of the application and exit.
# As text
./bin/pausefy --version
# As JSON
./bin/pausefy --json --version
Display the help text and exit.
./bin/pausefy --help
IMPORTANT: One dependency is used, which is an adapter for dbus
.
I could easily use Cobra (and usually I do, because it allows me to write powerful CLIs), but I felt it was too much for such a tiny project. I only ever use dependencies when it's say an adapter for an external service e.g. Redis, MySQL or Prometheus.
Docker
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:latest golangci-lint run -v --tests=false --disable-all -E durationcheck,errorlint,exhaustive,gocritic,gosimple,ineffassign,misspell,predeclared,revive,staticcheck,unparam,unused,whitespace --max-issues-per-linter=10000 --max-same-issues=10000
Local
golangci-lint run --tests=false --disable-all -E durationcheck,errorlint,exhaustive,gocritic,gosimple,ineffassign,misspell,predeclared,revive,staticcheck,unparam,unused,whitespace --max-issues-per-linter=10000 --max-same-issues=10000
The code has been licensed under the MIT license.