Implementing non-standard rotary encoder interaction in LVGL

I have an LVGL application with two pages - “main” page and “timer” page. When I’m in the main page, I want that any change in a rotary encoder attached to the LVGL component would cause a switch to the timer page. When the timer page is active, I want the rotary encoder change an arc widget. How do I implement such behavior?