Sometimes, when you are working, you need some background noise or music. I have been using mplayer to play music videos. I already knew -loop 0 option can loop the video. However, mplayer recreates window every restart, which is quite annoying. But that does how it works.

Luckily, mplayer is a mature software, it has lots of options to fit your needs. So, the following came out to rescue me a bit:

mplayer -vo x11 -loop 0 -geometry 360x201+1320+826 -ontop -zoom video.file

Now, it’s positioned and always ontop every replay. Nonetheless, desires grow while your needs being fed. I started to want to have window with transparency. So, I firstly installed xcompmgr to my Gentoo with Fluxbox.

Here is a quick sidenote if you also use conky, conky can not work with xcompmgr nicely when settings are not right. You may need to use the following settings1 in your ~/.conkyrc:

own_window yes
own_window_transparent yes
own_window_type desktop

Another side note for video output driver of mplayer, when xcompmgr enables, the valid options seem to be xv, x11, xshm, gl, gl2. I can only get x11 to fully worked. xshm totally can’t work, gl has audio sparkling, gl2 won’t render image anymore after the window lost focus. xv is actually still working, but you will see scanning line (not sure if that is the term).

Now, back to transparency, this should be window manager setting. In Fluxbox, you can use ~/.fluxbox/apps to configure applications’ settings.

[app] (name=x11) (class=MPlayer)
  [Deco]    {NONE}
  [Alpha]   {192}
  [Layer]   {2}
  [Hidden]  {yes}
[end]

Note that Hidden option is for not letting window show up in window list and not being selected by Alt+Tab.

I have tried to get window id and use transset-df to set the transparency by window id. However, the only way I know to get the window id is by using xlsclient, unfortunately, the mplayer’s video window doesn’t show up in the list (using gmplayer to play will do). Because of that, I have to use Fluxbox’s apps configuration to make all mplayer windows have same setting, this is a drawback which I don’t like. I have thought about setting window’s name, but mplayer doesn’t support that.

Things are not always be good or can be resolved, there is a major problem with mplayer, and I couldn’t resolve it yet: every time the window recreates, it also gets the focus, that is default action for WM. If you know how to get rid of that, please tell me.

Some of you might wonder why not just use GUI player, such as totem or VLC, the reason is quite simple: I don’t like them. I like being drowned in man pages and numerous options, sometimes. Options provide precise and fast actions after properly configuring. Pay your time once, enjoy the rest of your life.

[1]http://crunchbang.org/archives/2008/03/02/openbox-xcompmgr-transset-and-conky/ is gone.