

def _clipboard_prep():
    import omni.appwindow
    import carb.windowing

    _app_window_factory = omni.appwindow.acquire_app_window_factory_interface()
    _app_window = _app_window_factory.get_default_window()
    _carb_window = _app_window.get_window()

    _windowing = carb.windowing.acquire_windowing_interface()
    return _windowing, _carb_window


def copy(value_str):
    """
    Platform-independent copy functionality.

    Args:
        value_str (str): String to put in the clipboard.
    """
    _windowing, _carb_window = _clipboard_prep()
    _windowing.set_clipboard(_carb_window, value_str)


def paste():
    """
    Platform-independent paste functionality.

    Returns:
        str: Value pulled from the clipboard.
    """
    _windowing, _carb_window = _clipboard_prep()
    value_str = _windowing.get_clipboard(_carb_window)
    return value_str
