guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add GNOME and XFCE desktop services.


From: Andy Wingo
Subject: [PATCH] Add GNOME and XFCE desktop services.
Date: Wed, 24 Feb 2016 23:14:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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

>From 0d3b2b47b9742a5b381cd3e89b12f00951b557e9 Mon Sep 17 00:00:00 2001
From: Andy Wingo <address@hidden>
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."
 
 
 ;;;
+;;; 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))
+
+
+;;;
+;;; 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))
+
+
+;;;
 ;;; 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 via email to

[Prev in Thread] Current Thread [Next in Thread]