You can use the nail gun to hold them in place while they dry.
Hanging shelves on an uneven wall.
As the shaft of the pencil passes over an uneven place in the wall it causes the line drawn on the board to skip outlining the uneven parts of the wall.
Use the drawn line to help you ensure the shelf stays even.
Then install anchors or drive the screws into the studs and hang the shelf.
Attach the plywood top to the frame.
Then check the shelf to make sure it s sturdy and ready to bear the weight of whatever you put on top of it.
Pick up the shelf with the fasteners attached and line it up on the wall.
Position the shelf on the wall.
Hang the shelf on the mounting brackets.
Use liquid nails to attach the front and optional sides.
You can have someone hold the shelf for you while you use a level to double check the evenness if desired.
Step 4 cut along the pencil line using a table saw.
With some setups the shelf rests on top of the brackets.
Place the shelf frame with the bottom but no top where you want it on the wall and screw it into every stud that it touches.
Or just using a bracket that would allow you to move the shelf away from the wall slightly.
Adjust the level until the bubble is centered and mark the keyhole locations on the wall.
Hold the level against the wall at the height you want the shelf.
For example using an ordinary standard and bracket shelving system would push the shelf itself off the wall by about 1 2.
Fit a floating shelf by pushing it onto the bracket instead.
If you want the line to stay invisible place the top of the shelf on the line.