Thumbnail (since v2.3.0)

Thumbnail from PrusaSlicer
In "Expert" mode PrusaSlicer has an option in the "Printer Settings" tab to activate previews. Under General / Firmware, enter 32x32,400x300 as "G-code thumbnails".

Enable the Label objects setting in your slicer

In PrusaSlicer or SuperSlicer you have to enable the checkbox in:
Print Settings > Output options > Output file > Label objects

Direct G-code from slicer

Enable advanced or expert mode and change the options under Printer Settings / General as shown in the screenshot below. A “Physical Printer” must be configured in Printer Settings / General.

Best practise G-codes

These custom G-codes are necessary to get the best user experience.

Layer Count

To have Slicer layer counts in Mainsail, you have to add these two G-codes in your custom G-codes in PrusaSlicer:
Start G-code (before your start G-code):
End G-code (at the last line):
; total layers count = [total_layer_count]
After layer change G-code: