Overhauling the root-menu



Hi all,

I spend some time thinking about the root-menu.

The result is:

- sawfish.wm.commands.xterm would be sawfish.wm.commands.user, not just containing the "xterm" command, but also (theoretical defaults in brackets):
* editor (xedit) - should be o.k.
* browser (www-browser) - should be o.k.
* mailer (xdg-email) - opens the new-mail dialog of your mail-app
* image-viewer (gqview) - difficult to decide a default value
* media-player (gmplayer) - should be o.k.
* package-manager (gksu -u root synaptic) - Not sure about this one in general
They are fully adjustable in the "Default Applications" group in sawfish-ui
- some more separators
- Sawfish Root Menu is the first entry (just a dummy to display the text)
- Display errors and Kill Window (xkill) added
- xterm-args defcustom removed (add your args to xterm defcustom, works aswell)
- When GNOME-Integration is loaded, users can decide wether to use the default-apps-menu or the gnome-apps-menu

How to apply the patch:

git mv lisp/sawfish/wm/commands/xterm.jl  lisp/sawfish/wm/commands/user.jl
patch -Np1 -i 1

Let me hear your thoughts,
Chris

Sawfish rules!
diff --git a/lisp/sawfish/wm/autoload.jl b/lisp/sawfish/wm/autoload.jl
index cbcc1fc..0630f88 100644
--- a/lisp/sawfish/wm/autoload.jl
+++ b/lisp/sawfish/wm/autoload.jl
@@ -139,7 +139,13 @@
 (autoload-command 'cycle-class-backwards 'sawfish.wm.commands.x-cycle)
 (autoload-command 'cycle-dock 'sawfish.wm.commands.x-cycle)
 (autoload-command 'cycle-dock-backwards 'sawfish.wm.commands.x-cycle)
-(autoload-command (quote xterm) (quote sawfish.wm.commands.xterm))
+(autoload-command 'xterm 'sawfish.wm.commands.user)
+(autoload-command 'editor 'sawfish.wm.commands.user)
+(autoload-command 'browser 'sawfish.wm.commands.user)
+(autoload-command 'mailer 'sawfish.wm.commands.user)
+(autoload-command 'image-viwer 'sawfish.wm.commands.user)
+(autoload-command 'media-player 'sawfish.wm.commands.user)
+(autoload-command 'package-manager 'sawfish.wm.commands.user)
 (autoload-command (quote 3d-hack) (quote sawfish.wm.ext.3d-hack))
 (defgroup audio "Sound" :require sawfish.wm.ext.audio-events)
 (defgroup match-window "Matched Windows" :layout single :require sawfish.wm.ext.match-window)
diff --git a/lisp/sawfish/wm/commands/help.jl b/lisp/sawfish/wm/commands/help.jl
index 008824c..e2905af 100644
--- a/lisp/sawfish/wm/commands/help.jl
+++ b/lisp/sawfish/wm/commands/help.jl
@@ -30,7 +30,7 @@
 	  rep.regexp
 	  rep.io.files
 	  sawfish.wm.commands
-	  sawfish.wm.commands.xterm)
+	  sawfish.wm.commands.user)
 
   ;; Info
 
diff --git a/lisp/sawfish/wm/commands/user.jl b/lisp/sawfish/wm/commands/user.jl
index bae3a53..1094344 100644
--- a/lisp/sawfish/wm/commands/user.jl
+++ b/lisp/sawfish/wm/commands/user.jl
@@ -21,32 +21,101 @@
    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 |#
 
