[HowTo] Create a KDE Service Menu for VLC

This service is simple, but useful for when you want to play on VLC a music or video playlist.

The ServiceMenu will be created in ~/.local/share/kservices5/ServiceMenus/

If that path doesn’t exist for your user, create it with:

mkdir -p ~/.local/share/kservices5/ServiceMenus

Create addtovlc.desktop with kate:

kate ~/.local/share/kservices5/ServiceMenus/addtovlc.desktop

Add the lines:

[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=audio/*;video/*;inode/directory;
Actions=AddToVLC;
X-KDE-Priority=TopLevel
X-KDE-StartupNotify=false
Icon=image

[Desktop Action AddToVLC]
Name=Add to VLC playlist
Name[de]=Zur VLC Wiedergabeliste hinzufügen
Name[fr]=Ajouter à liste de lecture VLC
Name[es]=Agregar a la lista de reproducción de VLC
Name[hr_HR]=Dodaj na popis za reproduciranje
Name[nl]=Toevoegen aan VLC-afspeellijst
Name[da]=Tilføj til VLC afspilningsliste
Name[pt]=Adicionar à lista de reprodução do VLC
Name[nb]=Legg til VLC spilleliste
Name[pt_BR]=Adicionar à playlist do VLC
Name[ru_RU]=Добавить в плейлист VLC
Name[sr]=Dodaj u vlc plejlistu
Exec=/usr/bin/vlc --one-instance --playlist-enqueue %U
Icon=vlc-panel

Please notice that you may need to run chmod to make sure it will work with your user.

chmod +x addtovlc.desktop 

That’s it!

Restart dolphin and enjoy.

4 Likes
  • the path did not exist for my user, for the sake of tutorials better create it initially:
$ mkdir -p 
  • using kate to create the file is enough - no need to touch it beforehand
  • final chmod is unnessesary, it works just fine without it on my machne

Localization of that menu entry is possible, for example for German one can add Name[de]:

Name=Add to VLC playlist
Name[de]=Zur VLC Wiedergabeliste hinzufügen
1 Like

Ah I didn’t know that. I just followed KDE documentation on its website. Makes it easier if you don’t.

I will edit the post with your feedback. Cheers very much.

I’ve added some translations, but it’s rather an attempt.

1 Like

On my machine though, vlc cannot be executed unless chmod +x is done first on the .desktop file.

I’ve added it back to the text, just in case.

Works perfectly, thank you :+1:

Could you add functionality to be able to select multiple files/dirs tobe added to the playlist with one action? :thinking:
Cause the option only shows on single files, it needs to become:

MimeType=audio/*;video/*;inode/directory;

:wink:

Disclaimer: after that change the icon on the taskbar for Dolpin changes to VLC, so you need to re-add the icon to the taskbar, no idea why but thats what just happened to me.

1 Like

Hey, many thanks for this! I’ve gladly added your suggestion!

1 Like