How to get Name of the active screen?


Is there a way to get the name (or any other ID) for the current screen?

I know there is lv_scr_act(), but it doesn’t tell us the name of the screen?

For example, something like:

lv_obj_t * activeScreen = lv_scr_act();

if( lv_get_screen_name(activeScreen) == "ui_S2") 

Thanks in advance

Maybe try this.


I found this post because I have the exact same question. Did you ever come up with a solution to this?


Yes, I found a solution.

I declare a global variable:

char * currentScreen;

then on screen_load_start event i update the screen name.

if ( event_code == LV_EVENT_SCREEN_LOAD_START ) {
currentScreen = “ui_s4”;


// SCREEN: ui_Main
void ui_Main_screen_init(void);
void ui_event_Main( lv_event_t * e);
lv_obj_t *ui_Main;

if (lv_scr_act()==ui_Main)

For me works ok with Squareline