-(define-structure sawfish.wm.commands.xterm
+(define-structure sawfish.wm.commands.user
 
-    (export xterm)
+    (export xterm
+            editor
+	    browser
+	    mailer
+	    image-viewer
+	    media-player
+	    package-manager)
 
     (open rep
 	  rep.system
 	  sawfish.wm.custom
 	  sawfish.wm.commands)
 
+  (defgroup apps "Default Applications")
+
   (defcustom xterm-program "xterm"
     "The program launched by the `xterm' command."
     :type string
-    :group misc)
+    :group apps)
+
+  (defcustom editor-program "xedit"
+    "The program launched by the `editor' command."
+    :type string
+    :group apps)
+
+  (defcustom browser-program "www-browser"
+    "The program launched by the `browser' command."
+    :type string
+    :group apps)
+
+  (defcustom mailer-program "xdg-email"
+    "The program launched by the `mailer' command."
+    :type string
+    :group apps)
+
+  (defcustom image-viewer-program "gqview"
+    "The program launched by the `image-viewer' command."
+    :type string
+    :group apps)
 
-  (defcustom xterm-args ""
-    "Arguments given to the `xterm' command."
+  (defcustom media-player-program "gmplayer"
+    "The program launched by the `media-player' command."
     :type string
-    :group misc)
+    :group apps)
+
+  (defcustom package-manager-program "gksu -u root synaptic"
+    "The program launched by the `package-manager' command."
+    :type string
+    :group apps)
 
   (define (xterm #!optional command)
     "Start a new xterm."
     (if (not command)
-	(system (format nil "%s %s >/dev/null 2>&1 </dev/null &"
-			xterm-program (or xterm-args "")))
-      (system (format nil "%s %s -e %s >/dev/null 2>&1 </dev/null&"
-		      xterm-program (or xterm-args "") command))))
+	(system (format nil "%s >/dev/null 2>&1 </dev/null &"
+			xterm-program))
+      (system (format nil "%s -e %s >/dev/null 2>&1 </dev/null&"
+		      xterm-program command))))
+
+  (define (editor)
+    "Start a new editor instance"
+    (system (format nil "%s >/dev/null 2>&1 </dev/null &"
+			editor-program)))
+
+  (define (browser)
+    "Start a new browser instance"
+    (system (format nil "%s >/dev/null 2>&1 </dev/null &"
+			browser-program)))
+
+  (define (mailer)
+    "Start a new mailer instance"
+    (system (format nil "%s >/dev/null 2>&1 </dev/null &"
+			mailer-program)))
+
+  (define (image-viewer)
+    "Start a new image-viewer instance"
+    (system (format nil "%s >/dev/null 2>&1 </dev/null &"
+			image-viewer-program)))
+
+  (define (media-player)
+    "Start a new media-player instance"
+    (system (format nil "%s >/dev/null 2>&1 </dev/null &"
+			media-player-program)))
+
+  (define (package-manager)
+    "Start a new package-manager instance"
+    (system (format nil "%s >/dev/null 2>&1 </dev/null &"
+			package-manager-program)))
 
   ;;###autoload
-  (define-command 'xterm xterm))
+  (define-command 'xterm xterm #:class 'default)
+  (define-command 'editor editor #:class 'default)
+  (define-command 'browser browser #:class 'default)
+  (define-command 'mailer mailer #:class 'default)
+  (define-command 'image-viewer image-viewer #:class 'default)
+  (define-command 'media-player media-player #:class 'default)
+  (define-command 'package-manager package-manager #:class 'default))
diff --git a/lisp/sawfish/wm/customize.jl b/lisp/sawfish/wm/customize.jl
index e770784..e3de2d6 100644
--- a/lisp/sawfish/wm/customize.jl
+++ b/lisp/sawfish/wm/customize.jl
@@ -48,7 +48,7 @@
 
   (define (customize #!optional group)
     "Invoke the user-customization system."
-    (system (format nil "%s %s '%S' >/dev/null 2>&1 </dev/null &"
+    (system (format nil "%s %s '%S' >~/.xsession-errors 2>&1 <~/.xsession-errors &"
 		    customize-program
 		    (if group customize-group-opt "")
 		    (or group ""))))
diff --git a/lisp/sawfish/wm/gnome/integration.jl b/lisp/sawfish/wm/gnome/integration.jl
index ed3ab07..9128ffc 100644
--- a/lisp/sawfish/wm/gnome/integration.jl
+++ b/lisp/sawfish/wm/gnome/integration.jl
@@ -28,16 +28,10 @@
 	  sawfish.wm.menus
 	  sawfish.wm.custom
 	  sawfish.wm.commands.help
-	  sawfish.wm.commands.xterm)
+	  sawfish.wm.commands.user)
 
   (define-structure-alias gnome-int sawfish.wm.gnome.integration)
 
-  (when (null (last root-menu))
-    (setq root-menu (delq (last root-menu) root-menu)))
-
-  ;; this option was removed for gnome2
-  (put 'gnome-use-capplet 'custom-obsolete t)
-
   ;; invoke the GNOME terminal instead of xterm
   (unless (variable-customized-p 'xterm-program)
     (setq xterm-program "x-terminal-emulator"))
diff --git a/lisp/sawfish/wm/gnome/menus.jl b/lisp/sawfish/wm/gnome/menus.jl
index 25ca6d9..fd105c2 100644
--- a/lisp/sawfish/wm/gnome/menus.jl
+++ b/lisp/sawfish/wm/gnome/menus.jl
@@ -28,7 +28,8 @@
 	  rep.system
 	  rep.regexp
 	  rep.io.files
-	  sawfish.wm.commands)
+	  sawfish.wm.commands
+	  sawfish.wm.custom)
 
   (define-structure-alias gnome-menu sawfish.wm.gnome.menus)
 
