unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andy Wingo <wingo@igalia.com>
To: guix-devel@gnu.org
Subject: [PATCH] Add GNOME and XFCE desktop services.
Date: Wed, 24 Feb 2016 23:14:50 +0100	[thread overview]
Message-ID: <8737sh92n9.fsf@pobox.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

This gets me a little farther but not far enough :)  With my polkit
patch, which is under upstream discussion but probably will go in in
some different form, I can "pkexec ls", allowing me to "ls" as root if I
supply the root password.  With this patch, I should be able to run this
program as the "active" user:

   <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
   <annotate key="org.freedesktop.policykit.exec.path">/gnu/store/5l02a25w3gagrxf9nyfayayyiphfmk50-gnome-settings-daemon-3.18.2/libexec/gsd-backlight-helper</annotate>

But:

  $ pkexec /gnu/store/5l02a25w3gagrxf9nyfayayyiphfmk50-gnome-settings-daemon-3.18.2/libexec/gsd-backlight-helper --set-brightness 300
  Error executing command as another user: Not authorized

  This incident has been reported.

So not even an opportunity to enter a password.  Evidently polkit
doesn't see me as "active".  Probably an elogind thing.  Anyway, still,
going in the right way I think.

Andy


[-- Attachment #2: 0001-gnu-services-Add-GNOME-and-XFCE-desktop-services.patch --]
[-- Type: text/plain, Size: 3455 bytes --]

From 0d3b2b47b9742a5b381cd3e89b12f00951b557e9 Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@igalia.com>
Date: Wed, 24 Feb 2016 23:08:58 +0100
Subject: [PATCH] gnu: services: Add GNOME and XFCE desktop services.

* gnu/services/desktop.scm (<gnome-desktop-configuration>)
(gnome-desktop-service-type, <xfce-desktop-configuration>)
(xfce-desktop-service-type): New variables.
(gnome-desktop-service, xfce-desktop-service): New public variables.
* gnu/services/desktop.scm (%desktop-services): Add
gnome-desktop-service and xfce-desktop-service.
---
 gnu/services/desktop.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 02bcf1b..2f81a68 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -32,6 +32,7 @@
   #:use-module (gnu packages admin)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages xfce)
   #:use-module (gnu packages avahi)
   #:use-module (gnu packages polkit)
   #:use-module (gnu packages xdisorg)
@@ -51,6 +52,8 @@
             polkit-service
             elogind-configuration
             elogind-service
+            gnome-desktop-service
+            xfce-desktop-service
             %desktop-services))
 
 ;;; Commentary:
@@ -710,6 +713,52 @@ when they log out."
 
 \f
 ;;;
+;;; GNOME desktop service.
+;;;
+
+(define-record-type* <gnome-desktop-configuration> gnome-desktop-configuration
+  make-gnome-desktop-configuration
+  gnome-desktop-configuration
+  (gnome-settings-daemon           gnome-settings-daemon-package
+                                   (default gnome-settings-daemon)))
+
+(define gnome-desktop-service-type
+  (service-type
+   (name 'gnome-desktop)
+   (extensions
+    (list (service-extension polkit-service-type
+                             (compose list gnome-settings-daemon-package))))))
+
+(define* (gnome-desktop-service #:key (config (gnome-desktop-configuration)))
+  "Return a service that enables the GNOME desktop to run privileged commands,
+like changing the backlight of an LCD, on behalf of a user logged in to a
+graphical session."
+  (service gnome-desktop-service-type config))
+
+\f
+;;;
+;;; XFCE desktop service.
+;;;
+
+(define-record-type* <xfce-desktop-configuration> xfce-desktop-configuration
+  make-xfce-desktop-configuration
+  xfce-desktop-configuration
+  (thunar thunar-package (default thunar)))
+
+(define xfce-desktop-service-type
+  (service-type
+   (name 'xfce-desktop)
+   (extensions
+    (list (service-extension polkit-service-type
+                             (compose list thunar-package))))))
+
+(define* (xfce-desktop-service #:key (config (xfce-desktop-configuration)))
+  "Return a service that enables the XFCE desktop to run a file manager as
+root, if the user authenticates using the root password."
+  (service xfce-desktop-service-type config))
+
+\f
+;;;
 ;;; The default set of desktop services.
 ;;;
 
@@ -717,6 +766,10 @@ when they log out."
   ;; List of services typically useful for a "desktop" use case.
   (cons* (slim-service)
 
+         ;; Polkit permissions for desktops to control brightness, etc.
+         (gnome-desktop-service)
+         (xfce-desktop-service)
+
          ;; Screen lockers are a pretty useful thing and these are small.
          (screen-locker-service slock)
          (screen-locker-service xlockmore "xlock")
-- 
2.6.3


             reply	other threads:[~2016-02-24 22:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 22:14 Andy Wingo [this message]
2016-02-25  2:40 ` [PATCH] Add GNOME and XFCE desktop services 宋文武
2016-02-25  7:52   ` Andy Wingo
2016-02-25 18:46     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737sh92n9.fsf@pobox.com \
    --to=wingo@igalia.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).