viewport

Wmctrl Recap – Placing Windows Automatically on Boot – Compiz Viewports

Wmctrl allows you to move windows around the screen, resize windows and other options. For a full list of options use: wmctrl --help For compiz, the desktop is extended in either/and the x y directions. For example if you have 4 sides to the cube your x direction is extended 4 times. If you desktop is 1920 wide, then the second viewport, or the second side of the cube starts at x position 1921. To move a windows to the second cube face you want to relocate it to x position 1921. The -e option of wmctrl does exactly this. Use -r to select the window that you want to automatically relocate. An example of the code to use in a startup script is as follows. This code snippet replaces mythtv to the second face of my desktop cube. wmctrl -r "mythfrontend.real" -e 0,1921,0,1920,1080

You can see mythtv on the second face of the cube.

You can see mythtv on the second face of the cube.

Heres a previous post for additional reference.

Rock Your Desktop – Ubuntu, Windows, MAC, MythTV – Compiz Tweak Fest

Step 1 is to enlarge your desktop to have a couple of viewports. I figured I’ll go through it step by step including the easy ones. Here comes a few posts/howtos with screenies.

Open the Ubuntu preferences menu

Open the Ubuntu preferences menu

If you do not have the compiz config control panel install it with: sudo apt-get install compizconfig-settings-manager In the control panel select the general options button.

The general options button in the compiz config control panel

The general options button in the compiz config control panel

In this panel select the desktop size tab.

the desktop size tab in the compiz config control panel

the desktop size tab in the compiz config control panel

Three, four, five viewports. The sky is the limit. Obviously this is all dependent on a properly install video driver. You need adequate hardware being a powerful NVIDIA or ATI/AMD video card or embedded chipset. I recommend installing the up to date drivers, but it is easiest to just select your corresponding driver from the hardware drivers configuration menu.

The ubuntu hardware drivers control panel

The ubuntu hardware drivers control panel

In this control panel you can install the automatically detect drivers for your video hardware.

Select various hardware drivers

Select various hardware drivers

Compiz and VNC Fullscreen Bug Workaround

The best and most versatile vnc client for linux is xtightvncviewer. Its easy to install and gives a variety of options. When using it with compiz the fullscreen option, most annoyingly, takes up all the viewports. To clarify compiz take a single workspace and expands it in x and y dimensions. Therefore for viewport 2, the second face of the cube to the right, beings with your desktop resolution +1. My desktop is 1920 x 1080 therefore my viewport 2 starts at 1921. Though not entirely relevant it is important when trying to place different windows automatically on different sides of the cube. While searching for a solution or an alternative to xtightvncviewer I tried many different clients. In the end I didn’t like anything other than xtightvncviewer. Many don’t have x cursors locally, and others dont allow defining the compression type or level. Ultimately I found a ubuntuforums post dealing with placing an xtightvncviewer entirely in a workspace. I see how this is useful using metacity along with the workspace switcher, but very comveniently it is also applicable as a bug workaround! Here is the link to the forum post, but since the availability of internet content is always in question I will make a local link to the perl script, and abbreviate the procedure. http://ubuntuforums.org/showpost.php?p=3465085&postcount=1 First install some files: sudo aptitude install wmctrl xtightvncviewer zenity perl The forum post provides a link to xtightvncpasswd a renamed passwd file that is compiled for a specific kernel, I think 32 bit which is why it didnt work on my machine. There I recommend to simply compile it yourself. Install build essential and your headers if you dont have then installed. sudo apt-get install build-essential linux-headers-$(uname -r) Then the remaining build dependencies: sudo apt-get build-dep xtightvncviewer Download the source code from http://www.tightvnc.com/download.html: Here is a direct link to the source, but the version will eventuall change which is why the main page is linked to above: http://downloads.sourceforge.net/vnc-tight/tightvnc-1.3.10_winsrc.tar.bz2 Unzip it on your desktop. cd to the directory in a terminal. Then compile with: xmkmf make World Copy the passwd file to /usr/local/bin and rename it to xtightvncpasswd so the script will work right. sudo cp ~/Desktio/vnc_unixsrc/vncpasswd/vncpasswd /usr/bin/xtightvncpasswd sudo chmod 755 /usr/bin/xtightvncpasswd Download the perl script that user Felson so awesomly wrote! vnc_ws Copy it to the /usr/local/bin directory: sudo cp ~/Desktopvnc_ws /usr/local/bin sudo chmod 755 /usr/local/bin/vnc_ws Now your probably going to want it to open the vnc fullscreen on a viewport other than your main. You have two options. The compiz plugin Place Windows, which works fine for this type of window, or a manual wmctrl. I describe use of wmctrl in my previous post. http://www.bgevolution.com/blog/compiz-auto-move-a-window-to-another-desktop-viewport/ Simply configure the compiz plugin Place WIndows to move the vnc fullscreen window to viewport 2, or any viewport that you want. My start vnc quicklaunch button looks as such: vnc_ws -h 192.168.0.102 -p 5900 -P password -w 1 -e zlib -o '-x11cursor' The scripts takes a variety of parameters. Use vnc_ws –help for all options. -h is the ip of the host machine. -P is the password to automate the login process; please note that this is not secure at all and if security is an issue only use this script on a local network behind a fiewall or a properly configured router. -w defines the workspace, this should be one because your compiz cube is in workspace 1. You can use multiple workspace(desktops) but this will just make your headspin unnecessarily. -e is the compression type. -o passes options directly the xtightvncviewer. I use the x11cursor option to render the cursor locally for performance purposes. Fire it up, and fill a viewport with a fullscreen vnc connection. I use this script because I want my headless mac as a viewport. Heres a post with a screenie! http://www.bgevolution.com/blog/ubuntu-mac-tiger-windows-xp-and-mythtv-on-the-same-desktop/

Compiz Auto Move a Window to Another Desktop – Viewport

When you boot your machine you want to open a variety of windows or applications on different desktops, but they only seem to open on the main desktop even with use of the place plugin. The place plugin in compiz works for a variety of applications but does not work for VirtualBox graphical windows. Wmctrl is another plugin that allows you to move windows to different locations on the desktop. For example, if your desktop is 1920 x 1080 you can move a window to the second desktop, in the x direction, by placing it to 1921. For example if you launch MythTV automatically on boot, and you want it on the second desktop use the following in a startup session script. Wmctrl is a package in the default Ubuntu repositories give it an apt-get to install. wmctrl -r "mythfrontend.real" -e 0,1921,0,1920,1080 There are a variety of option to wmctrl, use wmctrl --help for more info. This is how I move my Windows XP to another viewport: wmctrl -r "WindowsXP [Running] - Sun VirtualBox" -e 0,3841,0,1920,1080 In this case I move it to viewport 3.