Stephen thinks of Hamlet yet again near the end of Proteus, in reference to his personal attire: "My cockle hat and staff and hismy sandal shoon." He is quoting from the song that Ophelia sings in her mad scene (Hamlet 4.5), lamenting a lover who has proved untrue.
Pilgrims to the shrine of Saint James in Compostela traditionally carried a long staff, with a knob or hook near the top, and wore a hat decorated with a scallop shell. The hat was often called a "cockle hat" because cockles are close relatives of scallops, biologically and linguistically. (The Latin word conchylium meant shellfish, mussel, or oyster. The French word coquille means shell, and can refer to scallops.) Beginning with some of the later troubadours, love poetry often characterized the true lover as a pilgrim, and this metaphor became a commonplace in Elizabethan poetry. (Its best-known expression is probably the shared sonnet in Romeo and Juliet 1.5.) Ophelia's song draws on all this accumulated cultural capital in distinguishing loyal from faithless love:
How should I your true-love know,
From another one?
By his cockle hat and staff,
And his sandal shoon.
The song goes on to grieve Polonius' death and to note that no "true-love showers" bewailed his burial. It concludes with the story of a young maid who has sex with her true love and then is abandoned by him. The entire song clearly bears on Hamlet, who killed Polonius and deserted Ophelia.
Stephen is well-attired to play the part of the Shakespearean pilgrim. He has a hat ("my Hamlet hat"), a staff (his ashplant), and what he called "borrowed sandals" eleven paragraphs earlier (the perforated "brogues" that he has borrowed from Mulligan, hence "hismy"). But why should he characterize himself as a true, or false, lover? He has been wishing, nine paragraphs earlier in the text, for some woman to rescue him ("Touch me. Soft eyes. Soft soft soft hand. I am lonely here. O, touch me soon, now. What is that word known to all men? I am quiet here alone. Sad too. Touch, touch me"), a wish that associates him with Joyce's discovery of true love. Since he so clearly associates Hamlet with artistic inspiration, perhaps one can hear in this allusion some recognition that he must be a lover before he can be a writer.