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.
"Oppressors can tyrannize only when they achieve a standing army, an enslaved press, and a disarmed populace." James Madison
'08 34' Classic SO, '12 Ram 2500 4X4, 6.7L Cummins.