Jedi gesture control slide top

So im new here and am very new to coding. I had an idea for a giftbox for a lightsaber hilt im getting for my brother, I’m trying to take a wooden wine box with a sliding lid and have it on gesture control so you can emulate force powers to open and close the lid. Ive found a decent launch point with this video

But my question is how can i make it so i have to lid move a set distance for open and a set distance on close? Is there a way to add a switch to the closed lid end point to signal that its reached it?

And a second question, would anyone be able to suggest a battery that can power this and that i can maybe hide in a false bottom in the box?

Thank you for looking this over and i apologize if my sentences seem brisk, I’m currently typing this at work. I will also post pics of said box and track once i get them in an online gallery
Saber gesture box project Saber gesture box project - Album on Imgur

Hope that link works!<3