When I got the key lock for the forward baggage compartment, it came with two sets of locks and keys so I repurposed the second one as a canopy lock. Nothing fancy and it's certainly not going to stop anyone from breaking into the aircraft. I still have mixed feelings about it when I consider the work that went into the canopy. Would I rather they just steal my avionics and not break the canopy or would I rather they break the canopy and steal my avionics anyway? Catch 22.
I mounted a square aluminum block on the side rail and you can see how the locking lever comes down in front of the block.
I did mine similar to Carlos151, but used aluminum angle instead of blocks. I also added a second stop a few inches aft of the fully closed lock so I could lock it with the canopy open about three inches. It helps keep the interior a little bit cooler on a hot ramp while I have my $150 hamburger