diff mbox series

[bug#47870,1/2] gnu: polkit-gnome: Add autostart .desktop file.

Message ID 563816062.89942.1618830123011@office.mailbox.org
State Accepted
Headers show
Series [bug#47870,1/2] gnu: polkit-gnome: Add autostart .desktop file. | expand

Commit Message

Brendan Tildesley April 19, 2021, 11:02 a.m. UTC
> On 04/19/2021 9:36 AM Leo Prikler <leo.prikler@student.tugraz.at> wrote:
> 
>  
> Hi Brendan,
> 
> Am Montag, den 19.04.2021, 08:56 +0200 schrieb Brendan Tildesley:
> > > On 04/18/2021 5:52 PM Leo Prikler <leo.prikler@student.tugraz.at>
> > > wrote:
> > > 
> > >  
> > > Hi,
> > > 
> > > Am Sonntag, den 18.04.2021, 17:15 +0200 schrieb Brendan Tildesley:
> > > > > On 04/18/2021 4:47 PM Leo Prikler <
> > > > > leo.prikler@student.tugraz.at>
> > > > > wrote:
> > [...]
> > > > On second thought perhaps another option is just to use the MATE
> > > > polkit
> > > > agent instead? I tested it for changing network manager and it
> > > > worked
> > > > just the same, only the GUI looks slightly different. I was
> > > > searching
> > > >  What do you think?
> > > If it works for XFCE, why not?  Given that polkit-gnome has no
> > > dependents other than itself, should we perhaps also look into
> > > removing
> > > it?
> > > 
> > One issue is that mate-polkit's .desktop file has the line
> > OnlyShowIn=MATE;
> > This prevents it from being launched in any other desktop. When
> > multiple 
> > desktops are installed all these files sit in /run/current-
> > desktop/profile/etc/
> > and rely these lines to make them not appear in other desktops.
> > 
> > I made a couple patches [attached] that adds XFCE to the the
> > .desktop's OnlyShowIn.
> > It's a little ugly though. 
> This may potentially be bikeshedding, but what about defining a
> (potentially hidden) package, that inherits from mate-polkit (call it
> mate-polkit-for-xfce) and installs a .desktop file, that replaces MATE
> with XFCE?  Ah, well, you'd also have to move the desktop file to a
> different location for there not to be a name clash.
> 

I think it's good to think about. This way makes it more self contained.

> Other than that, the contents of your patches LGTM, but the ChangeLog
> is on a pretty verbose end.  For instance, the message for 0001 should
> likely be rewritten as:
> 
> ----
> gnu: polkit-mate: Enable autostarting in XFCE.
> 
> Add XFCE to the OnlyShowIn field of the autostart .desktop file so it
> will be started by XFCE as well.  This is for the same of making
> polkit-mate the de facto polkit agent for XFCE in Guix, since XFCE does
> not ship its own.
> 
> A potential downside might be, that this desktop file ends up in the
> current system profile and can therefore be seen in XFCE
> configurations, that did not ask for it.
> 
> * gnu/packages/mate.scm (polkit-mate)[#:phases]: Add 'patch-desktop-
> for-xfce'.
> ----
> 
> You could also write significantly shorter commit messages, since
> "Enable autostarting in XFCE" already tells you everything the patch
> does.
> 
> Regards, Leo
Yeah I suck at commit messages. I've attached new patches doing it this way
and confirmed it worked in a VM.

Comments

Leo Prikler April 19, 2021, 11:12 a.m. UTC | #1
Hi Brendan,

Am Montag, den 19.04.2021, 13:02 +0200 schrieb Brendan Tildesley:
> gnu/packages/xfce.scm (xfce-mate-polkit-autostart) New symbol.
Scheme doesn't have symbols, it has variables.

> +(define-public xfce-mate-polkit-autostart
> +  (package
> +    (name "xfce-mate-polkit-autostart")
> +    (version "1")
> +    (inputs `(("mate-polkit" ,mate-polkit)))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (delete 'unpack)
> +         (delete 'bootstrap)
> +         (delete 'patch-usr-bin-file)
> +         (delete 'patch-source-shebangs)
> +         (delete 'configure)
> +         (delete 'patch-generated-file-shebangs)
> +         (delete 'check)
> +         (delete 'install)
> +         (delete 'patch-shebangs)
> +         (delete 'strip)
> +         (delete 'validate-runpath)
> +         (delete 'validate-documentation-location)
> +         (delete 'delete-info-dir-file)
> +         (delete 'patch-dot-desktop-files)
> +         (delete 'install-license-files)
> +         (delete 'reset-gzip-timestamps)
> +         (delete 'compress-documentation)
> +         (replace 'build
> +           (lambda _
> +             (let* ((mate-polkit (assoc-ref %build-inputs "mate-
> polkit"))
> +                    (out (assoc-ref %outputs "out"))
> +                    (dir (string-append out "/etc/xdg/autostart"))
> +                    (desktop (string-append
> +                              dir "/xfce4-polkit-mate-
> authentication-agent-1.desktop")))
> +               (mkdir-p dir)
> +               (copy-file (string-append
> +                           mate-polkit "/etc/xdg/autostart/"
> +                           "polkit-mate-authentication-agent-
> 1.desktop")
> +                          desktop)
> +               (substitute* desktop
> +                 (("^X-MATE.*") "")
> +                 (("MATE") "XFCE"))))))))
> +    (source #f) (home-page #f) (synopsis #f) (description #f)
> (license #f)
> +    (properties `((hidden? . #t)))))
That's a pretty large package description for something rather trivial.
Would the following work instead?

  (package/inherit mate-polkit
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-desktop-for-xfce
           (lambda _
             (substitute* "src/polkit-mate-authentication-agent-
1.desktop.in.in"
                 (("MATE;") "XFCE;"))))))))

Regards,
Leo
Brendan Tildesley April 19, 2021, 11:26 a.m. UTC | #2
> On 04/19/2021 1:12 PM Leo Prikler <leo.prikler@student.tugraz.at> wrote:
> 
>  
> Hi Brendan,
> 

> That's a pretty large package description for something rather trivial.
> Would the following work instead?
> 
>   (package/inherit mate-polkit
>     (arguments
>      `(#:phases
>        (modify-phases %standard-phases
>          (add-after 'unpack 'patch-desktop-for-xfce
>            (lambda _
>              (substitute* "src/polkit-mate-authentication-agent-
> 1.desktop.in.in"
>                  (("MATE;") "XFCE;"))))))))
> 
> Regards,
> Leo
Uhh ok it's simpler source code but now we're building it twice,
potentially having two copies of it and the .desktop file will have
the same filename and thus conflict if both desktops are installed.
Leo Prikler April 19, 2021, 12:01 p.m. UTC | #3
Am Montag, den 19.04.2021, 13:26 +0200 schrieb Brendan Tildesley:
> > On 04/19/2021 1:12 PM Leo Prikler <leo.prikler@student.tugraz.at>
> > wrote:
> > 
> >  
> > Hi Brendan,
> > 
> > That's a pretty large package description for something rather
> > trivial.
> > Would the following work instead?
> > 
> >   (package/inherit mate-polkit
> >     (arguments
> >      `(#:phases
> >        (modify-phases %standard-phases
> >          (add-after 'unpack 'patch-desktop-for-xfce
> >            (lambda _
> >              (substitute* "src/polkit-mate-authentication-agent-
> > 1.desktop.in.in"
> >                  (("MATE;") "XFCE;"))))))))
> > 
> > Regards,
> > Leo
> Uhh ok it's simpler source code but now we're building it twice,
> potentially having two copies of it and the .desktop file will have
> the same filename and thus conflict if both desktops are installed.
Oh, right, I was missing the part, in which we rename it.
W.r.t. "building it twice", that's only if you have both mate-polkit
and the new one in your profile, in which case I guess it would be
tolerable.  If you're using just MATE or just XFCE you'll build one or
the other.

FWIW, there is also xfce-polkit [1], but it was last updated 2020 with
the latest release in 2018 (which is still more recent than 2011,
though).  WDYT?

[1] https://github.com/ncopa/xfce-polkit
Brendan Tildesley April 19, 2021, 1:30 p.m. UTC | #4
> On 04/19/2021 2:01 PM Leo Prikler <leo.prikler@student.tugraz.at> wrote:
> 
>  
> Am Montag, den 19.04.2021, 13:26 +0200 schrieb Brendan Tildesley:
> > > On 04/19/2021 1:12 PM Leo Prikler <leo.prikler@student.tugraz.at>
> > > wrote:
> > > 
> > >  
> > > Hi Brendan,
> > > 
> > > That's a pretty large package description for something rather
> > > trivial.
> > > Would the following work instead?
> > > 
> > >   (package/inherit mate-polkit
> > >     (arguments
> > >      `(#:phases
> > >        (modify-phases %standard-phases
> > >          (add-after 'unpack 'patch-desktop-for-xfce
> > >            (lambda _
> > >              (substitute* "src/polkit-mate-authentication-agent-
> > > 1.desktop.in.in"
> > >                  (("MATE;") "XFCE;"))))))))
> > > 
> > > Regards,
> > > Leo
> > Uhh ok it's simpler source code but now we're building it twice,
> > potentially having two copies of it and the .desktop file will have
> > the same filename and thus conflict if both desktops are installed.
> Oh, right, I was missing the part, in which we rename it.
> W.r.t. "building it twice", that's only if you have both mate-polkit
> and the new one in your profile, in which case I guess it would be
> tolerable.  If you're using just MATE or just XFCE you'll build one or
> the other.
> 
> FWIW, there is also xfce-polkit [1], but it was last updated 2020 with
> the latest release in 2018 (which is still more recent than 2011,
> though).  WDYT?
> 
> [1] https://github.com/ncopa/xfce-polkit

Yeah I saw these but there is next to zero information on them.
I packaged it and it seems worse. It doesn't even have OK/Cancel buttons
for mouse operation in the password entry dialogue. It uses libxfce4ui
and has "xfce" in the name but otherwise doesn't seem any more or less
suitable for xfce than other agents.

At this point I just want to pick one and get it done with. If you like
I can make mate-polkit like your suggestion but rename the desktop file
so it doesn't conflict.


Debian's package says this on gnome-polkit:
"This implementation was originally designed for GNOME 2, but most GNOME-based desktop environments, including GNOME 3, GNOME Flashback, and MATE, have their own built-in PolicyKit agents and no longer use this one. The remaining users of this implementation are Cinnamon, XFCE and Unity. "
Leo Prikler April 19, 2021, 1:47 p.m. UTC | #5
Hi,

Am Montag, den 19.04.2021, 15:30 +0200 schrieb Brendan Tildesley:
> > On 04/19/2021 2:01 PM Leo Prikler <leo.prikler@student.tugraz.at>
> > wrote:
> > 
> >  
> > Am Montag, den 19.04.2021, 13:26 +0200 schrieb Brendan Tildesley:
> > > > On 04/19/2021 1:12 PM Leo Prikler <
> > > > leo.prikler@student.tugraz.at>
> > > > wrote:
> > > > 
> > > >  
> > > > Hi Brendan,
> > > > 
> > > > That's a pretty large package description for something rather
> > > > trivial.
> > > > Would the following work instead?
> > > > 
> > > >   (package/inherit mate-polkit
> > > >     (arguments
> > > >      `(#:phases
> > > >        (modify-phases %standard-phases
> > > >          (add-after 'unpack 'patch-desktop-for-xfce
> > > >            (lambda _
> > > >              (substitute* "src/polkit-mate-authentication-
> > > > agent-
> > > > 1.desktop.in.in"
> > > >                  (("MATE;") "XFCE;"))))))))
> > > > 
> > > > Regards,
> > > > Leo
> > > Uhh ok it's simpler source code but now we're building it twice,
> > > potentially having two copies of it and the .desktop file will
> > > have
> > > the same filename and thus conflict if both desktops are
> > > installed.
> > Oh, right, I was missing the part, in which we rename it.
> > W.r.t. "building it twice", that's only if you have both mate-
> > polkit
> > and the new one in your profile, in which case I guess it would be
> > tolerable.  If you're using just MATE or just XFCE you'll build one
> > or
> > the other.
> > 
> > FWIW, there is also xfce-polkit [1], but it was last updated 2020
> > with
> > the latest release in 2018 (which is still more recent than 2011,
> > though).  WDYT?
> > 
> > [1] https://github.com/ncopa/xfce-polkit
> 
> Yeah I saw these but there is next to zero information on them.
> I packaged it and it seems worse. It doesn't even have OK/Cancel
> buttons
> for mouse operation in the password entry dialogue. It uses
> libxfce4ui
> and has "xfce" in the name but otherwise doesn't seem any more or
> less
> suitable for xfce than other agents.
Fair enough, so it's either gnome or mate for XFCE.

> At this point I just want to pick one and get it done with. If you
> like
> I can make mate-polkit like your suggestion but rename the desktop
> file
> so it doesn't conflict.
It's your choice, what you want to implement:
1. gnome-polkit with an added desktop file (but please use an aux file
or make-desktop-file-entry instead of an origin pointing into the
aether)
2. mate-polkit-for-xfce with the renamed desktop file.
3. something completely else

I know that waiting long for your patch to be upstreamed can be
frustrating, but I'm not here to tease you; rather I want to ensure,
that whatever you do ends up not as a quick and dirty fix, but a proper
package.

> Debian's package says this on gnome-polkit:
> "This implementation was originally designed for GNOME 2, but most
> GNOME-based desktop environments, including GNOME 3, GNOME Flashback,
> and MATE, have their own built-in PolicyKit agents and no longer use
> this one. The remaining users of this implementation are Cinnamon,
> XFCE and Unity. "
Hmm, in that case keeping gnome-polkit around longer might be desirable
if people want to port Cinnamon or Unity.  What does Debian's desktop
file look like and could we port it over?

Regards,
Leo
diff mbox series

Patch

From d18093a93f34f7d134a6f97e58aa4abaadbe33a6 Mon Sep 17 00:00:00 2001
From: Brendan Tildesley <mail@brendan.scot>
Date: Mon, 19 Apr 2021 20:16:05 +1000
Subject: [PATCH 2/2] gnu: xfce: Add xfce-mate-polkit-autostart to inputs.

* gnu/packages/xfce.scm (xfce):[inputs]: Add xfce-mate-polkit-autostart.
---
 gnu/packages/xfce.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/xfce.scm b/gnu/packages/xfce.scm
index c7ba6218f1..974259306e 100644
--- a/gnu/packages/xfce.scm
+++ b/gnu/packages/xfce.scm
@@ -1016,6 +1016,7 @@  on your desktop.")
        ("gnome-icon-theme"     ,gnome-icon-theme)
        ("gtk-xfce-engine"      ,gtk-xfce-engine)
        ("hicolor-icon-theme"   ,hicolor-icon-theme)
+       ("xfce-mate-polkit-autostart" ,xfce-mate-polkit-autostart)
        ("ristretto"            ,ristretto)
        ("shared-mime-info"     ,shared-mime-info)
        ("thunar"               ,thunar)
-- 
2.31.1