Skip to main content

cmus - Get file size of currently playing song

This is a simple Bash script to show the file size of the song being currently played by cmus.

#!/usr/bin/env bash

# show size and filename
size=$(cmus-remote -Q | awk '/file/ {print $2}' | xargs du -h | awk '{print $1}')
name=$(cmus-remote -Q | awk '/file/ {print $2}' | xargs basename)

# zenity dialog
zenity --title=cmus-filesize --timeout=5 --info --text="[${size}] - ${name}"

Note: The script requires Zenity.

Save this file to a location of your choice, and then type the following at cmus' commandline:

bind -f common F2 shell /home/notfoss/bin/cmus-filesize

Change F2 with a key of your choice, and replace the path and filename accordingly.

Now, whenever you press the assigned key from within cmus, you will get something like:

cmus file size