I think the desktop app will stay online as long as the app is not minimized, but to be honest, I’m not 100% sure about that and I think you would have to try it out to see what works better for you.
I’m always using the desktop app on Windows and am working on my PC but haven’t touched the Mattermost client for about 45 minutes now. According to my database, I’m still flagged as online:
select status,to_timestamp(lastactivityat/1000) from status where userid='<myid>';
status | to_timestamp
--------+------------------------
online | 2022-09-24 12:25:01+02
(It’s 13:14 now on my end of the world).
This is also the behaviour I would expect - sitting in front of my PC with the app running (although not used) should be considered as online
.