773pages on
this wiki
Add New Page
Add New Page Talk0
Scripts quick access edit this

  • Author: Jeremy Hankins <nowan at nowan dot org>
  • License: GPL v2
  • Download: App.jl (upload)

Synopsis Edit

Yet another focus-or-run script; this one uses cycle-commands.

Description Edit

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.

Installation Edit

Just put the file in the appropriate place and:

(require 'app)

Configuration Edit

Use define-cycle-command-pair or something equivalent to set up commands. I have something similar to these in my .sawfishrc:

  'cycle-emacs 'cycle-emacs-backwards
  (app-selector (filter-byclass "Emacs") nil))
  'cycle-buddy 'cycle-buddy-backwards
  (app-selector (filter-byclass "Pidgin") nil))

  '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)"))
    '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)"
		      (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.

Also on Fandom

Random Wiki