---
name: "SDL_CreateTray"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_CreateTray"
---

# SDL\_CreateTray(3)

Create an icon to be placed in the operating system's tray, or equivalent.

## NAME

SDL\_CreateTray - Create an icon to be placed in the operating system's tray, or equivalent.

## HEADER FILE

Defined in SDL3/SDL\_tray.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_Tray \* SDL\_CreateTray(SDL\_Surface \*icon, const char \*tooltip);**

## DESCRIPTION

Many platforms advise not using a system tray unless persistence is a necessary feature. Avoid needlessly creating a tray icon, as the user may feel like it clutters their interface.

Using tray icons require the video subsystem.

## FUNCTION PARAMETERS

- *icon*

  a surface to be used as icon. May be NULL.

- *tooltip*

  a tooltip to be displayed when the mouse hovers the icon in UTF-8 encoding. Not supported on all platforms. May be NULL.

## RETURN VALUE

( **SDL\_Tray**\
  \*) Returns The newly created system tray icon.

## THREAD SAFETY

This function should only be called on the main thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_CreateTrayMenu**(3)](/SDL_CreateTrayMenu/3.md), **•**(3), [**SDL\_GetTrayMenu**(3)](/SDL_GetTrayMenu/3.md), **•**(3), [**SDL\_DestroyTray**(3)](/SDL_DestroyTray/3.md)
