Using E-Ink tablet as monitor for Linux

By Alireza Alavi8 minutes read


Table of Contents

  1. Showcasing end results
    1. How I use this
  2. Attempt1: Deskreen
  3. Attempt2: VNC
    1. Setting up the VNC server
    2. Install and initial setup
    3. Run x0vncserver directly
    4. Running x0vncserver automatically
    5. Running things in a script
  4. Footnotes

Yesterday, I was writing and doing research about software licenses. I read through heaps and walls of legal text and different licenses, taking notes and making sense of them. After about fourteen hours of this, I felt like my eyes were ready to quit. I thought it would be really nice if I could use my old Android E-ink tablet as a display for reading and writing text, with much less strain on the eyes.
I got it to work and I'm going to document it here so both the future me remembers, and maybe you find it useful and your eyes thank you.

Here is what I am working with:

Showcasing end results

You can also watch this on YouTube

The latency with VNC is very little. The main bottleneck is the low refresh rate and the lag of my old E-ink tablet. This can be a much better experience with a newer tablet with higher refresh rate.
I still like this though; It is good for just writing with minimal distractions, and less eye strain, but it is amazing for reading.

How I use this

I think this will be best used in a dual monitor setup (minus the e-ink).
One is just a mirror to the e-ink, which sometimes helps, taking glances at it for some things that need color.
The second monitor will be used for other things besides reading and writing.

I do not use the E-ink tablet as my main monitor. I use it 70% for reading and 30% for writing simple text. This depends on your tablet, it's refresh rate and quality but with my tablet, writing code or doing things like browsing the web isn't a good experience because of the latency.

There is another pro: It's more than a monitor. The VNC connection grants you the ability to use your tablet as the input device too.
This way, I open the thing that I need to be reading or reviewing, pick up my tablet and just roam around the office, scrolling the pages, making small edits.
I also use the tablet for drawing things in GIMP or whatever while explaining things to my co workers and during presentations. So it also acts as a pretty good drawing tablet.

Attempt1: Deskreen

Deskreen is great, and has its use cases, specially that it's so simple to use even a hamster can use it. But the issue was that you should view your screen inside a browser. That has two problems for our use case:

  1. The streaming quality is not amazing. For reading text, you need crisp letters and high quality
  2. The input lag is way too much. My rusty BOOX Air2 already has considerable input and rendering lag. I can't afford anymore.

So Deskreen failed for me.

Attempt2: VNC

Setting up a VNC servers seemed a bit daunting at first (that's why I'm writing this) but I got it working in ~20 minutes.

We will use TigerVNC as our server, and AVNC for our Android client (E-ink tablet)

Setting up the VNC server

As always, the Arch wiki is a great resource, regardless of your distro. See TigerVNC arch wiki.

Here, I will provide a quick-start.

Install and initial setup

install the tiger vnc package. For arch:

sudo pacman -Sy tigervnc

Then, according to the Arch wiki,

  1. Create a password using vncpasswd which will store the hashed password in $XDG_CONFIG_HOME/tigervnc/passwd. Ensure the file's permission is set to 0600. If creating vncserver access for another user, you must be logged in as that user before running vncpasswd.
    vncpasswd
    sudo chmod 0600 $XDG_CONFIG_HOME/tigervnc/passwd
  2. Edit /etc/tigervnc/vncserver.users to define user mappings. Each user defined in this file will have a corresponding port on which its session will run. The number in the file corresponds to a TCP port. By default, :1 is TCP port 5901 (5900+1). If another parallel server is needed, a second instance can then run on the next highest, free port, i.e. 5902 (5900+2).
    /etc/tigervnc/vncserver
    ---
    
    :1=alireza
  3. Create $XDG_CONFIG_HOME/tigervnc/config and at a minimum, define the type of session desired with a line like session=foo where foo corresponds to whichever desktop environment is to run. One can see which desktop environments are available on the system by seeing their corresponding .desktop files within /usr/share/xsessions/. For example:
$XDG_CONFIG_HOME/tigervnc/config
---
session=i3
geometry=1400x1050+0+0
passwd-file=$XDG_CONFIG_HOME/tigervnc/config
FrameRate=30
localhost
alwaysshared

NOTE: Notice the geometry. 1400x1050 is roughly the resolution of my E-ink display, that my computer display also supports, while +0+0 tells the coordinates of the screen (xrandr things). So this means that "Share a 1400x1050 view of my screen, starting from position 0, 0 (top left corner)". This makes the screen fit perfectly within the tablet's display with no borders and use as much screen as possible. You could just go with your original resolution and get more borders.

NOTE: the tigervnc/config file is used for vncserver. we will be using x0vncserver which needs these options passed to it directly (more on that later).

NOTE: you must change the resolution of your computer screen to 1400x1050, or whatever you set in geometry.

Run x0vncserver directly

Now to quickly test.

x0vncserver \
-PasswordFile $HOME/.config/tigervnc/passwd \
-Geometry 1400x1050+0+0 \
-FrameRate 30 \
-AlwaysShared \
-SendCutText=false \
-SendPrimary=false \
-AcceptCutText=false

NOTE: We are passing all the configurations we want directly to x0vncserver because it doesn't read from .config/tigervnc/config.

NOTE: The only mandatory option is -PasswordFile. The rest are optional, see what suits you: man x0vncserver.

Of course, both devices need to be reachable within their network connections.

Running x0vncserver automatically

There are a couple of ways to do this, listed in the Arch wiki.

Running things in a script

I will just use a simple script to go into my "e-ink mode", so I can quickly run it from my rofi script runner. You can probably find the script here

It looks something like this:

#!/usr/bin/env sh

PRIMARY_DISPLAY=`xrandr --listactivemonitors | sed '2q;d' | cut -d " " -f 6`
SECONDARY_DISPLAY=`xrandr --listactivemonitors | sed '3q;d' | cut -d " " -f 6`

# Set display size to the same size as the e-ink display
xrandr --output $PRIMARY_DISPLAY --mode 1400x1050;

# Adjust secondary display to position to the right of the first screen
xrandr --output $SECONDARY_DISPLAY --right-of $PRIMARY_DISPLAY;

# Start the x0vncserver session
x0vncserver \
-PasswordFile $HOME/.config/tigervnc/passwd \
-Geometry 1400x1050+0+0 \
-FrameRate 30 \
-AlwaysShared \
-SendCutText=false \
-SendPrimary=false \
-AcceptCutText=false

Footnotes