Hi everyone.
I have an administrator user on Ubunutu Mate 20.04 with tiger vnc server installed, I quite like the plank dock option under Mate Tweak > Panel > Panel Features > Enable Dock.
My problem is that I can only have the dock displayed on the desktop of administrator locally, when I log in as administrator remotely via vnc viewer, I can't see the dock. I tried to launch plank from terminal but I got this error:
$plank
[AbstractMain:255] Only X11 environments are supported.
On local desktop GUI the session type is x11:
$echo $XDG_SESSION_TYPE
x11
On vnc viewer the session type is unspecified:
$echo $XDG_SESSION_TYPE
unspecified
I found a workaround here:
https://bugs.launchpad.net/ubuntu/+source/plank/+bug/1903496
On vnc viewer I need to open terminal and run the following command as administrator:
$XDG_SESSION_TYPE=x11 nohup plank >/dev/null
It's really annoying that I have to run this command in the terminal when I log in from vnc viewer. I tried to run this command by adding to the Startup Applications but it won't launch the dock. I also tried to create a script /home/administrator/plank.sh to run this command:
#!/bin/bash
su administrator -c "XDG_SESSION_TYPE=x11 nohup plank >/dev/null"
I can run this command without a problem as root user, but I need to start this script automatically when the pc start up. I created a service under /etc/systemctl/system/plank.service:
[Unit]
Description=dock auto start script
[Service]
ExecStart=/home/administrator/plank.sh
[Install]
WantedBy=multi-user.target
It just won't work, the service would fail when I start it.
Is there a way to set up a default value to XDG_SESSION_TYPE for vnc user? Any one has any experiences or thoughts on this? Thanks!