1

I was not able to change the default app in raspbian (lxde and pcmanfm) when right clicking and using the corresponding menu entries and the checkbox.

The lists that contain the default associations as described here: https://lkubaski.wordpress.com/2012/10/29/understanding-file-associations-in-lxde-and-pcmanfm/ were missing in my raspbian installation.

I want omxplayer to open inside a terminal upon opening a video file

3

You can find the config in ~/.config/mimeapps.list

This how it looks for me after editing it:

[Default Applications]
inode/directory=pcmanfm.desktop
audio/mpeg=userapp-mocp-WXKY0Y.desktop
video/mp4=userapp-omxplayer.desktop

[Added Associations]
inode/directory=pcmanfm.desktop;
image/jpeg=chromium-browser.desktop;
audio/mpeg=userapp-mocp-WXKY0Y.desktop;
video/mp4=userapp-omxplayer.desktop;

The .desktop file has to be in ~/.local/share/applications/userapp-omxplayer.desktop:

[Desktop Entry]
Type=Application
Name=omxplayer
Exec=lxterminal -e omxplayer -b %f
Categories=Video
Terminal=false
X-KeepTerminal=false

It is important that the terminal is open, because once you start omxplayer without a terminal you won't be able to close it easily.

For me, using Terminal=false caused the terminal not to be focused, so I needed to switch to it first (alt + tab) to use keyboard shortcuts. That's why I'm using lxterminal -e. Make sure to use a terminal emulator that is installed on your system, it should also work with any other one that can accept commands as argument.

You can now double-click .mp4 video files and a terminal will open up that will spawn omxplayer.

The %f term is the placeholder for the filename.

-b will cause the screen around the video to go black.

2
  • 1
    "once you start omxplayer without a terminal you won't be able to close it" That's a bit of jumping to conclusions right there, don't you think? There's plenty of methods to kill it, just not as easily as when the terminal is enabled.
    – Mast
    Dec 9 '17 at 14:19
  • I have just corrected that
    – sezanzeb
    Dec 24 '17 at 16:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.