### Overview

I tried installing LXDE on my Yoga Book within GNURoot Debian… but I was becoming frustrated with the slow performance and felt LXDE was a bit overkill. My goal here was to get a linux system setup on my Yoga Book which was more geared towards writing latex via vim: All I wanted was a good terminal, latex compiler, and pdf viewer. I mostly care about the terminal here, and the GNURoot debain just doesnt have the functionality I’d like, so a light UI with terminator sounds like the right way to go. I finally decided that there was no need for a full blown UI like LXDE, so I opted for just using openbox, the most minimal approach I could find that didn’t require laborius tweaking to get it right.

### Setup

Here are the steps I took to get openbox running on a clean install of GNURoot Debian. Once you launch it for the first time it’ll run a little installation script, then you’ll be ready to start using the terminal (as seen in the screenshot below).

Now we can start throwing commands in the terminal!

1. Update debain with:
apt update; apt -y upgrade

2. Install a VNC server and openbox (along with a few other usefull apps):
apt -y install tightvncserver sudo openbox nano terminator tint2 gmrun


tint21 is a dock for openbox (absolutely necessary in the case when you minimize a window) and gmrun can be assigned to a key binding to quickly run commands and launch programs.

3. As we’re probably going to be loading our VNC server regularily, lets make a script to make life easier. Run the following two commands:
echo "sudo tightvncserver -geometry 1920x1120 -depth 16 -dpi 144 :1" >> startVNC
echo "sudo tightvncserver -kill :1" >> stopVNC


This should drop two text files which you can execute with sh. The -dpi 144 argument is key here. Without it, it will default to 75 dpi which results in unreadably-small text. Also, the first time you do this it typically asks for a password for the server session. Let’s keep things simple and use gnuroot, which happens to the be the same password that GNURoot Debian uses when it creates a VNC session for its XTerm mode.

4. We just need to do a little tweaking now… lets set up tightvnc so that it loads openbox as the window manager rather than the default tmw. To initialize a VNC statup script, so go ahead and type:
sh startVNC
sh stopVNC


Running these two scripts we made in the previous step will launch VNC, create a startup script we can edit with nano, then kill the server we just opened.

5. Now lets use the command nano /root/.vnc to change our startup script so it looks like this:
#!/bin/sh
xrdb $HOME/.Xresources xsetroot -solid grey openbox-session & tint2 & terminator &  Save your edits, then exit nano. 6. Finally… download VNC viewer and create a client that connects to localhost:1, using our password gnuroot. As a side note, the Xterm mode on GNURoot debian uses localhost:51. And now… here’s a preview of the result. I installed vim and evince and did a quick test with vimtex to validate that I can compile latex documents and evince will automatically update with the latest document. ### Some further tweaks… To streamline my workflow I added the following keybindings to nano /root/.conf/openbox/rc.xml.  <keyboard> <!-- Keybindings for Yoga Book --> <keybind key="C-A-r"> <action name="Execute"> <command>gmrun</command> </action> </keybind> <keybind key="C-A-Left"> <action name="MoveResizeto"> <width>50%</width> <height>100%</height> <x>0</x> <y>0</y> </action> </keybind> <keybind key="C-A-Right"> <action name="MoveResizeTo"> <height>100%</height> <width>50%</width> <x>-0</x> <y>0</y> </action> </keybind>  This lets me run commands with Ctrl Alt R and Ctrl Alt Left/Right will draw the window on that half of the screen, so I can arrange my windows without having to fiddle with the mouse. I also restricted openbox to just one desktop (right click on the desktop and select ObConf for the GUI options). ### A Better LaTeX Workflow Editing latex through vim through GNURoot debian turned out to be a bit of a pain, so I tried a new workflow using GNURoot debian to compile and preview tex files and using VerbTeX Pro to edit the docs. The workflow goes as such: • Get the Pro version of VerbTeX. This allows unlimited local files on your device. • In VNC viewer (using the GNURoot Debian session as described above), install Texlive apt install texlive-full  • Using git, clone the repository of your choice to the local folder of VerbTeX (/sdcard/VerbTeX/Local). Now you can view and edit this file in VerbTeX. • To start automatically compiling in VNC viewer upon evey change of your tex file, run the follwoing command: latexmk -pdf -pvc -interaction=nonstopmode yourlatexfile.tex  I streamlined this by writing a bash script in my ~/ directory: #!/bin/bash latexmk -pdf -pvc -interaction=nonstopmode$1


This lets me run the following command to compile (when in the directory of the tex document): sh ~/compilelatex mylatexfile.tex. The argument -interaction=nonstopmode will skip errors and user input prompts.

• Finally, open the file in evince, which will automatically update when the file is recompiled.

With this flow, everytime you save the doc in VerbTeX Pro, it will automatically recompile and update the preview in evince. So pressing Ctrl s followed by Alt Tab in VerbTeX will immediatey show you the updated document. When finished, you can just git push to upload your changes.

I think I’ve got the best workflow possible here… With mendeley and this latex flow, an android tablet should be a pretty strong workstation for writing academic documents.

Updated on: 2018-03-24