How can I copy currently played song to clipboard in ncmpcpp?

I can't find a way to copy a title of currently played song in ncmpcpp to clipboard.

Is there any shortcut to do this ?

Ubuntu Version: 19.10:

$ lsb_release -r
Release: 19.10

ncmpcpp 0.8.2:

$ ncmpcpp -v
ncmpcpp 0.8.2
optional screens compiled-in: - tag editor - tiny tag editor - outputs - visualizer - clock
encoding detection: enabled
built with support for: fftw ncurses taglib
2

1 Answer

Thanks to @K7AAY I have found an answer:

#!/bin/bash
SONG=`ncmpcpp --current-song -q`
echo "NAME: ${SONG}"
echo -n $SONG | xclip -selection c

Running above script will print song name and copy it to the clipboard.

$ ./get-current-song.sh
NAME: (-:--) Daniel Gomez - Two Ways [New York] 055 (18 December 2019) Hour 1
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like