def set_title(title, mode=0):
    ''' Set the title of the terminal window/tab/icon.

        Arguments:
            title:  str
            mode:  | 0 | 'both'   - Set icon/taskbar and window/tab title
                   | 1 | 'icon'   - Set only icon/taskbar title
                   | 2 | 'title'  - Set only window/tab title
    '''
    if os.name == 'nt':
        from .windows import set_title
        return set_title(title)
    else:
        if _CHOSEN_PALETTE:
            text = f'{OSC}{_title_mode_map.get(mode, mode)};{title}{BEL}'
            _write(text)
            return text
def set_title ( title , mode = 0 ) : if os . name == 'nt' : from . windows import set_title return set_title ( title ) else : if _CHOSEN_PALETTE : text = f'{OSC}{_title_mode_map.get(mode, mode)};{title}{BEL}' _write ( text ) return text
Set the title of the terminal window/tab/icon.

        Arguments:
            title:  str
            mode:  | 0 | 'both'   - Set icon/taskbar and window/tab title
                   | 1 | 'icon'   - Set only icon/taskbar title
                   | 2 | 'title'  - Set only window/tab title