Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
78 lines (56 sloc) 2.06 KB
title slug category tags
Fast Clementine music selection via dmenu
ubuntu, clementine, bash

If you prefer keyboard over mouse like I do, you'll probably want a keyboard way of selecting music to be played.

We can use dmenu to go through our Music collection and make a auto-complete suggestion list to select Music from.

Default selection view. Start typing letters to filter the collection.

We'll need to have some packages installed:

sudo apt-get install dmenu clementine xbindkeys

Save the following script (I named it and chmod +x it:


function handleSelection {
  if [[ $1 ]]; then
    if [ $flag == 'append' ]; then
      msg="Appended songs"
      msg="Loaded songs"
    notify-send -i clementine "$msg" "$folder"
    if [ $flag == 'load' ]; then clementine --stop; fi
    clementine --$flag "/home/$( whoami )/Music/$folder"
    if [ $flag == 'load' ]; then clementine --play; fi

  exit 0

# If clementine's not running, start it!
if ! pgrep -x clementine >/dev/null; then
  clementine &

handleSelection "$( cd /home/$( whoami )/Music; ls -d */* | dmenu_custom )"

exit 0

Be sure to replace and or edit the Music path at the bottom of the script if you don't have a standard Music folder structure. Otherwise, it should work out of the box. The usage is quite simple, pass either append - to append the folder to the current playlist or load (which is default) - to replace the current playlist - option: load

or append

To set a global keyboard shortcut, I used xbindkeys. Relevant part of my .xbindkeysrc:

"~/scripts/ load"
  Mod4 + m

"~/scripts/ append"
  Mod4 + Shift + m

That's all folks, enjoy :)