For the ledge use a wood moulding with measurements as close as possible, cut it to the desired length and with a planer or sand paper get it to 2 cm width and 0,9 cm height.
Then you mark the height d (for measurements see drawing below) and continue accordingly.
Now you mark on the upper side c 3 points centred in the same distance for drilling the holes.
When drilling be sure not to drill to deep (3,5-4 mm) and at a 90 degree angle in relation to the upper side.
Now you only have to glue in the disc magnets.
The finished ledge looks like this: