SiteMap RecentChanges

StumpPatches

Here are some patches users have created.

Managing Bookmarks with Stumpwm

I've created a addon to stumpwm which lets you manage your bookmarks with stumpwm instead of your browser. Each bookmark consists of a description, the URL and a set of self-defined tags. When browsing bookmarks you can restrict them to tags or regexps matching either the description or the URL. You can fetch the file from my git repository: http://www.tsdh.de/repos/git/stumpwm-addons.git

Start Script

Shell script meant to be executed as end client from xinitrc (or xsession or any script you start stumpwm from)

The script will pop up a window asking what to do, you can start or update stumpwm (from cvs), start an other wm (twm by default) or exit.

Each time you exit the current wm, the script will pop up this window again, so you can switch to an other wm without killing X (and all the running windows)

You'll probably have to modify it to reflect your settings.

http://simias.hd.free.fr/~simias/start-stumpwm.sh.txt

It is up again now, but I pasted it here anyway: StumpWMStartScript

No pop-ups

Some applications can take a few seconds to load and then pop up suddenly while you are typing away. However dialog boxes in the current application should appear. Put this code in your stumpwmrc to fix things.

For current CVS 2007 May.

(defun window-should-seize-focus (window)
  (equalp (xlib:get-wm-class (window-xwin window)) "urxvt"))

(defun window-in-current-wmgroup (window)
  (equalp (window-wmgroup window) 
	  (window-wmgroup (frame-window (window-frame window)))))

(defun window-wmgroup (window)
  (or (ignore-errors (xlib:wm-hints-window-group (xlib:wm-hints (window-xwin window))))
      (gensym)))

(defgeneric deny-window-request (window deny-list))

(defun deny-request-p (window deny-list)
  (deny-window-request window deny-list))

(defmethod deny-window-request (window (deny-list (eql t)))
  t)

(defmethod deny-window-request (window (deny-list sequence))
  (find-if 'deny-window-request deny-list))

(defmethod deny-window-request (window deny-list)
  (match-res-or-type window deny-list))

(defmethod deny-window-request (window (deny-list function))
  (funcall deny-list window))


(setf *deny-raise-request* nil)
(setf *deny-map-request* 
      (lambda(window) (not 
		       (or (window-in-current-wmgroup window)
			   (window-should-seize-focus window)))))

(setf *deny-raise-request* *deny-map-request*)

For the 2006 Debian package

(defun window-should-seize-focus (window screen)
  (declare (ignore screen))
  (equalp (xlib:get-wm-class window) "urxvt"))

(defun window-group (window)
  (or (ignore-errors (xlib:wm-hints-window-group (xlib:wm-hints window)))
      (gensym)))

(defun window-parent (window)
  (multiple-value-bind (children parent) (xlib:query-tree window)
    (declare (ignore children))
    parent))

(define-stump-event-handler :map-request (#|parent|# send-event-p window)
  (unless send-event-p
    (let* ((screen (window-screen window))
	   (current-window-groupp
	   (equalp (window-group window) (window-group (screen-current-window screen)))))
      ;; only absorb it if it's not already managed (it could be iconic)
      (unless (find window (screen-mapped-windows screen) :test 'xlib:window-equal)
	(process-new-window window)
	(absorb-mapped-window screen window))
      ;; Only give the window focus if it is in the current window group, or is somehow expected
      (if (or current-window-groupp
	      (window-should-seize-focus window screen))
	  (frame-raise-window screen (window-frame screen window) window)
	  (hide-window window)))))

John Fremlin (john at fremlin.org)

Reload everything including stumpwmrc

The normal reload does not reload the stumpwmrc for some reason. This fixes it

For CVS 2007 May

(define-stumpwm-command "reload-all" ()
    (run-commands 
     "reload"
     "loadrc"))

For the 2006 Debian package

(define-stumpwm-command "reload" (screen)
  (echo-string screen "Reloading StumpWM...")
  (asdf:operate 'asdf:load-op :stumpwm)
  (multiple-value-bind (success err rc) (load-rc-file)
    (echo-string screen
		 (if success
		     "Reloading StumpWM...Done"
		     (format nil "Error loading ~A: ~A" rc err)))))

John Fremlin (john at fremlin.org)

Trash group

A couple of functions for "banishing" the current window in a ".trash" group. Since this group is hidden, you can't switch to it with gnext/gprev and it won't appear in vgroups and such (unless *list-hidden-groups* is set). You can show the content of the trash with "trash-show". The group is automatically removed when its last window is destroyed (and recreated on demand).

(defvar *trash-group* '()
  "Group containing the trashed windows")

(define-stumpwm-command "trash-window" ()
  "Put the current window in the trash group. If it doesn't exist,
create it"
  (unless (or (eq (current-group) *trash-group*)
	      (not (current-window)))
    (unless *trash-group*
      (setf *trash-group* (add-group (current-screen) ".trash")))
    (move-window-to-group (current-window) *trash-group*)))

(define-stumpwm-command "trash-show" ()
  "Switch to the trash group if it exists, call again to return to
the previous group"
  (if *trash-group*
      (if (eq (current-group) *trash-group*)
	  (switch-to-group (second (screen-groups (current-screen))))
	  (switch-to-group *trash-group*))
      (message "The trash is empty!")))

(defun clean-trash (w)
  "Called when a window is destroyed. If it was the last window of the
trash group, destroy it"
  (let ((current-group (window-group w)))  
    (when *trash-group*
      (when (and (eq current-group *trash-group*)
		 (not (group-windows current-group)))
	(if (eq (current-group) *trash-group*)
	    (let ((to-group (second (screen-groups (current-screen)))))
	      (switch-to-group to-group)
	      (kill-group *trash-group* to-group))
	    (kill-group *trash-group* (current-group)))
	(setf *trash-group* nil)
	(message "The trash is empty")))))

(add-hook *destroy-window-hook* #'clean-trash)

; sample bindings
(define-key *root-map* (kbd "_") "trash-window")
(define-key *root-map* (kbd "M-SPC") "trash-show")