Scripts quick access edit this

Synopsis[edit | edit source]

A simple API for multiple (i.e. extension-specific), configurable message windows.

Description[edit | edit source]

This wraps both the built-in DISPLAY-MESSAGE function and separate, configurable message windows. This is mostly useful for people writing extensions who want to display messages. Window-mode is one of these.

Simple usage, much like DISPLAY-MESSAGE:

;; Display a message window that doesn't go away
(message-window-display "Message")

This will display "Message" in the "global" message window, exactly like DISPLAY-MESSAGE. This is not very interesting, because you can already do that. However, if you wish to display a timed message like this, you might want to use it:

;; Display message for 300ms. Also supports #:sec.
(message-window-display "Message" #:ms 300)

However, the problem is this gets overwritten by anything else doing the same thing. Thus the real purpose of this extension:

;; Make a custom message window that's green at (5 . 5)
(defvar *my-message-window* (make-message-window #:x 5 #:y 5 #:bg "Green"))

;; Display custom message window for 300ms
(message-window-display "FOO!" #:win *my-message-window* #:ms 300)

This will display a message in a separate window you control. See Dictionary for all the options.

Installation[edit | edit source]

Simply put this where your lisp goes (e.g., ~/.sawfish/lisp). Any scripts that use it should do the following:

(require 'messages)

Dictionary[edit | edit source]

  • make-message-window #!key msg x y w h border-width border-color fg bg
    Create a new, unmapped message window with these attributes. All have defaults, nothing is required, but you may want to position the window.
  • message-window-destroy MSGWIN
    Destroy MSGWIN. You should not use the object again after calling this.
  • message-window-show MSGWIN
    Show MSGWIN. Normally you don't need to call this yourself; rather use MESSAGE-WINDOW-DISPLAY.
  • message-window-hide MSGWIN
    Hide MSGWIN. You do not need to call this if you use MESSAGE-WINDOW-DISPLAY with a timer, but it is necessary if you want to hide an indefinite message window.
  • message-window-config MSGWIN #!key x y w h fg bg margin border-width border-color attrs
    Reconfigure MSGWIN. Note this does not force a redraw, though some parameters like W and H may cause it; you must use MESSAGE-WINDOW-DRAW. This will reconfigure MSGWIN. Note that fg and attrs specify the attributes for the GC used when drawing text; if you specify either it will override all prior attributes.
  • message-window-draw MSGWIN
    Redraw the contents of MSGWIN. This will have no effect if the window is not mapped.
  • message-window-display STRING #!key win sec ms
    Display a message. If no window is specified, the "global" message window will be used via DISPLAY-MESSAGE. Otherwise, the message window specified will be mapped and redrawn with current attributes and message. If sec or ms are nonzero, a timer will hide the window after the specified time.
Community content is available under CC-BY-SA unless otherwise noted.