You need some graphics support to be able to show sketches. Desktop is not necessary if you develop the code without processing ide as a regular java program that can be launched from command line or as part of start-up of the device.
Even code developed with processing ide can be launched from command line Executing Sketch via Linux Command Line?