I always just assumed lightsabers had a sort of deadman switch built in. It could easily be based on touch-sensitive technology. As long as you’re gripping the handle it will stay on.
As for throwing it, maybe they have a control that can lock it on for a time limit or until an impact of a certain G. Or just use the Force to keep it on while it flies.