Files
ncspot/doc/developers.md
Thomas Frans 0cee99ba4c feat: add info command line subcommand (#1330)
* feat: add `info` command line subcommand

Adding an info command allows the documentation to refer to it when
mentioning platform specific information. This gives users a nicer
experience since they don't need to think about how `ncspot` will behave
on their system, but can run `ncspot info` to get that information.

* fix: info command don't create runtime directory

* fix: don't print runtime path on Windows

Windows doesn't use the runtime path so it shouldn't be printed there.

* fix: make `info` command easier to parse

* docs: add back the default configuration directory
2023-11-27 08:43:55 +01:00

3.1 KiB

Development

Prerequisites

On Linux, you also need:

  • pkgconf (sometimes called pkg-config)
  • Development headers for the aforementioned runtime dependencies:
    • Debian and derivatives:
      sudo apt install libdbus-1-dev libncursesw5-dev libpulse-dev libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
      
    • Fedora:
      sudo dnf install dbus-devel libxcb-devel ncurses-devel openssl-devel pulseaudio-libs-devel
      
    • Arch and derivatives:
      # headers are included in the base packages
      sudo pacman -S dbus libpulse libxcb ncurses openssl
      

Debugging

For simple debugging, you can pass a debug log filename:

cargo run -- -d debug.log

It can be difficult to debug a TUI application as it might not run well in an IDE terminal or the terminal could be used by the text editor. It is however possible to run ncspot in its own process and attach a debugger. On Linux this can be achieved with gdb or lldb. It is important that ptrace is disabled for this to work. To disable it, execute echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope. This will allow any process to inspect the memory of another process. It is automatically re-enabled after a reboot.

If ncspot has crashed you can find the latest backtrace at $NCSPOT_CACHE_DIRECTORY/backtrace.log. The cache directory can be shown by running ncspot info.

Compiling

Compile and install the latest release with cargo-install:

cargo install ncspot

Or clone and build locally:

git clone https://github.com/hrkfdn/ncspot
cargo build --release

You may need to manually set the audio backend on non-Linux OSes. See Audio Backends.

Audio Backends

ncspot uses PulseAudio by default. Support for other backends can be enabled with the following commands.

PortAudio for BSD's or macOS

cargo build --no-default-features --features portaudio_backend,pancurses_backend

Rodio for Windows

cargo build --no-default-features --features rodio_backend,pancurses_backend

Other Features

Here are some auxiliary features you may wish to enable:

Feature Default Description
cover off Add a screen to show the album art.
mpris on Control ncspot via dbus. See Arch Wiki: MPRIS.
notify on Send a notification to show what's playing.
share_clipboard on Ability to copy the URL of a song/playlist/etc. to system clipboard.

Consult Cargo.toml for the full list of supported features.