[sawfish] added reboot/shutdown menu entries for non GNOME/KDE users



commit 3d4a4d71d3ef4766eb432471218f4cef1db22d0c
Author: Christopher Roy Bratusek <chris nanolx org>
Date:   Mon Oct 26 18:59:20 2009 +0100

    added reboot/shutdown menu entries for non GNOME/KDE users

 ChangeLog                   |    5 +++++
 README.IMPORTANT            |   24 ++++++++++++++++++++++++
 lisp/sawfish/wm/defaults.jl |   21 +++++++++++++++++----
 3 files changed, 46 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a8d5874..127e9b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-26  Christopher Bratusek <zanghar freenet de>
+	* lisp/sawfish/wm/defaults.jl: added reboot/shutdown menu entries for non GNOME/KDE users
+
+	* README.IMPORTANT: provide instructions for how to let normal users use `shutdown'
+
 2009-10-24  Christopher Bratusek <zanghar freenet de>
 	* lisp/sawfish/wm/ext/apps-menu.jl: added a missing bracket
 
diff --git a/README.IMPORTANT b/README.IMPORTANT
index 9e31af9..92cb2b2 100644
--- a/README.IMPORTANT
+++ b/README.IMPORTANT
@@ -1,5 +1,29 @@
 In Sawfish 1.6.0 there are the following major changes:
 
+reboot/shutdown from root-menu
+******************************
+
+The sawfish root-menu has a session sub-menu which allows you
+to reboot and/or shutdown your machine. If you use GNOME or KDE,
+no additional work by you is required. But if you use sawfish
+standalone, you have to make sure that you're allowed to execute
+`shutdown', there are several ways to achieve that, the suggested
+approach is to use sudo combined with a group called shutdown:
+
+;; add a new group called `shutdown'
+groupadd shutdown
+
+;; add user to the `shutdown' group
+adduser misterx shutdown
+
+;; add the group `shutdown' to sudoers
+visudo
+  
+  ;; add the following:
+  %shutdown ALL=(root) NOPASSWD: /sbin/shutdown
+
+That's it, now everyone in the shutdown group can do it!
+
 sawfish-ui is now sawfish-config
 ********************************
 
diff --git a/lisp/sawfish/wm/defaults.jl b/lisp/sawfish/wm/defaults.jl
index 186505d..02531c4 100644
--- a/lisp/sawfish/wm/defaults.jl
+++ b/lisp/sawfish/wm/defaults.jl
@@ -28,17 +28,30 @@
 ;; magic comment to get an alias installed
 ;; (define-structure-alias sawfish-defaults sawfish.wm.defaults)
 
+(unless batch-mode
+
 ;; if it looks like GNOME is the desktop environment, then load the
 ;; extra GNOME integration module
-(unless batch-mode
   (if (getenv "GNOME_DESKTOP_SESSION_ID")
-      (require 'sawfish.wm.integration.gnome)))
+      (require 'sawfish.wm.integration.gnome)
 
 ;; if it looks like KDE is the desktop environment, then load the
 ;; extra KDE integration module
-(unless batch-mode
   (if (getenv "KDE_SESSION_VERSION")
-      (require 'sawfish.wm.integration.kde)))
+      (require 'sawfish.wm.integration.kde)
+
+;; if neither GNOME nor KDE is running, append standard
+;; reboot and shutdown actions to the session submenu
+
+;; read README.IMPORTANT if you don't know how to make
+;; non-root users able to use `shutdown'
+  (let ((menu (assoc (_ "Sessi_on") root-menu)))
+    (when menu
+      (nconc menu `(()
+                    (,(_ "_Reboot System")
+                     (system "sudo shutdown -r now &"))
+                    (,(_ "_Shutdown System")
+                     (system "sudo shutdown -h now &")))))))))
 
 ;; save errors to aid debugging
 (require 'sawfish.wm.ext.error-handler)



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