将电子墨水平板用作 Linux 的显示器
Using e-ink tablet as monitor for Linux

原始链接: https://alavi.me/blog/e-ink-tablet-as-monitor-linux/

## 将电子墨水屏作为辅助显示器,使用VNC 本文详细介绍了如何将旧的安卓电子墨水平板电脑用作Linux(Arch,但可调整)上的辅助、对眼睛友好的文本编辑和阅读显示器。作者因长时间使用屏幕而感到疲劳,寻求低压力的解决方案,并发现使用VNC镜像成功了。 最初使用Deskreen的尝试受到基于浏览器的流媒体质量和输入延迟的阻碍。然而,设置TigerVNC服务器并使用Android VNC客户端(AVNC)被证明是有效的。该过程涉及安装TigerVNC、创建密码、配置用户访问权限,并使用特定参数(分辨率、帧率、共享选项)运行`x0vncserver`以镜像屏幕。 创建了一个脚本来自动化显示器配置(设置分辨率和定位显示器)并启动VNC服务器。虽然由于电子墨水平板电脑的刷新率存在延迟,但该设置提供了舒适、无干扰的体验,尤其适合阅读和写作,并且通过在Neovim等文本编辑器中使用高对比度、浅色主题来增强效果。

使用E-Ink平板电脑作为Linux显示器 (alavi.me) 16点 由 yolkedgeek 3小时前 | 隐藏 | 过去 | 收藏 | 2条评论 jwrallie 17分钟前 | 下一个 [–] 我真的很想要一个带E-Ink屏幕的Linux笔记本电脑。我非常清楚缺点。 似乎有带键盘的Android平板电脑或双屏Windows笔记本电脑,但为了适应这种屏幕的限制,拥有对操作系统界面的完全控制权是最好的。回复 bee_rider 20分钟前 | 上一个 [–] 所以基本上是在E-Ink屏幕上使用vim? 当我写很多LaTeX时,我希望有一个E-Ink显示器。LaTeX本身就需要一段时间来编译。我可能还是想在传统显示器上使用vim。回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请YC | 联系 搜索:
相关文章

原文

By Alireza Alavi6 minutes read


Table of Contents

  1. Showcasing end results
  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:

  • OS: Linux (Arch, btw. but doesn't matter)
  • i3wm (X11)
  • E-ink tablet: Onyx BOOX Air 2 (It being Android matters, if not, you must find a VNC client for your tablet)
  • I just want to mirror one of my screens to the tablet, I don't care about extending the screen.

Showcasing end results

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.

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.

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.

  • Running the above command will also output on which port it is listening on (default is 5900).\
  • Open the port in your firewall if needed.\
  • Now connect from the client (Android E-ink table) with AVNC(or any VNC client) to the IP and port (e.g. 192.168.0.50:5900).

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
  • If you feel like you have to encrypt your VNC connection, see arch wiki. I don't think it is needed for me since I am using this at home or work, there aren't many threats.

  • Use a light theme for Neovim and other things when using with E-ink. The shine theme that is installed by default is pretty sweet: :colorshceme shine or just try :set background=light on different themes! But it's best the theme is high contrast and has true white background (not gray or something).

联系我们 contact @ memedata.com