Activates or deactivates autostarting autokey during user login.
    Autostart is handled by placing a .desktop file into '$XDG_CONFIG_HOME/autostart', typically '~/.config/autostart'

def set_autostart_entry(autostart_data: AutostartSettings):
    """
    Activates or deactivates autostarting autokey during user login.
    Autostart is handled by placing a .desktop file into '$XDG_CONFIG_HOME/autostart', typically '~/.config/autostart'
    """
    _logger.info("Save autostart settings: {}".format(autostart_data))
    autostart_file = Path(common.AUTOSTART_DIR) / "autokey.desktop"
    if autostart_data.desktop_file_name is None:  # Choosing None as the GUI signals deleting the entry.
        delete_autostart_entry()
    else:
        autostart_file.parent.mkdir(exist_ok=True)  # make sure that the parent autostart directory exists.
        _create_autostart_entry(autostart_data, autostart_file)