Index: ChangeLog =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/ChangeLog,v retrieving revision 1.8 diff -u -r1.8 ChangeLog --- ChangeLog 19 Sep 2003 00:15:05 -0000 1.8 +++ ChangeLog 21 Sep 2003 04:26:02 -0000 @@ -1,3 +1,19 @@ +2003-09-21 Ryan M. Golbeck + + * stumpwm.lisp (echo-window-list): Changed to use new echo-message + function. + +2003-09-20 Ryan M. Golbeck + + * stumpwm.lisp (echo-message): New function. For echoing + multi-line messages to the screen. + (*key-binding-alist*): Added binding to 'a' as a call to echo-date. + + * stumpwm-user.lisp (echo-date): New function. Bound to C-t a by + default. + (+month-names+): constant containing month names. + (+day-names+): constant containing day of the week names. + 2003-09-18 Shawn Betts * stumpwm-user.lisp (select-window): pass a prompt to Index: stumpwm-user.lisp =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/stumpwm-user.lisp,v retrieving revision 1.5 diff -u -r1.5 stumpwm-user.lisp --- stumpwm-user.lisp 19 Sep 2003 00:15:05 -0000 1.5 +++ stumpwm-user.lisp 21 Sep 2003 04:26:02 -0000 @@ -74,6 +74,22 @@ "Print a list of the windows to the screen." (echo-window-list screen (sort-windows screen))) +(defconstant +month-names+ + #("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")) + +(defconstant +day-names+ + #("Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")) + +(defun echo-date (screen) + "Print the output of the 'date' command to the screen." + (let ((date-string (multiple-value-bind (sec min hour dom mon year dow) + (get-decoded-time) + (format nil "~A ~A ~A ~A:~2,,,'address@hidden:~2,,,'address@hidden ~A" + (aref +day-names+ dow) + (aref +month-names+ (- mon 1)) + dom hour min sec year)))) + (echo-message screen (list date-string)))) + (defun select-window (screen) "Read input from the user and go to the selected window." (let ((query (read-one-line screen "Select: ")) Index: stumpwm.lisp =================================================================== RCS file: /cvsroot/stumpwm/stumpwm/stumpwm.lisp,v retrieving revision 1.9 diff -u -r1.9 stumpwm.lisp --- stumpwm.lisp 18 Sep 2003 22:11:29 -0000 1.9 +++ stumpwm.lisp 21 Sep 2003 04:26:05 -0000 @@ -97,6 +97,7 @@ (list (cons (char->keysym #\n) 'focus-next-window) (cons (char->keysym #\p) 'focus-prev-window) (cons (char->keysym #\w) 'echo-windows) + (cons (char->keysym #\a) 'echo-date) (cons (char->keysym #\k) 'delete-current-window) (cons (char->keysym #\b) 'banish-pointer) (cons (char->keysym #\') 'select-window) @@ -759,31 +760,35 @@ :function boole-xor))) (xlib:draw-rectangle win gcontext x y width height t))) -(defun echo-window-list (screen l) - "Print each window in l to the screen and highlight the current window." +(defun echo-message (screen message &optional format) + "Print each message in list message on its own line to the screen." (let* ((height (+ (xlib:font-descent (screen-font screen)) (xlib:font-ascent (screen-font screen)))) - (names (mapcar (lambda (w) - (funcall *window-format-fn* screen w)) l)) (gcontext (create-message-window-gcontext screen)) (message-win (screen-message-window screen))) - (setup-message-window screen names) - ;; Loop through each window and print its name. If we come across - ;; the current window, then highlight it. - (loop for win in l - for name in names - ;; We need this so we can track the row for each window - for i from 0 to (length l) + (setup-message-window screen message) + (loop for line in message + for i from 0 to (length message) do (xlib:draw-image-glyphs message-win gcontext *message-window-padding* (+ (* i height) (xlib:font-ascent (screen-font screen))) - name) - when (xlib:window-equal (screen-current-window screen) win) - do (invert-rect screen message-win - 0 (* i height) - (xlib:drawable-width message-win) - height)))) + line) + (if format + (funcall format line i height gcontext message-win))))) + +(defun echo-window-list (screen l) + "Print each window in l to the screen and highlight the current window." + (let* ((names (mapcar (lambda (w) + (funcall *window-format-fn* screen w)) l))) + (echo-message screen names + (lambda (line row height gcontext message-win) + (if (xlib:window-equal (screen-current-window screen) (nth row l)) + (invert-rect screen message-win + 0 (* row height) + (xlib:drawable-width message-win) + height)))))) + ;;; Pointer control