Scripts quick access edit this |
- Author: Mihai Bazon
- Version: 0.1
- License: LGPL
- Download: Restore-focus.jl (upload)
Synopsis[]
Restore focus to last "interesting" window when switching to an workspace.
Description[]
This script solves a minor annoyance that I'm having for ages; I'm no Lisp hacker, but I finally decided to fix it.
In my setup, I'm using Sawfish as a WM for Gnome (so I'm using Gnome panels, Nautilus for desktop, Gnome's workspace switcher, etc.). The problem was that every time I switch an workspace with the mouse (click in the workspace switcher), the panel window gets focused and Sawfish remembers that the last window in the workspace that I'm leaving is Gnome Panel. When I later return to that workspace, instead of focusing some window, it focuses the Gnome Panel.
This script installs some hooks that will maintain focus on interesting windows (i.e. the last window used which is not Panel or Desktop).
In order to solve this problem previously, I had some rules in "matched windows" that forbidden focus at all on Panel or Desktop windows, but that was bad too because I couldn't, for example, rename a file on my Desktop by just clicking on it and hitting F2 (since the Desktop never would receive focus).
Installation[]
Save it in ~/.sawfish/lisp/ and add (require 'restore-focus) in your ~/.sawfishrc
Configuration[]
You can edit the script and change the definition of *avoid-focus* regexp.