We have some sliding doors in our house, called "pocket doors" by the builders, I believe, and they have a locking mechanism. You might be able to adapt one of them to your sliding bathroom door.
"Those who expect to reap the blessings of freedom, like men, must undergo the fatigue of supporting it." Thomas Paine
'08 34' Classic SO, '12 Ram 2500 4X4, 6.7L Cummins.