Skip to content

ravachol/kew

Repository files navigation

kew

GitHub license

Listen to music in the terminal.

Example screenshot
Example screenshot running in Konsole: Jenova 7: Lost Sci-Fi Movie Themes.

kew (/kjuː/) is a terminal music player.

Features

  • Search a music library with partial titles.
  • Creates a playlist based on a matched directory.
  • Control the player with previous, next and pause.
  • Edit the playlist by adding and removing songs.
  • Supports gapless playback (between files of the same format and type).
  • Supports MP3, FLAC, MPEG-4 (AAC, M4A), OPUS, OGG and WAV audio.
  • Supports desktop events through MPRIS.
  • Private, no data is collected by kew.

Installing

Packaging status

Installing with package managers

kew is available from Ubuntu 24.04.

sudo apt install kew         (Debian, Ubuntu)
sudo yay -S kew              (Arch Linux, Manjaro)
sudo yay -S kew-git          (Arch Linux, Manjaro)
sudo zypper install kew      (OpenSUSE)
sudo pkg install kew         (FreeBSD)
brew install kew             (macOS, Linux)

Building the project manually

kew dependencies are:

  • FFTW
  • Chafa
  • libopus
  • opusfile
  • libvorbis
  • TagLib
  • faad2 (optional)
  • libogg
  • pkg-config
  • glib2.0
  • libnotify (optional)

Note: TagLib, faad2 and libogg have replaced FFmpeg.

Install these dependencies using your distro's package manager. For instance:

For Debian/Ubuntu:

sudo apt install -y pkg-config libfaad-dev libtag1-dev libfftw3-dev libopus-dev libopusfile-dev libvorbis-dev libogg-dev git gcc make libchafa-dev libnotify-dev

For Arch Linux:

sudo pacman -Syu --noconfirm --needed pkg-config faad2 taglib fftw git gcc make chafa glib2 opus opusfile libvorbis libogg libnotify

For macOS:

brew install gettext faad2 taglib chafa fftw opus opusfile libvorbis libogg glib pkg-config make git

Notes for mac users:

  1. A sixel-capable terminal like kitty or WezTerm is recommended for macOS.
  2. The visualizer and album colors are disabled by default on macOS, because the default terminal doesn't handle them too well. To enable press v and i respectively.

For Fedora:

dnf install -y pkg-config taglib-devel fftw-devel opus-devel opusfile-devel libvorbis-devel libogg-devel git gcc make chafa-devel libnotify-devel libatomic gcc-c++

Option: add libfaad-devel for AAC,M4A support (Requires RPM-fusion to be enabled).

For OpenSUSE:

sudo zypper install -y pkg-config taglib-devel fftw-devel opus-devel opusfile-devel libvorbis-devel libogg-devel git chafa-devel gcc make libnotify-devel

Option: add libfaad-devel for AAC,M4A support (Requires RPM-fusion and Packman to be enabled).

For CentOS/RHEL:

Requires RPM-fusion to be enabled.

sudo yum install -y pkgconfig taglib-devel fftw-devel opus-devel opusfile-devel libvorbis-devel libogg-devel git gcc make chafa-devel libnotify-devel

Option: add libfaad2-devel for AAC,M4A support (Requires RPM-fusion to be enabled).

For Solus

sudo eopkg install -y pkg-config faad2-devel taglib-devel fftw-devel opus-devel opusfile-devel libvorbis-devel libogg-devel git gcc make chafa-devel libnotify-devel

For Guix

guix install pkg-config faad2 taglib fftw git gcc make chafa opus opusfile libvorbis libogg libnotify

For Void Linux

sudo xbps-install -y pkg-config faad2 taglib fftw git gcc make chafa opus opusfile libvorbis libogg libnotify-devel

For Alpine Linux

sudo apk add pkgconfig faad2 faad2-dev taglib-dev fftw-dev opus opusfile libvorbis-dev libogg-dev git build-base chafa-dev libnotify-dev

Notice that for some packages not only the library needs to be installed, but also development packages, for instance libopus-dev or opus-devel.

Then run this (either git clone or unzip a release zip into a folder of your choice):

git clone https://github.com/ravachol/kew.git
cd kew
make -ij4
sudo make install

Uninstalling

If you installed kew manually, simply run:

sudo make uninstall

