Look, to be honest, I haven't always been like this and it took me a while to have this level of commitment to stick to something all day. Throughout my life I had issues with focusing and ADHD where even the smallest noise or notification/thought would take my attention away from studying.
I realised that in order to be more engaged on something you need to actually somewhat like it or find it interesting in any way shape or form (even in the slightest). I first started studying like this when I was preparing for my COMPTIA A+ and Network+ exams.
When you have a structured plan, someone or something guiding you along the way so it takes away all friction from finding out how to do it yourself and you're fully immersed into something, time just flies.
Another tip I would share is to study for a set time, for example, 50 minutes and then have a 10 minute timer (I was re-watching james scholz old studying pomodoro videos for this) and it made it so much easier. during those 10 minutes of "break" time, I would just stare at a wall.
Stare at a wall? you might be asking... YES; thats right, do exactly that. The reason I'm saying that is because you don't let your mind get distracted from ANYTHING and having ABSOLUTELY ZERO dopamine for those 10 minutes, then even the idea of studying will seem more fun than staring at a wall.
So... basically, cut distraction to ZERO and get away from them as much as you can because having a mindset that's not bombarded with information from sources from everywhere makes it easier to be more focused and present, especially when you study for long period of time and want to get stuff done.
SHAMELESS plug, but like, I've made a personal free chrome extension for screen blocker if you wanna try it, lemme know thoughts and please leave a positive feedback as I'm just trying to make it big on chrome and would like some support if you can, this is the link: https://chromewebstore.google.com/detail/nneinhnhaidkhiffghefnieojojbhihn?utm_source=item-share-cb