Skip to main content
Version: Current

Input Actions

  • os.hideChat(): ShowChatBarAction

    Hides the "chat bar" at the top of the screen in CasualOS.

    Examples
    Hide the chat bar.
    os.hideChat();
  • os.showChat(options?: ShowChatOptions): void

    Shows the "chat bar" at the top of the screen in CasualOS, optionally using the given text as the placeholder. Typing in the chat bar will send @onChatTyping shouts and pressing Enter will send a @onChat shout and clear the chat bar.

    The first parameter is optional and is a ShowChatOptions and is the options that the chat bar should use.

    Examples
    Show the chat bar with a placeholder.
    os.showChat({
    placeholder: "hello"
    });
    Show the chat bar with some prefilled text.
    os.showChat({
    prefill: "this is prefilled"
    });
    Show the chat bar with some prefilled text and a placeholder.
    os.showChat({
    prefill: "this is prefilled",
    placeholder: "hello"
    });
    Show the chat bar with a custom placeholder color.
    os.showChat({
    placeholder: "hello",
    placeholderColor: '#44a471'
    });
    Show the chat bar with a custom background color.
    os.showChat({
    placeholder: "hello",
    backgroundColor: '#f1abe2'
    });
    Show the chat bar with a custom foreground color.
    os.showChat({
    placeholder: "hello",
    foregroundColor: '#531234'
    });
  • os.showChat(placeholder?: string): void

    Shows the "chat bar" at the top of the screen in CasualOS, optionally using the given text as the placeholder. Typing in the chat bar will send @onChatTyping shouts and pressing Enter will send a @onChat shout and clear the chat bar.

    The first parameter is optional and is a string and is the text that the chat bar should show as the placeholder.

    Examples
    Show the chat bar.
    os.showChat();
    Show the chat bar with some placeholder text.
    os.showChat("hello");
  • os.share(options: ShareOptions): Promise<void>

    Shares the given URL or text via the device's social share capabilities. Returns a Promise that resolves when sharing has succeeded or failed.

    The first parameter is a ShareOptions and is the options for sharing.

    Examples
    Share a URL.
    os.share({
    url: 'https://example.com'
    });
    Share some text.
    os.share({
    text: 'abcdefghijklmnopqrstuvwxyz'
    });