LibNotify and Faad2 are optional

By default, the build system will automatically detect if libnotify and faad2 are available and include them if found.

Libnotify provides desktop notifications and Faad2 provides AAC decoding.

Standalone AppImage for musl systems

If you are running a musl-based system, for instance Alpine Linux, you can download a standalone appImage of kew:

https://github.com/ravachol/kew/releases/tag/stable-musl

Terminals

A sixel (or equivalent) capable terminal is recommended, like Konsole or kitty, to display images properly.

For a complete list of capable terminals, see this page: Sixels in Terminal.

Usage

Run kew. It will first help you set the path to your music folder, then show you that folder's contents.

kew can also be told to play a certain music from the command line. It automatically creates a playlist based on a partial name of a track or directory:

kew cure great

This command plays all songs from "The Cure Greatest Hits" directory, provided it's in your music library.

kew returns the first directory or file whose name matches the string you provide. It works best when your music library is organized in this way: artist folder->album folder(s)->track(s).

Some Examples:

kew (starting kew with no arguments opens the library view where you can choose what to play)

kew all (plays all songs, up to 20 000, in your library, shuffled)

kew albums (plays all albums, up to 2000, randomly one after the other)

kew moonlight son (finds and plays moonlight sonata)

kew moon (finds and plays moonlight sonata)

kew beet (finds and plays all music files under "beethoven" directory)

kew dir <album name> (sometimes it's necessary to specify it's a directory you want)

kew song <song> (or a song)

kew list <playlist> (or a playlist)

kew shuffle <album name> (shuffles the playlist)

kew artistA:artistB:artistC (plays all three artists, shuffled)

kew --help, -? or -h

kew --version or -v

kew --nocover

kew --noui (completely hides the UI)

kew -q <song>, --quitonstop (exits after finishing playing the playlist)

kew -e <song>, --exact (specifies you want an exact (but not case sensitive) match, of for instance an album)

kew . loads kew.m3u

kew path "/home/joe/Musik/" (changes the path)

Put single-quotes inside quotes "guns n' roses"

Views

In kew, you normally add songs to the playlist in Library View F3. Then you can see the playlist in Playlist View F2.

There is also Track View F4 for seeing song info and cover. Search View is F5 and Help View is F6.

Key Bindings

  • Use + (or =), - keys to adjust the volume.
  • Use , or h, l keys to switch tracks.
  • Space, p to toggle pause.
  • F2 or Shift+z to show/hide the playlist.
  • F3 or Shift+x to show/hide the library.
  • F4 or Shift+c to show/hide the track view.
  • F5 or Shift+v to search.
  • F6 or Shift+b to show/hide key bindings.
  • u to update the library.
  • v to toggle the spectrum visualizer.
  • i to switch between using your regular color scheme or colors derived from the track cover.
  • b to toggle album covers drawn in ascii or as a normal image.
  • r to repeat the current song.
  • s to shuffle the playlist.
  • a to seek back.
  • d to seek forward.
  • x to save the currently loaded playlist to a m3u file in your music folder.
  • Tab to switch between views.
  • gg go to first song.
  • number +G, g or Enter, go to specific song number in the playlist.
  • g go to last song.
  • . to add current song to kew.m3u (run with "kew .").
  • Esc to quit.

Configuration

kew will create a config file, kewrc, in a kew folder in your default config directory for instance ~/.config/kew. There you can change some settings like key bindings and the default colors of the app. To edit this file please make sure you quit kew first.

Nerd Fonts

kew looks better with Nerd Fonts: https://www.nerdfonts.com/.

License

Licensed under GPL. See LICENSE for more information.

Attributions

kew makes use of the following great open source projects:

Chafa by Petter Jansson - https://hpjansson.org/chafa/

TagLib by TagLib Team - https://taglib.org/

faad2 by fabian_deb, knik, menno - https://sourceforge.net/projects/faac/

FFTW by Matteo Frigo and Steven G. Johnson - https://www.fftw.org/

Libopus by Opus - https://opus-codec.org/

Libvorbis by Xiph.org - https://xiph.org/

Miniaudio by David Reid - https://github.com/mackron/miniaudio

Img_To_Txt by Danny Burrows - https://github.com/danny-burrows/img_to_txt

Comments? Suggestions? Send mail to kew-music-player@proton.me.