from typing import Union


def _generate_shortcut_linux(name : str, working_dir:str, path:str, executable:Union[str,bool], icon:str) -> str:
    """The steps to generate an icon for windows

    Parameters
    ----------
    name : str;
        The name of the shortcut

    working_dir : str
        The path to the directory to execute the executable from, or create folder shortcut to

    path : str
        The path where you want to put the shortcut

    executable : str or bool,
        The path to the executable you want to create a shortcut for, set to False if you want folder shortcut

    icon : str
        The path to a custom icon to use for the shortcut

    Notes
    -----
    - The function creates a .desktop file in the specified path, and returns it's content

    References
    ----------
    - Desktop entry specification: https://developer.gnome.org/desktop-entry-spec/
    """

    if not executable:
        shortcut_type = "Directory"
        executable_string = f""
    else: # If executable is specified
        shortcut_type = "Application"
        executable_string = f"\nExec='cd {working_dir} && {executable}'"

    # Generate the .desktop file Content
    data = f"""[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type={shortcut_type}
Terminal=false{executable_string}
Path='{path}'
Name={name}
Icon='{icon}'
"""
    return data