Direct Path for Desktop without Usernames for Blender 2.79
The script below retrieves the home directory and generates the path to the desktop. If the project has been saved before, it adds the name as prefix.

import bpy
import os 
from pathlib import Path
from sys import platform

home_dir = str(Path.home())

if platform == 'linux' or platform == 'win32' or platform == 'darwin':
    desktop_dir = os.path.join(home_dir, 'Desktop')
else:
    raise RuntimeError("OS not supported")

if bpy.data.is_saved:
    filename = os.path.splitext(bpy.path.basename(bpy.data.filepath))[0]
    output = os.path.join(desktop_dir, filename)
else:
    # Project file hasn't been saved before, therefore no filename is available
    output = desktop_dir

bpy.context.scene.render.filepath = output




If you want the prefix to be the same as the active object in the scene:

import bpy
import os 
from pathlib import Path
from sys import platform

home_dir = str(Path.home())

if platform == 'linux' or platform == 'win32' or platform == 'darwin':
    desktop_dir = os.path.join(home_dir, 'Desktop')
else:
    raise RuntimeError("OS not supported")

if bpy.app.version &lt; (2, 80, 0):
    filename_prefix = bpy.context.scene.objects.active.name
else:
    filename_prefix = bpy.context.view_layer.objects.active.name

output = os.path.join(desktop_dir, filename_prefix)
bpy.context.scene.render.filepath = output