|Scripts quick access edit this|
Yet another focus-or-run script; this one uses cycle-commands.
The only reason to use this script over Jump-or-exec, Waffle or Gimme is that this takes advantage of the cycle-commands system to cycle between matching windows in case there are multiple matches. Otherwise it's much like the other scripts; with it you can bind a key to either jump to or run a particular application.
Just put the file in the appropriate place and:
define-cycle-command-pair or something equivalent to set up commands. I have something similar to these in my .sawfishrc:
(define-cycle-command-pair 'cycle-emacs 'cycle-emacs-backwards (app-selector (filter-byclass "Emacs") nil)) (define-cycle-command-pair 'cycle-buddy 'cycle-buddy-backwards (app-selector (filter-byclass "Pidgin") nil)) (define-cycle-command-pair 'cycle-shell 'cycle-shell-backwards (app-selector (filter-byclass "XTerm") "xterm")) (let ((gnus-re "^\\*((Group|Server|Agent Category|Gnus Browse Server|Gnus edit form|Article|mail)\\*$|Summary |(wide )?reply to)")) (define-cycle-command-pair 'cycle-gnus 'cycle-gnus-backwards (app-selector (filter-byname gnus-re) (lambda () (if (emacs-eval "(gnus-alive-p)" 'parse) (emacs-run "(switch-to-buffer gnus-group-buffer)" 'frame) (emacs-run "(gnus)" 'frame)))))) (bind-keys global-keymap "H-g" 'cycle-gnus "H-c" 'cycle-shell "H-t" 'cycle-emacs "H-b" 'cycle-buddy)
The first two are a degenerate case: they don't actually start the application in question, they only cycle through its instances. The third will start an xterm if no matching window is found. The last cycle pair is more complicated; it uses Emacs to have emacs display the appropriate buffer or run gnus.