I am trying to run a program on Ubuntu MATE 20.04 that needs to have a graphical output to function. Sometimes I will attach a monitor and sometimes I will not. I would like to configure my computer(a raspberry pi 4) so that it will boot into MATE with or without a monitor.

For background, this program is a radio scanner software written in java and I want the be able to have the program startup at boot. It requires a graphical output in order to function. I did not write the program and trying to tackle launching it outside of X is beyond my capabilities.

Currently I have it set to start as a startup program inside of the MATE desktop and that is working fine when there is a monitor.

I don't care if the desktop is running when there isn't a monitor, system resources are less important to me than getting the program to run.

It is also acceptable to run the program on a "Fake" X session however I need to prevent that from happening when a monitor is attached. This could also be handled by killing the process manually (but preferably automatically) once the desktop has launched. Again, this is less important to me than getting it to work in the first place.

**EDIT:** the purpose of the exercise is to get the program to run if I plug in the pi and let it boot straight to the program scanning the air for radio(police etc) AND playing it through a speaker.

**EDIT2:**

```
zach@zach-MATE20:~$ sudo systemctl enable rc-local.service
[sudo] password for zach: 
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.

Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

```