[Ubuntu Touch Q&A, Help & Troubleshooting] ShadowEO:
EDIT: I bring you the new OFFICIAL way of installing X11 applications, I've been neglecting this thread way too much and need to give it some love.

The old instructions (OLD METHOD) are no longer needed as of April on the rc and rc-proposed channels, this should work on all channels however (tested up to latest devel-proposed image)

NOTE: You still need a writable image for the first parts of this, after you install the tools, it can go back to read-only.

1) Open Terminal

2) Install the following packages: libertine libertine-tools python3-libertine-chroot

3) Open the Ubuntu Store and install the scope: libertine-scope

4) Open the Libertine application that's now available in your launcher and follow instructions, it will set up a Ubuntu Vivid chroot in your home directory, install the components needed, and drop you at the package management screen. From here, you can update and add PPAs to the container via the Settings Icon -> Manage Container, Install packages via the plus icon, etc.

5) Favorite the Libertine XApps scope by swiping up on the home screen and hitting the star, then open the scope and you'll see any applications you installed there.

If you cannot install your container via the Libertine application (I know that it didn't have support for chroot until recently, not sure if that version has landed yet), you can install your container via the teminal, so open your terminal but DO NOT sudo su. All Libertine-container-manager commands MUST be done as phablet.

To create a container (this line will likely change when Xenial drops as Libertine will be switching to LXC on Xenial):

libertine-container-manager --create -i <container id> -n <friendly name (this shows up in the Libertine app)> -t chroot

Using this command, the system will build the new libertine container, wait until it's finished and then you can continue by using the installed Libertine application.

Onscreen Keyboard in Libertine Applications

THIS CAN FINALLY BE DONE! The only con to it, is that it is mostly unusable in applications that open dialog boxes along the bottom of the screen, the XMir window does not scroll up like native applications do to give a better viewing window. (I have been told that this will change in OTA-12 when the keyboard support drops for Libertine/Puritine apps)

To install on-screen keyboard:

Open Libertine and add ppa:brandontschaefer/maliit to your container. Then hit update in Manage Containers. Once done, install the following, maliit-inputcontext-gtk2, maliit-inputcontext-gtk3, maliit-framework. After that, setup is complete in your container, now we need to do some extra work outside the container to make it pass the GTK_IM_MODULE variable we need over to Libertine. To do this, add this line to your .bashrc or if you have a writable image, you can add this to the systemwide profile (not sure if this will be replaced on OTA though):

export GTK_IM_MODULE=maliitphablet

Restart the tablet OS, Open an application such as Libreoffice Writer and BEHOLD!

Notes

You can also manage your container via the terminal with libertine-container-manager. To get a root shell without installing mate terminal (You can't get a root shell via this method (installing a term), Proot acts like fakeroot all over your container's rootfs), you can use the following:

- l-c-m exec -c bash (This command does not mount any user directories (/home/phablet will not exist) and is best used for making changes to the container's rootfs)

or if you only need a user shell:

- DISPLAY= libertine-launch <containerid (default is vivid)> bash (This mounts user directories, but is no different than if you installed something like mate-terminal and ran it. The reason we are passing an empty DISPLAY variable is because libertine-launch will refuse to start if DISPLAY isn't set, even it if doesn't exist.)

-

DPI Hacks:

To change the DPI of applications in Libertine, you need a new way to make the .Xdefaults file as only the XDG User directories get mounted inside the libertine container, not your entire Home. To do this, install your favorite editor inside of the libertine container (I find nano to be the easiest for new users), and open Terminal, then follow these instructions:

1) Open your editor to ~/.local/share/libertine-container/user-data/[my container id, default = vivid]/.Xdefaults and fill it with the following:

Xft.dpi: 175

or what your preferred DPI is. On the Nexus 7 flo the comfortable DPI is 175 with an application font size of 14 (I use Liberation Sans which comes from Libreoffice).

- You can make your applications look great still, you don't have to be stuck with the default Raleigh GTK style. Download and install LXAppearance in your container and add ppa:noobslab/themes then start installing themes. Enjoy! The Ubuntu Touch Themes are wonderful and FlatPlat works well with the system UI as well.

Some cons to this:

- It requires at least 3GBs available in your internal storage (wherever your home folder resides) to store a full, non-touch Ubuntu Vivid container.

Pros:

- It survives OTAs, the only thing able to break this would be a change to XMir, PRoot, or Libertine. Which is landing in the images shortly by default so there's not much of a chance to break this.

- Nothing you do will break your UTouch system. Unlike the old method, this only installs the items needed to run the container, which are to become standard inside the images very soon.

OLD METHOD

--------------------

EDIT: I have not tested this in stable, rc, rc-proposed yet. Only the dev-proposed channel.

So there is some questioning I see going on about how to run things like Firefox efficiently and well. So I figured I'd write up a little something for it.

First you'll want to set your DPI in ~/.Xdefaults, as I have a Nexus 7, mine looks similar to this:

Xft.dpi: 240

Note that you may need to do some additional tweaking.

Now that you have Xdefaults made, install the ubuntu-pocket-desktop and matchbox-window-manager packages (along with the program you wish to use, for this tutorial, I'll use libreoffice).

Create a file in /bin called wm-wrapper.sh (or whatever you choose here, just remember the name), fill it with:

#!/bin/bash
matchbox-window-manager -use_titlebar no -use_dialog_mode const-horiz &
exec $@

and save it, then chmod a+x it.

EDIT: For this next part, I recommend copying the .desktop to ~/.local/share/applications to avoid them being overwritten on package updates.

Now, navigate to /usr/share/applications/ and open the .desktop file for the application you are wanting to run. Add the following lines under [Desktop]:

X-Ubuntu-Touch=true
X-Ubuntu-XMir-Enable=true

Change the Exec line so that your wrapper (in my case wm-wrapper.sh) is in front of the executable, such that the line becomes (or similar):

Exec=/bin/wm-wrapper.sh libreoffice %U

Save it, then search for your application in the Unity Scopes. Open it up and you should see your application running as an XMir app easy. For future applications, you will simply need to do the changes to it's .desktop file.

EDIT: A helpful redditor gave me this tip to enable sending touch events over to Xmir. Setting the GTK_TEST_TOUCHSCREEN environment variable to 1 will apparently remove hover events and the like (events that are not normally sent with a touch screen, but with a mouse). I have not had time to take a look at this yet however so YMMV.