SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME(3)

πŸ’– SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME(3) πŸ’–

okay bestie, this is a page from the SDL3 FUNCTIONS manual β€” yes, that SDL3 β€” and we're talking about a hint. A hint!! Like when your friend hints that they want boba. Except this one tells your operating system why it should stop trying to put your screen to sleep. πŸŒ™πŸ’€


✨ NAME ✨

SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME β€” specify an "activity name" for screensaver inhibition. that's it, that's the whole job, and honestly? iconic. πŸ‘‘


🌈 SYNOPSIS 🌈

#include <SDL3/SDL_hints.h>

#define SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME "SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME"

so you pull in the header and then the macro literally just expands to its own name as a string. lowkey self-referential queen behavior. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe: some platforms β€” notably Linux desktops β€” keep a whole list of the applications that are currently inhibiting the screensaver or other power-saving features. like a little guest list, but for apps that are refusing to let the monitor nap. πŸ“

This hint is how you get your name on that guest list in a way that's actually descriptive. It lets you specify the "activity name" that gets sent to the OS when SDL_DisableScreenSaver() is used β€” or when the screensaver gets automatically disabled. The contents of this hint are what's used when the screensaver is disabled, so you should use a string that describes what your program is doing β€” and therefore why the screensaver is off. for example:

  • "Playing a game"
  • "Watching a video"

see? it's giving transparency. the OS deserves to know. 🫢

Setting this to "" or leaving it unset will have SDL use a reasonable default: "Playing a game" or something similar. so like, if you can't be bothered, SDL has your back and picks for you. no cap. ✨

πŸŽ€ timing matters!! This hint should be set before calling SDL_DisableScreenSaver(). set it early, bestie, or it's not gonna land the way you want. 😭

⭐ AVAILABILITY ⭐

This hint is available since SDL 3.2.0. so if you're on an older SDL, this is not the moment. πŸ•°οΈ


πŸ’œ SEE ALSO πŸ’œ

nothing else listed here, just you and this one glorious hint. iykyk. 🧚


and that's the whole page!! brought to you by Simple Directmedia Layer, SDL 3.4.18 edition β€” go forth and tell your OS what you're doing, main character. πŸ’–πŸŒΈπŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from