Tutorial: how to control Sawfish from shell (script)



How can Sawfish be controlled from shell, or shell script on the fly?
Here comes sawfish-client.

Suppose, in window cycling, you like to show window names, but
you want to suppress it for a while. 

sawfish-1.6/OPTIONS say:
------------------------------------------------------------------------
;;  (define-special-variable cycle-show-window-names t
;;    "Display window names and icons while cycling through windows.")
------------------------------------------------------------------------

Ok, so this variable tells the behavior. Now call sawfish-client from
the shell:

------------------------------------------------------------------------
$ sawfish-client 
sawfish 1.6.2, Copyright (C) 1999-2000 John Harper
sawfish comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING

Enter `,help' to list commands.
user> (setq cyc
------------------------------------------------------------------------

It's long name, but you can use completion by TAB; it says
cycle-all-viewports      cycle-include-iconified  cycle-raise-windows
cycle-all-workspaces     cycle-keymap             cycle-show-window-names

------------------------------------------------------------------------
user> (setq cycle-show-window-names nil) ;; press enter
()  ;; it's the return value, the synonym for "nil", but you can forget it.
------------------------------------------------------------------------
If you press "C-d", or if your sawfish is >= 1.6, typing ",quit" brings
you back to the shell.

This was interactive, but you can push it into a shell script:
------------------------------------------------------------------------
#!/bin/sh

sawfish-client -e "(setq cycle-show-window-names nil)"
------------------------------------------------------------------------

Simple, eh?

Unfortunately, not all is so simple. For example, 
(setq focus-mode 'click)
does not work. In such cases, don't hesitate to ask at the mailing list.
(Right now I don't know what to do with focus-mode. ;)

Let me explain why. Have a look at sawfish-1.6/lisp/sawfish/wm/focus.jl:
------------------------------------------------------------------------
(defcustom focus-mode 'click
  "When does the mouse pointer affect the input focus."
  :type symbol
  :group focus
  :before-set (lambda () (focus-mode-changed 'before))
  :after-set (lambda () (focus-mode-changed 'after)))
------------------------------------------------------------------------
This defines the user option 'focus-mode'. If 'after-set' is there,
then you have to tell Sawfish that you've changed the variable's
value. 

That's all for today.

Regards,
Teika (Teika kazura)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]