VLC: Control Clone Window With Devilspie
My basic use case: automatically output whatever video I’m playing in fullscreen on another monitor. If I were using Windows and an ATI card, I’d call it theater mode. nVidia cards also used to have a similar setting related to outputting pure overlay video on another screen, but it was removed from nVidia’s drivers around the time of the release of Vista (and had been made buggy aspect-ratio wise a few years prior to that). Long story short, nVidia’s drivers have really degraded an awful lot since 2006 and I don’t like it one bit.
My answer to this problem is the VLC clone filter coupled with Devilspie, but sadly it’s not quite as straightforward as I’d like. Devilspie is a wonderful daemon that can automatically do everything you can do to windows like pinning, moving around, resizing, moving to another workspace, et cetera. In order to do this you need to come up with matching rules for windows, and sadly it’s a tad more limited in that respect than I’d like. Anyway, you’ll want to grab gDevilspie with
apt-get gdevilspie (or
sudo apt-get gdevilspie, of course), which should automatically pull in devilspie as a dependency.
Since VLC is named VLC media player when it’s not playing anything, and clone video windows are also named VLC media player, I was having trouble coming up with a means of affecting clone windows without messing up my main window. Then I stumbled on the video-title setting in
~./config/vlc/vlcrc and changed it to VLC Clone Window (I couldn’t find this setting in the GUI). Now matching it in Devilspie was a piece of cake. The primary VLC window is still named VLC media player whereas the clone windows are now named VLC Clone Window.
# Video title (string) video-title=VLC Clone Window
What follows is something I couldn’t have written as quickly without gDevilspie, but I had to switch some commands around (like putting geometry first instead of last) to obtain the precise situation I wanted, for otherwise VLC returns the window to the original monitor when exiting fullscreen.
( if ( begin ( is ( window_name ) "VLC Clone Window" ) ) ( begin ( geometry "+1280+0" ) ( maximize ) ( undecorate ) ( above ) ( pin ) ) )
Now that I got the gist of the syntax I decided to also pin the smaller window on top and extended the configuration file. The official man page is rather lacking, so I recommend foosel’s unofficial documentation instead (via ruario). You can find the generated files, or make your own, in
( if ( contains (application_name) "VLC") ( begin (if ( is ( window_name ) "VLC Clone Window" ) ( begin ( geometry "+1280+0" ) ( maximize ) ( undecorate ) ( above ) ( pin ) ) ) (if ( contains ( window_name ) "VLC media player" ) ( begin ( above ) ( pin ) ) ) ) )
I think that’s fairly self-explanatory. My hope is that matching the application name to VLC will make sure that any other application with a window_name that contains VLC media player for some reason (or VLC Clone Window) will be unaffected.
If you didn’t find this quite as enlightening as you’d hoped, once you’re in gDevilspie everything’s pretty much explained in there, and otherwise the documentation I linked to should be of assistance. The only thing above I’d consider somewhat puzzling at a glance is the offset. The resolution of my monitor is 1280×1024, so the x offset of +1280 makes sure that everything’s on the correct monitor before maximizing. You can also set a window size, so then it’s xwidth x ywidth + xoffset + yoffset all mashed together (or instead of + I imagine you can also use -).
The only problem with this solution is that it’ll put all clone windows on the same monitor. Even though this satisfies my specific use case, I still want to match windows depending on the number of previous also-matched ones still active. For example I can imagine something akin to a tiling window manager on a particular workspace with terminal emulators, except driven by Devilspie and in just about any WM there is (although one might be able to work around that in this particular example with some bash scripting).
[…] is mostly the same post as that one in early 2011, but updated a little for […]
December 20, 2012 @ 14:59Permalink
VLC: Control Clone Window With Devilspie2 | The One with the Thoughts of Frans