Sawfish
No edit summary
(→‎Sawfish Programming Tutorial: Removed a broken link)
Tags: Visual edit apiedit
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Programming}}
+
{{Documentation}}
 
__TOC__
 
__TOC__
   
This page contains advanced Sawfish documentation. It covers everything that has to do with the build-in Lisp environment, from customizing Sawfish to your needs, extending its capabilities to creating your own themes.
+
This page contains advanced Sawfish documentation. It covers everything that has to do with the built-in Lisp environment, from customizing Sawfish to your needs, extending its capabilities to creating your own themes.
   
 
== Programming Sawfish ==
 
== Programming Sawfish ==
Line 8: Line 8:
 
This part should contain a sort of tutorial on programming in librep/Sawfish (language and API).
 
This part should contain a sort of tutorial on programming in librep/Sawfish (language and API).
   
In order to understand this is needed a good familiarity with the Lisp programming language. If you've never programmed in lisp, a good starting point to learn it is to read the Emacs tutorial elisp-intro, start to use and configure Emacs, eventually read the marvelous "On lisp" of Paul Graham. Programs and documents are payment-free and easily reachable on the net (Emacs and elisp-intro are free-software).
 
   
  +
What sets Sawfish apart from other window managers is the program's extensibility. The window manager functions in Sawfish are implemented in librep which can easily be extended or redefined by writing librep code. The [http://sawfish.wikia.com/wiki/Scripts scripts section] provides examples of sawfish extensions written by various contributors.
Sawfish is based on librep, so in order to understand Sawfish programming it's required to understand librep (and Lisp).
 
   
  +
As Sawfish uses a lisp-based scripting language called librep, a basic knowledge of lisp is required in order to write extensions for the window manager. If you are not familiar with lisp, [http://lib.store.yahoo.net/lib/paulgraham/acl2.txt chapter 2] of Paul Graham's book ANSI Common Lisp provides a good introduction. Another excellent resource is Peter Seibel's [http://www.gigamonkeys.com/book/ Practical Common Lisp], fully available on his web page or in dead-tree form. A good way to learn librep is to run rep or sawfish-client on your terminal (gnome-terminal, xterm etc) and try the examples in that chapter. As you work through the text you will find that most of the examples work but some do not (your terminal beeps instead of getting the right output). This is because librep is not exactly a Common Lisp implementation. Some functions in Common Lisp are implemented differently in librep or not implemented at all. The [http://librep.sourceforge.net/librep-manual.html librep manual] provides a guide to the librep lisp implementation and documentation on the builtin functions. The [http://www.blarg.net/~sand/sawfish/ Sawfish programming manual] provides documentation on high level window manager functions.
The main reason of the superiority of Sawfish respect to other WM is its scriptability. librep is a true language, designed from start to be a complete language: the eventual prolixness while performing simple things is the price you have to pay for its power (and moreover it's Lisp: you're free to define new syntaxes to simplify your expression). On the other hand this power lets you to be very concise while performing complex things and lets you extend the core language (impossible with an ad-hoc language).
 
 
Every library in librep can be used in Sawfish, since the interpreter is the same.
 
 
'''Reference'''
 
 
* [http://mitpress.mit.edu/sicp/ Structure and Interpretation of Computer Programs] Excellent intro to programming done in Scheme (a Lisp dialect)
 
* Paul Graham's [http://www.paulgraham.com/onlisp.html On Lisp]
 
   
 
== Sawfish Emacs mode ==
 
== Sawfish Emacs mode ==
Line 31: Line 23:
 
The original version is available from http://sawmill.sourceforge.net/prog-manual.html.
 
The original version is available from http://sawmill.sourceforge.net/prog-manual.html.
   
Derek Upham has updated the Sawfish Programming Manual to reflect the <tt>DEFUNs</tt> and <tt>DEFVARs</tt> implemented in C, and some of the most common Lisp functions in Sawfish 1.3. You can take a look at the HTML, or download it in Info or <tt>TeXinfo</tt>, or get a patch file against the original source at http://www.blarg.net/~sand/sawfish/.
+
Derek Upham has updated the Sawfish Programming Manual to reflect the <tt>DEFUNs</tt> and <tt>DEFVARs</tt> implemented in C, and some of the most common Lisp functions in Sawfish 1.3. You can take a look at the HTML, or download it in Info or <tt>TeXinfo</tt>, or get a patch file against the original source at http://www.blarg.net/~sand/sawfish/.[[Category:Documentation]]
 
=== Sawfish Programming Tutorial ===
 
 
Eric Mangold provides us with a nice tutorial for customizing Sawfish -- for newbies and advanced users alike! http://twistedmatrix.com/~teratorn/better_wm/better_wm.html
 

Latest revision as of 03:23, 24 August 2016

Documentation quick access

This page contains advanced Sawfish documentation. It covers everything that has to do with the built-in Lisp environment, from customizing Sawfish to your needs, extending its capabilities to creating your own themes.

Programming Sawfish[]

This part should contain a sort of tutorial on programming in librep/Sawfish (language and API).


What sets Sawfish apart from other window managers is the program's extensibility. The window manager functions in Sawfish are implemented in librep which can easily be extended or redefined by writing librep code. The scripts section provides examples of sawfish extensions written by various contributors.

As Sawfish uses a lisp-based scripting language called librep, a basic knowledge of lisp is required in order to write extensions for the window manager. If you are not familiar with lisp, chapter 2 of Paul Graham's book ANSI Common Lisp provides a good introduction. Another excellent resource is Peter Seibel's Practical Common Lisp, fully available on his web page or in dead-tree form. A good way to learn librep is to run rep or sawfish-client on your terminal (gnome-terminal, xterm etc) and try the examples in that chapter. As you work through the text you will find that most of the examples work but some do not (your terminal beeps instead of getting the right output). This is because librep is not exactly a Common Lisp implementation. Some functions in Common Lisp are implemented differently in librep or not implemented at all. The librep manual provides a guide to the librep lisp implementation and documentation on the builtin functions. The Sawfish programming manual provides documentation on high level window manager functions.

Sawfish Emacs mode[]

How to install, use and configure the Sawfish Emacs mode.

External documentation[]

Sawfish Programming Manual[]

The original version is available from http://sawmill.sourceforge.net/prog-manual.html.

Derek Upham has updated the Sawfish Programming Manual to reflect the DEFUNs and DEFVARs implemented in C, and some of the most common Lisp functions in Sawfish 1.3. You can take a look at the HTML, or download it in Info or TeXinfo, or get a patch file against the original source at http://www.blarg.net/~sand/sawfish/.