Why do you want to have it on your shelf?
I assume that "your" xray effect is the same one as mine, but I do it by going to Shading/X-Ray.
since you can access this command from any viewport that shouldn't be problem.
If you really want the script, I will try to find it for you!
If the worst hasn't happened yet, that's because you haven't tried everything yet!