How do I enter geometry information into a TigerVNC .service file?
I tried these 3 things:
- Edit
/usr/lib/systemd/system/vncserver@.service
by inserting a geometry phrase, so the relevant line becomes:
ExecStart=/usr/bin/vncsession-start -geometry 1300x900 %i
On this, I also tried inverting the last two bits:
ExecStart=/usr/bin/vncsession-start -geometry %i 1300x900
And running xrandr
and using one of the listed resolutions:
ExecStart=/usr/bin/vncsession-start -geometry 1280x960 %i
- Create a new .service file, i.e.
myserver@.service
ormyserver@:1.service
, with the same contents as above, and start with:
sudo systemctl start myserver@:1
- Re-naming the new .service file to
myserver.service
and starting with:
sudo systemctl start myserver
All these gave me an error:
Job for vncserver@:1.service failed because the control process exited with error code.
See “systemctl status vncserver@:1.service” and “journalctl -xeu vncserver@:1.service” for details.
I don’t believe the 3 variants made much difference. I believe the offending element is the insertion of the phrase -geometry 1300x900
.
One peculiar circumstance of mine is that I am running my TigerVNC server with ~/.vnc/xstartup
with these contents:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/startxfce4 &
instead of ~/.vnc/config
with something like:
session=xfce
Please see this post for why I ended up doing that: Movies are see-through in VNC
I don’t insist on specifying geometry through a .service file. I would be happy to
- enter geometry into
xstartup
or - feed it through a
systemctl start
command.
Indeed the last would be most convenient as I could set geometry per session. Thanks.
ADDED LATER
A default VNC session (i.e. off /usr/lib/systemd/system/vncserver@.service
) gives me 1024x768. I don’t know where that comes from (certainly not in vncserver@.service
).
Once I am in, I can use this workaround:
- Run
xrandr
to find out supported resolutions - Run
xrandr -s 1280x960
where 1280x960 is one of the supported.
On 2, the session disconnects and reconnects at the new resolution (I would think this reconnecting depends on the viewer you use).
ADDED STILL LATER
I found out that whatever I put for geometry in ~/.vnc/config
turns up in the output of xrandr
as one of the supported screen resolutions, indeed the top one. (This is from when I had both ~/.vnc/config
and ~/.vnc/xstartup
, which turned out to be a bad idea. See below.)
So the resolution you specify there is in a tortuous way the resolution you get if you are willing, after getting to VNC, to run a xrandr -s
command.
But here’s a funny thing. I tried these resolutions: 1300x900, 1300x960, 1300x970, 1300x980, 1300x988, and 1300x990.
They all work except for the 988. With this one, VNC access will fail. Isn’t that wonderful? The computer doesn’t like the number.
ADDING FOR THE LAST TIME
If you had the see-through video problem and tried adding xstartup
per my other post (as linked), do NOT also use config
. That will bring back the problem.