[Sawfish] sawinlist : provides emacs functions for listing and manipulating x-windows managed by sawfish

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


I have created a tool which may be of interest to other sawfish users.
It is a small library of emacs functions for listing x-windows managed by sawfish in an emacs buffer and manipulating them.
In other words,  a kind of window-manager menu implemented in emacs.
I've attached the readme below.

If anyone is interested,  I can either send the package (send email to (omit underscore) john_lumby@xxxxxxxxxxx) or upload it somewhere.
I saw there is a web app on the wiki page for uploading sawfish scripts,  but this is an emacs library, not a sawfish script.
However I would guess it belongs more to sawfish than to emacs.
Is there some more generic upload capability on the wiki?    (And is this the right place to ask that?)

sawinlist readme:
-----------------

The idea is simple  -
   An emacs buffer containing a list of all the current desktop's windows,
   allowing some window-manager-like manipulation of those windows from the emacs buffer.
   For example,   right-click a window name to raise it.


The obvious question  -  why would I want this when sawfish provides a perfectly good menu?
   Because an emacs buffer provides facilities which make it an even better menu :
     .   can be permanently displayed if desired ("nailed-down") or iconified
     .   can be resized easily (since it is itself a window)
     .   can use cut'n'paste etc inside it  -  in fact,  can do any emacs'y thing inside it.

In this package:
----------------

sawinlist.el     the emacs functions that interface with sawfish  (using sawfish-client command)
sawlist.el       example of user's own load file to run in the emacs frame to initialise the sawinlist
sawinlist.readme this file

Installation and Operation:
--------------------------

  .   put sawinlist.el somewhere in your emacs load-path
  .   put sawlist.el anywhere that can be accessed (e.g. in your home)
  .   customize sawlist.el as desired (see instructions in example)
  .   verify that the sawfish-client command is available
          and works in your environment  -  try running this command:
          sawfish-client -e "(let ((winlist (managed-windows)) tcar tcdr (repout \"\`\") temp) (setq tcdr winlist) (while (setq tcar (car tcdr)) (setq tcdr (cdr tcdr)) (setq temp (prin1-to-string (window-name tcar))) (setq repout (concat repout (substring temp 1 (1- (length temp))) \"\`\"))) (princ repout))" | tr "\`" "\n"
          it should return a list of all windows managed by sawfish
          (sawinlist.el uses this command to build its list)
  .   start the emacs frame by running an emacs command such as
          emacs --geometry=26x64+6+6 --name=sawinlist --title=sawinlist -ms "#146a2b" -cr red -fn "6x13" -bg "#E0EDED" -fg "#751503" -q -load sawlist.el </dev/null &
      (where all the options except for the  -load sawlist.el  are optional and whatever you wish)
  .   if you used the example's key bindings,  then :
      .   right-clicking at the end of the buffer refreshes it
  ====>>>>>  N.B.  do this first if there are any emacs forms in the buffer -
                   nothing happens if the buffer content is not a valid list of window names!
      .   right-clicking on any window-name line raises it


Miscellaneous notes:
--------------------

  1.  window names are displayed one per line,   sorted alphabetically on their names;
      Exception to sort-sequence  -  any name ending in "- [- a-zA-Z0-9_.:]+" (dash, space, stuff)
      will have this suffix prepended as prefix to the sort key  (only for sorting purposes).
      This is in order to try to keep those windows from jumping around in the buffer,
      since in many cases,  especially web browsers,  the name changes frequently but the suffix remains constant,
      e.g. "sawfish - Google Search - Google Chrome"
  2.  any non-printable characters in range octal 000-037 (i.e. the ascii control characters)
      in a window name will appear as the sequence ^G[octal-sequence]
      (control-G followed by octal-read-syntax in square-brackets)
      note that this includes ^G itself and ^J (linefeed)
  3.  if a subset of windows all have the same name,  the suffix  ^G<windowid> is appended to disambiguate,
      where <windowid> is angle-bracket followed by sawfish's internal window id followed by angle-bracket.
      In this case,   there is a feature which may sometimes be useful -
      the ^G<windowid> suffix may be removed (by simply editing the name in the buffer)
      *before* right-clicking,  in which case sawinlist will select the most recently created with that name.
  4.  Bug/feature  -  the window list is refreshed only when you click in the sawinlist window,
      not continuously.  So sawinlist does not "notice" new/changed windows until after the next click.
      However,   if a window name changes and you then click on the (old) name,
      then provided there is no new window with the old name, sawinlist will still raise the correrct window,
      as it first tries to find the window by name,   and then if that fails, by window id, which remains unchanged.

 		 	   		  
---
--
Sawfish ML


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/