[clfswm-cvs] r257 - in clfswm: . contrib
Philippe Brochard
pbrochard at common-lisp.net
Sun Nov 8 14:18:58 UTC 2009
Author: pbrochard
Date: Sun Nov 8 09:18:58 2009
New Revision: 257
Log:
Add a Suspend/Reboot/Halt menu in contrib
Added:
clfswm/contrib/reboot-halt.lisp
Modified:
clfswm/ChangeLog
Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog (original)
+++ clfswm/ChangeLog Sun Nov 8 09:18:58 2009
@@ -1,5 +1,8 @@
2009-11-08 Philippe Brochard <pbrochard at common-lisp.net>
+ * contrib/reboot-halt.lisp: Add a Suspend/Reboot/Halt menu in
+ contrib.
+
* src/clfswm.lisp (main): Add a read-conf-file-p parameter to
prevent reading the configuration file (this may be useful to
produce the original documentation without user modifications
Added: clfswm/contrib/reboot-halt.lisp
==============================================================================
--- (empty file)
+++ clfswm/contrib/reboot-halt.lisp Sun Nov 8 09:18:58 2009
@@ -0,0 +1,72 @@
+;;; --------------------------------------------------------------------------
+;;; CLFSWM - FullScreen Window Manager
+;;;
+;;; --------------------------------------------------------------------------
+;;; Documentation: Reboot and halt menu
+;;; --------------------------------------------------------------------------
+;;;
+;;; (C) 2009 Philippe Brochard <hocwp at free.fr>
+;;;
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program; if not, write to the Free Software
+;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;;;
+;;; Documentation: If you want to use this file, just add this line in
+;;; your configuration file:
+;;;
+;;; (load-contrib "mpd.lisp")
+;;;
+;;; --------------------------------------------------------------------------
+
+(in-package :clfswm)
+
+(format t "Loading Reboot/Halt code... ")
+
+
+(defun reboot-halt-menu ()
+ "Open the Reboot/Halt menu"
+ (open-menu (find-menu 'reboot-halt-menu)))
+
+
+(defun do-with-terminal (command)
+ ;;(do-shell (format nil "xterm -e '~A'" command)))
+ (do-shell (format nil "xterm -e 'echo ~A; sleep 3'" command))) ;; test
+
+(defun do-suspend ()
+ "Suspend the computer to RAM"
+ (do-with-terminal "sudo pm-suspend"))
+
+(defun do-reboot ()
+ "Reboot the computer"
+ (do-with-terminal "sudo reboot"))
+
+(defun do-halt ()
+ "Halt the computer"
+ (do-with-terminal "sudo halt"))
+
+(unless (find-menu 'reboot-halt-menu)
+ (add-sub-menu 'help-menu "Pause" 'reboot-halt-menu "Suspend/Reboot/Halt menu")
+
+ (add-menu-key 'reboot-halt-menu "s" 'do-suspend)
+ (add-menu-key 'reboot-halt-menu "r" 'do-reboot)
+ (add-menu-key 'reboot-halt-menu "h" 'do-halt)
+ (add-menu-key 'reboot-halt-menu "Return" 'do-suspend)
+ (add-menu-key 'reboot-halt-menu "space" 'do-suspend))
+
+
+(defun reboot-halt-binding ()
+ (define-main-key ("Pause") 'reboot-halt-menu))
+
+(add-hook *binding-hook* 'reboot-halt-binding)
+
+(format t "done~%")
More information about the clfswm-cvs
mailing list