XOpenDisplay returns NULL with pkexec

375 views Asked by At

I'm developing simple X app, which works fine with sudo, but I can't open display with pkexec (XOpenDisplay returns 0). Any idea?? What am I missing?

Please note I added following policy in /usr/local/share/polkit-1/actions with symlink to /usr/share/polkit-1/actions:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>

  <action id="com.ubuntu.pkexec.app">
    <description>Test App</description>
    <message>Authentication is required to run Test App</message>
    <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/app</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>
  </action>

</policyconfig>
0

There are 0 answers