@@ -229,8 +230,14 @@
 
   ;; take over the applications submenu of the root window menu
 
-  (make-variable-special 'apps-menu)
-  (setq apps-menu gnome-menus)
+  (defcustom gnome-menu 't
+    "Wether to not use the GNOME menu, while running GNOME"
+    :type boolean
+    :group apps)
+
+  (if gnome-menu
+    (make-variable-special 'apps-menu)
+    (setq apps-menu gnome-menus))
 
   ;; load the menus when we idle, it reduces the latency of the first
   ;; menu popup
diff --git a/lisp/sawfish/wm/menus.jl b/lisp/sawfish/wm/menus.jl
index c2047bf..1919e2c 100644
--- a/lisp/sawfish/wm/menus.jl
+++ b/lisp/sawfish/wm/menus.jl
@@ -44,7 +44,9 @@
 	  sawfish.wm.util.groups
 	  sawfish.wm.workspace
 	  sawfish.wm.state.maximize
-	  sawfish.wm.state.iconify)
+	  sawfish.wm.state.iconify
+	  sawfish.wm.commands.user
+	  sawfish.wm.ext.error-handler)
 
   (define-structure-alias menus sawfish.wm.menus)
 
@@ -117,28 +119,36 @@ before killing it.")
   (defvar window-menu nil)
 
   (defvar root-menu
-    `((,(_ "_Windows") . window-menu)
+    `((,(_ "Sawfish Rootmenu"))
+      ()
+      (,(_ "_Windows") . window-menu)
       (,(_ "Work_spaces") . workspace-menu)
+      ()
       (,(_ "_Programs") . apps-menu)
       (,(_ "_Customize") . custom-menu)
+      ()
       (,(_ "_Help")
        (,(_ "_FAQ...") help:show-faq)
        (,(_ "_News...") help:show-news)
        (,(_ "_WWW page...") help:show-homepage)
        (,(_ "_Manual...") help:show-programmer-manual)
+       ()
        (,(_ "_About Sawfish...") help:about))
       ()
+      (,(_ "_Display Errors") display-errors)
+      (,(_ "_Kill Window") (system "xkill &"))
+      ()
       (,(_ "_Restart") restart)
       (,(_ "_Quit") quit)))
 
   (defvar apps-menu
-    `(("xterm" (system "xterm &"))
-      ("Emacs" (system "emacs &"))
-      ("Netscape" (system "netscape &"))
-      ("The GIMP" (system "gimp &"))
-      ("XFIG" (system "xfig &"))
-      ("GV" (system "gv &"))
-      ("xcalc" (system "xcalc &"))))
+    `(("Terminal" xterm)
+      ("Editor" editor)
+      ("Browser" browser)
+      ("Mailer" mailer)
+      ("Image Viewer" image-viewer)
+      ("Media Player" media-player)
+      ("Package Manager" package-manager)))
 
   (define (menu-start-process)
     (when menu-timer

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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