Why is my pkexec does not work in ubuntu 18.04?

I had to run the script from the root using .desktop

Symptoms: when you start asking for the password and exits.

Ubuntu 18.04
File .desktop standard, $path prescribed
The variable Exec=pkexec env display=$display xauthority=$xauthority myscript
The script is valid.
Logs the script does not write to his performance, it seems, never comes.

When you try enforcing "pkexec env display=$display xauthority=$xauthority /full/path/myscript" in the console works normally.
Supplement $Exec full path doesn't work - the symptom was repeated.

Dear Jedi direct my power. Thank you.
March 23rd 20 at 19:06
1 answer
March 23rd 20 at 19:08
Method pre-sleep meditation, suggested to export the variable $DISPLAY in the script itself.
Prescribed in the script:
export DISPLAY=:0.0

Hope beginners like me will be useful.

Find more questions by tags UbuntuLinux