Sawfish
Advertisement


Scripts quick access edit this

An improved version of this script is already shipped with Sawfish, as sawfish.wm.commands.jump-or-exec. A further update is available, too. Look at Proposed Goals#Focus or exec script page.

  • Author: Damien Elmes <resolve@ichi2.net>
  • Version: 0.1
  • License: GNU GPL 2 or later
  • Download: jump-or-exec.jl

Synopsis[]

Focus a specific application, start it if it is not running, or perform custom actions if it's already focused.

Note that this script is now included in Sawfish as a command, but unfortunately the person who included it moved the third argument to the fourth, so if you want to use the example below you will need to add 'nil' as the third argument.

Description[]

Jump-or-exec can be used to blur the line between which applications are running and which need to be started. You can hit a key to launch the application or otherwise jump to it, if it is already running.

Installation[]

  1. Save jump-or-exec.jl in your load-path.
  2. Add this code to your ~/.sawfishrc:
    (require 'jump-or-exec)

Configuration[]

Here is a sample configuration:

;; load screen in a terminal
;; or switch to it if it's already running,
;; and load a new screen window (using custom c-q instead of c-a) if it's currently focused
(bind-keys global-keymap
           "W-o" `(jump-or-exec
                   ,(lambda ()
                      (get-window-by-class-re "URxvt"))
                   ,(lambda ()
                      (select-workspace 0)
                      (display-message "terminal loading...")
                      (system
                       "~/.bin/run/shell &"))
                   ,(lambda (wind)
                      (display-window wind)
                      (synthesize-event "C-q" wind)
                      (synthesize-event "c" wind))))
Advertisement