$currentPanel = `getPanel -withFocus`;
$state = `modelEditor -q -cameras $currentPanel`;
modelEditor -edit -cameras (!$state) $currentPanel;

//get the state of xray mode (either on or off)
$state = `modelEditor -q -xray $currentPanel`;
//set it to the opposite state
modelEditor -edit -xray (!$state) $currentPanel;

One button X-ray toggle for maya.

With a proper hotkey set up, x-ray mode can be faster and more useful then
fumbling between wireframe and smoothshade modes.

xray

This is the script you will need to copy and paste

 

 

 

 

 

 

 

mayahotkey

If you can, use "alt x" as your hotkey. Its already alt x in max, X is right on top of alt and you use alt to
orbit anyway. Plus it's mapped to something stupid by maya.