[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [STUMP] [PATCH] Using window properties to store window placement.
From: |
Shawn |
Subject: |
Re: [STUMP] [PATCH] Using window properties to store window placement. |
Date: |
Sun, 31 Aug 2008 15:44:13 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Michael Raskin <address@hidden> writes:
> Hello
> That patch adds commands that allow to mark windows via dedicated
> properties and later place them in the same groups/frames they occupied
> earlier using that information. The best part is that you do not need to
> have continuous history of running StumpWM: it can be used across
> StumpWM reload if you need to do it the hard way (with killing StumpWM)
> or you can save needed layout and not fear a possible crash. You could
> dump frame layout earlier, this patch allows you to preserve windows.
> The patch is split in two, as the first small part (functions for
> window properties that are meant to hold strings) seems useful per se.
I thought stumpwm already did this using the netwm desktop property
and the x,y location of the windows. You have found this not to be so?
I made some pedantic comments below:
> +(defun window-string-property (window prop)
> + "Get window property and convert it to string"
> + (apply #'concatenate
> + (cons 'string
> + (mapcar 'string
> + (mapcar 'character
> + (window-property window prop))))))
This could be written this way:
(apply #'concatenate 'string
(mapcar 'string
(mapcar 'character
(window-property window prop))))
Except it could be better written this way:
(map 'string 'character (window-property window prop))
Though you might prefer:
(xlib:get-property (window-xwin window) prop :type :string :result-type 'string
:transform #'xlib:card8->char)
> +(defun set-window-string-property (window prop value)
> + "Set window property to value specified by a string"
> + (xlib:change-property (window-xwin window) prop value :string 8 :transform
> 'char-code))
This would be better written as a setf function:
(defun (setf window-string-property) (value window prop) ...)
and used this way:
(setf (window-string-property window prop) value)
> +(defun all-groups ()
> + "List all the known groups on all screens"
> + (apply #'concatenate (cons 'list
> + (mapcar #'screen-groups *screen-list*))))
This looks a little nicer:
(apply 'append (mapcar #'screen-groups *screen-list*))
> +(defcommand all-placement-to-properties () ()
> + "Save all window placement data to properties"
> + (mapcar #'placement-to-properties (all-windows)))
you should use mapc, which doesn't accumulate the return values.
-Shawn