My desk from a phone or a tablet

GNOME remote desktop on two Linux boxes from two phones and a tablet: a headless session on the box nobody sits at, a mirrored screen on the one I do, and the sizes that make a desktop readable on a phone.

A large box for the home box, a GNOME session with no screen attached, and a smaller box for the tablet, which asks for a desktop of 1600 by 1000, with an arrow from the tablet to the home box. A line underneath says the desktop resizes to whichever device connects. A large box for the home box, a GNOME session with no screen attached, and a smaller box for the tablet, which asks for a desktop of 1600 by 1000, with an arrow from the tablet to the home box. A line underneath says the desktop resizes to whichever device connects.

I can open the desktop of either of my Linux boxes from a phone or a tablet and carry on with what was already running there. Both boxes run GNOME on Ubuntu 26.04 and both use GNOME’s own remote desktop, but in two different ways, because I sit at one of them and nobody sits at the other. The devices connect over the private network with aRDP as the client.

The box nobody sits at

The home box has to answer when nobody is logged in at it, and that ruled out the obvious setting. Desktop Sharing, the switch in GNOME’s settings, runs inside my login session. I logged out at the machine and the server stopped with the session.

Remote Login is the system-level version and works with nobody logged in. It also put the login screen in front of me on every connection, and its hand-over from the login screen to my session broke in the phone’s client.

What works is a headless session. The template unit [email protected], enabled for my user, has GDM start a desktop for me at boot with no screen attached, and remote desktop serves that session. I connect and I’m on the desktop, with whatever I left open. On 26.04 the unit as shipped failed with “Failed: The connection is closed” and exit status 70, until I gave it a drop-in that turns DynamicUser off and runs it as root.

A headless session has no monitor, so it takes whatever size the client asks for. aRDP can’t follow the device’s screen: it offers the native resolution or a custom one. So each device has its own custom size in the shape of its own screen:

Device Screen Desktop it asks for
Phone 2484 x 1116 1656 x 744
Phone 2400 x 1080 1600 x 720
Tablet 1920 x 1200 1600 x 1000

That’s two thirds of native on the phones, which fills the screen and leaves the text big enough to read. The tablet’s is closer to native and its text comes out about 1.2 times larger.

It’s one client at a time. When the tablet connected while a phone was in, it took the session over and the desktop resized from 1656 x 744 to 1600 x 1000. One phone negotiates H.264 with the server and the other doesn’t.

The box I sit at

This one shares its real session, with Desktop Sharing in mirror-primary mode, so a client sees the primary monitor and only that. The primary is 3840 x 2160, which is 16:9, and the phones are about 20:9, so the phone shows the whole monitor with bars down the sides. aRDP has no stretch, and the custom size does nothing in mirror mode.

The other mode is extend, which adds a virtual monitor sized to the client. It filled the phone. It also left the top bar and the dock on the real screen, so the phone got a bare desktop, and adding the virtual monitor reset the real ones: both 27 inch 4K monitors lost their rotation and dropped from 74.6 Hz to 60 while I was working on them. It went straight back:

gsettings set org.gnome.desktop.remote-desktop.rdp screen-share-mode mirror-primary

Since then, anything about how the desk looks on a phone gets fixed in the phone’s client and the desk’s own display settings are left alone.

Mirroring the primary monitor has one real limit: windows on the other two monitors can’t be reached. I wrote a small script that makes another monitor the primary one through gdctl, keeping every monitor’s mode, position, scale and rotation so the windows don’t move. Mutter forgets the change at the next log-in. So far I’ve only run it in Mutter’s verify-only mode, which accepted all four targets.

When a terminal is enough

For terminal work I skip the desktop. Each device has Termux with ssh to both boxes, and tmux on the box keeps the session there for the next time I connect, from whichever device that is. mosh is installed as well.

Featured projects

All projects

Latest writing

All writing