User's Guide * Forum, News & Bugs


Ready Logo Ready Linux  

Operating System Version 0.2




Chapter III - Customising the Sawfish Window Manager

Sawfish is a lisp-extensible window manager for X11. Its aim is to allow all areas of window management (decoration, manipulation) to be customised as far as is possible, yet still remain as fast or faster than existing window managers.

Key and Mouse Bindings

Whenever you interact with Sawfish in one way or another it usually involves some kind of binding: Whether it's dragging a window across the screen with your mouse, switching workspaces or closing a window via a combination of keys. All of this follows the same general scheme: You, the user, perform some kind of action – clicking, moving the mouse, pressing a key – to which Sawfish responds in a particular (and hopefully desired) fashion. This association between user performed inputs and Sawfish behavior is called binding.

Most window managers today provide a way to customise bindings. While it's usually possible to bind keys to launch applications and perform simple and common operations like minimizing a window, mouse events are often predefined and can't be changed at all. Sawfish on the other hand allows for full customization of bindings. Even if you don't notice it, every reaction to your inputs is specified by a binding and can be altered.

But bindings in Sawfish are specified by more than just a user input. You obviously don't want one action to have the same effect in every situation. Clicking on a window title should have a different effect than clicking on the root window. That's why you can define contexts for your bindings. Depending on the context, your actions have different outcomes. Clicking on the title of a window might raise it, while clicking on the window itself could raise and focus it. And clicking on the root window would pop up the application menu.

To customise your mouse and key bindings, launch the Sawfish Configurator and switch to the "Bindings" tab.

Sawfish Bindings

Customise by the Configurator or by Lisp

There are two ways to configure, by the configurator GUI and by preparing lisp code. The GUI can be run by left clicking background -> “Customise”. Most customisations similar to other window managers can be done through GUI.

For customisations by lisp, first understand that in the startup, files ~/.sawfish/custom, .rc are read in this order.

~/.sawfish/custom

This file is created and edited by the configurator GUI, and stores customisations. It shouldn’t really be edited manually.

~/.sawfish/rc

This is the file you edit. It is a handwritten lisp code, and almost all explicit customisations should be done here.

This is an example of an rc file, it has extra window movements over and above those that come as standard with Ready Linux. It has window commands which are specific to a particular monitor resolution, 1366 x 768.


;; -*- lisp -*-
;; Ready Linux 2018
;; No copyright to anything

(require 'sawfish-defaults)

(defun ak-left-fill-window ()
(resize-window-to (input-focus) (/ (screen-width) 2) (screen-height))
(move-window-to (input-focus) 0 0)
)

(defun ak-right-fill-window ()
(resize-window-to (input-focus) (/ (screen-width) 2) (screen-height))
(move-window-to (input-focus) (/ (screen-width) 2) 0)
)

(defun ak-up-left-fill-window ()
(resize-window-to (input-focus) (/ (screen-width) 2) (/ (screen-height) 2))
(move-window-to (input-focus) 0 0)
)

(defun ak-up-right-fill-window ()
(resize-window-to (input-focus) (/ (screen-width) 2) (/ (screen-height) 2))
(move-window-to (input-focus) (/ (screen-width) 2) 0)
)

(defun ak-up-fill-window ()
(resize-window-to (input-focus) (/ (screen-width) 1) (/ (screen-height) 2))
(move-window-to (input-focus) 0 0)
)

(defun ak-down-fill-left-window ()
(resize-window-to (input-focus) (/ (screen-width) 2) (/ (screen-height) 2))
(move-window-to (input-focus) 0 384)
)

(defun ak-down-fill-right-window ()
(resize-window-to (input-focus) (/ (screen-width) 2) (/ (screen-height) 2))
(move-window-to (input-focus) 683 384 (/ (screen-width) 2) 0)
)

(defun ak-down-fill-window ()
(resize-window-to (input-focus) (/ (screen-width) 1) (/ (screen-height) 2))
(move-window-to (input-focus) 0 384)
)

(bind-keys global-keymap "Super-Left" ak-left-fill-window)
(bind-keys global-keymap "Super-Right" ak-right-fill-window)
(bind-keys global-keymap "Super-o" ak-up-left-fill-window)
(bind-keys global-keymap "Super-p" ak-up-right-fill-window)
(bind-keys global-keymap "Super-Up" ak-up-fill-window)
(bind-keys global-keymap "Super-k" ak-down-fill-left-window)
(bind-keys global-keymap "Super-l" ak-down-fill-right-window)
(bind-keys global-keymap "Super-Down" ak-down-fill-window)


You can also put other lisp scripts, like user-contributed codes in the directory ~/.sawfish..

You can start an application in Sawfish from a key. Bind a key to the ‘run-shell-command’ command. In the configurator, you can enter the command name at the same time. From lisp the function system invokes a shell. Don’t forget to add “&” not to block the Sawfish execution.

(system "firefox doodle.com &")

You can add any program to startup automatically by adding it to the file

~/.sawfish/autostart

This is the current autostart file:

!/bin/sh

conky &
feh --bg-scale '/usr/share/wallpaper/c64_wall.png' &
lxterminal &
xscreensaver -no-splash &




Next - Installing and Removing Software -->





no copyright to anything ** contact mscgbr@gmail.com or @MarkStuCarter