Recently, gksu has been deprecated in favor of pkexec. Unfortunately, changes in how X works, and the unpolished state of Wayland, have resulted in many apps erroring when launched with pkexec. This little script remedies that. It's not perfect, I'm sure, but it's fairly thoroughly tested, works under both Wayland and X11, and handles flags passed at runtime. If you have a way of improving it, please let me know. I needed it for an edge case, and thought I'd share it in case anyone else did too.