Ah sorry I'm an idiot. I meant to say I already tried the code in the userSetup, not the maya.env. Unfortunately it does not work. I think it gets parsed before the getPanel -vis code has a chance to execute properly. Oh well, I can just put this to a hotkey in the meantime as workaround if this is not possible.
In Maya there's an option to draw thicker lines in the viewport. As Im using a hi res display it's much better for me to have the thicker lines however Maya forgets this settings. I have this MEL code: string $visPanels[] = `getPanel -vis`; modelEditor -e -lineWidth 2 $visPanels; But can't seem to find a way to exceute it…