Skip to navigation

Quod Libet plugin “Open terminal here”

I think I “wrote” a plugin for Quod Libet. “Wrote” meaning I copied and modified an existing plugin until it did what I want it to do: it opens an Xfce terminal window in the directory that contains the current song. I’m pretty sure I wrote this file, but it was back in November, I didn’t put an appropriate comment in the plugin file, so if anyone else wants to claim authorship, go ahead and let me know.

Just create a file “openterminal.py” with the following content:

import gtk
from qltk import ErrorMessage
from plugins.songsmenu import SongsMenuPlugin
from qltk.entry import ValidatingEntry
import util
import config
import os

class BrowseFolders(SongsMenuPlugin):
    PLUGIN_ID = 'Open Terminal'
    PLUGIN_NAME = _('Open Terminal')
    PLUGIN_DESC = "Open an XFCE terminal at this location"
    PLUGIN_ICON = 'gtk-about'
    PLUGIN_VERSION = '0.1'

    def plugin_songs(self, songs):
        dirs = dict.fromkeys([song('~dirname') for song in songs]).keys()[0]
        os.system('xfce4-terminal --working-directory=%s' % dirs)

Put it either into the directory ~/.quodlibet/plugins/songsmenu (then it will only work for you) or into /usr/share/quodlibet/plugins/songsmenu/ for system-wide installation.

It works for me, but it may contain errors. Use at your own risk.

Comments are closed.