SDL_HINT_MAC_OPTION_AS_ALT(3)
π SDL_HINT_MAC_OPTION_AS_ALT π
okay bestie, gather round, because this one is a little macOS-flavored bop from the SDL3 hints collection. The whole personality of SDL_HINT_MAC_OPTION_AS_ALT is: it's a variable that controls whether the Option key on macOS gets remapped so it acts like the Alt key instead. that's it. that's the gig. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_hints.h>
#define SDL_HINT_MAC_OPTION_AS_ALT "SDL_MAC_OPTION_AS_ALT"
like yes, it's a string define, she's simple, she's iconic π
πΈ DESCRIPTION πΈ
so you set this variable to one of these values, and it decides who gets to be Alt:
"none"β the Option key is not remapped to Alt. this is the default, so if you do nothing, nothing happens, which is very on brand π¦"only_left"β only the left Option key gets remapped to Alt."only_right"β only the right Option key gets remapped to Alt."both"β both Option keys get remapped to Alt. go big or go home π
now here's the tea β β doing this will prevent the triggering of key compositions that rely on the Option key, but it will still send the Alt modifier for keyboard events. so you're trading your fancy Option-composed characters for a clean Alt modifier, which is a whole vibe decision you have to make for yourself.
and in the case that both Alt and Option are pressed, the Option key gets ignored. no cap. sorry to her.
this is particularly useful for applications like terminal emulators and graphical user interfaces (GUIs) that rely on Alt key functionality for shortcuts or navigation β you know, the ones where Alt+whatever is the whole entire point. π₯οΈβ¨
heads up bestie: this does not apply to SDL_GetKeyFromScancode, and it only has an effect if IME is enabled. so if IME is off, this whole hint is lowkey just sitting there looking pretty π
good news though: this hint can be set anytime. no timing drama, no "only before init" nonsense. set it whenever, queen π
π«Ά AVAILABILITY π«Ά
this hint has been around since SDL 3.2.0. so if you're on anything older... girl. upgrade. π
Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_HINT_MAC_OPTION_AS_ALT(3)
and that's the whole page, bestie β go remap those Option keys responsibly, mwah ππβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms