Results 1 to 5 of 5

Thread: pkexec - Mousepad-ERROR **: Cannot open display (

  1. #1
    Join Date
    Sep 2014
    Location
    Portugal
    Posts
    121

    Default pkexec - Mousepad-ERROR **: Cannot open display (

    Hi
    I was trying to implement some actions in Thunar , following their site : http://docs.xfce.org/xfce/thunar/custom-actions

    But I get this error where no X is found... or session... not sure.
    Basically it would be simple :
    Editing as root


    • Name: Edit as root
    • Command: gksu put-your-favourite-text-editor-here %f
    • File pattern: *
    • Appears if selection contains: Text files
    There is no gksu , so the pkexec is the replacement for that command.
    There's no errors running that command in thunar, but nothing happens.
    So in a terminal , I've try those commands , and I get this errors :
    Code:
    daniel@linux-7ya6:~/Documents> pkexec mousepad info.php 
    (mousepad:17064): Mousepad-ERROR **: Cannot open display:
    Or sudo mousepad or pkexec --user root mousepad

    Is there something to config in the system to open a X display ... I mean, other applications use it.

    If this is achievable , thunar it's great

    Thanks

  2. #2
    Join Date
    Sep 2014
    Location
    Portugal
    Posts
    121

    Default Re: pkexec - Mousepad-ERROR **: Cannot open display (

    Even If I make a sudo -E mousepad I get a lot of errors such as :

    Code:
    (mousepad:20366): GtkSourceView-CRITICAL **: gtk_source_style_scheme_get_id: assertion 'GTK_IS_SOURCE_STYLE_SCHEME (scheme)' failed
    
    (mousepad:20366): GtkSourceView-CRITICAL **: gtk_source_style_scheme_manager_get_scheme: assertion 'scheme_id != NULL' failed
    
    (mousepad:20366): GtkSourceView-CRITICAL **: gtk_source_style_scheme_get_id: assertion 'GTK_IS_SOURCE_STYLE_SCHEME (scheme)' failed
    They do not happen using leafpad
    But anyway , this doesn't seems to work in thunar actions.

  3. #3
    Join Date
    Sep 2014
    Location
    Portugal
    Posts
    121

    Default Re: pkexec - Mousepad-ERROR **: Cannot open display (

    I got this far, googling , in a ubuntu forum :

    Creating this alias in .bashrc , I can now execute pkexec in a terminal .

    Code:
    alias pkexec='pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY'
    But , in thunar , I still get no results.
    That forum, talks in creating a custom policy in /usr/share/polkit-1/

    There's actually a application in xfce panel, call Ice-Tea-Web-policy , but , I not sure if I want to mess around with that.

  4. #4
    Join Date
    Sep 2014
    Location
    Portugal
    Posts
    121

    Default Re: pkexec - Mousepad-ERROR **: Cannot open display (

    As for running Thunar as Super User , we have to place in /usr/share/polkit-1/actions/ a file, called org.freedesktop.pkexec.thunar.policy

    Code:
    <?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="org.freedesktop.pkexec.thunar">
        <message>Authentication is required to run thunar</message>
        <icon_name>thunar</icon_name>
        <defaults>
          <allow_any>auth_admin</allow_any>
          <allow_inactive>auth_admin</allow_inactive>
          <allow_active>auth_admin</allow_active>
        </defaults>
        <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/thunar</annotate>
        <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
      </action>
    
    </policyconfig>
    So in a custom action , the pkexec thunar %f will work
    And, I guess this is something that as to be done for all actions with privileges

  5. #5
    Join Date
    Sep 2014
    Location
    Portugal
    Posts
    121

    Default Re: pkexec - Mousepad-ERROR **: Cannot open display (

    For mousepad would be the same... but I get all those errors that I mentioned above, running mousepad..... leafpad it's ok , but I don't like the search and replace in leaf

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •