I like reading in my hammock. I also like sleeping in my hammock. What I didn't like was moment between. The realizing that my hand is too short to switch off lamp and the need for getting up and then as soon as dark is around looking for pleasing sleeping position again. It needed some hack...
1) You need to understand some basic home electrics. If you are not able to create simple extension cord from parts, please don't try it. It's really not worth to get electrified.
2) Whole idea is pretty simple: make an extension cord with remote switch of phase line. In our country there are three lines in extension cord, but after pluging it into socket, only one of them is "alive". That one needs to be cut and lengthen to the switch. I was considering extension cord with build-in switch, but it would mean too much cables through my room. I also didn't want to change cabling of the lamp.
3) You need: dismantleable male plug, dismantleable stand-alone outlet, 3 line cord (for extension cord), 2 line flat cord (for switch), leg switch, pliers, screwdriver, electric isolating tape and electric tester. Both cords shlould have same diameter of lines. Lengths of cords are up to you, consider your situation and needs.
4) See the "schema" and get parts together. Think about "alive" line. If it's on the left/right side of wall outlet, it must be on the same side of cord outlet. Isolate connections, check functionality with tester and plug it between the lamp and wall.
5) Enjoy ;)