| From myfriend@php.net Thu Nov 13 11:38:45 2003 |
| Return-Path: <myfriend@php.net> |
| Received: from localhost (receiver@localhost.localdomain [127.0.0.1]) |
| by kossu.home.receiverrethans.nl (8.12.9/8.12.9/Debian-5) with ESMTP id hADAYKok030169 |
| for <receiver@localhost>; Thu, 13 Nov 2003 11:38:45 +0100 |
| Received: from mail.jdimedia.nl [212.204.192.51] |
| by localhost with POP3 (fetchmail-6.2.4) |
| for receiver@localhost (single-drop); Thu, 13 Nov 2003 11:38:45 +0100 (CET) |
| Received: from php.net (pb2.pair.com [216.92.131.5]) |
| by jdi.jdimedia.nl (8.12.10/8.12.10) with SMTP id hA6HuAcR003687 |
| for <php@receiverrethans.nl>; Thu, 6 Nov 2003 18:56:11 +0100 |
| Received: (qmail 24340 invoked by alias); 6 Nov 2003 17:56:10 -0000 |
| Delivered-To: receiver@pair2.php.net |
| Received: (qmail 24317 invoked by alias); 6 Nov 2003 17:56:09 -0000 |
| Delivered-To: alias-scan-receiver@php.net |
| Delivered-To: receiver@php.net |
| Received: (qmail 24012 invoked from network); 6 Nov 2003 17:56:05 -0000 |
| Received: from unknown (HELO kirin.trondheim.example.no) (80.202.216.25) |
| by pb2.pair.com with SMTP; 6 Nov 2003 17:56:05 -0000 |
| Received: from localhost (kirin.trondheim.example.no [127.0.0.1]) |
| by kirin.trondheim.example.no (8.12.8/8.12.5) with ESMTP id hA6Hu4sK001537 |
| for <receiver@php.net>; Thu, 6 Nov 2003 18:56:05 +0100 |
| Subject: sawfish stuff |
| From: "Stig S. Bakken" <myfriend@php.net> |
| To: Derick Rethans <receiver@php.net> |
| Content-Type: multipart/mixed; boundary="=-2i2F/vg6h1WtQWmgdHTG" |
| Message-Id: <1068141364.1480.4.camel@kirin.trondheim.example.no> |
| Mime-Version: 1.0 |
| X-Mailer: Ximian Evolution 1.4.5 |
| Date: Thu, 06 Nov 2003 18:56:04 +0100 |
| X-Bogosity: No, tests=bogofilter, spamicity=0.414486, version=0.9.1.2 |
| Status: RO |
| X-Status: |
| X-Keywords: |
| X-UID: 12631 |
| |
| |
| --=-2i2F/vg6h1WtQWmgdHTG |
| Content-Type: text/plain |
| Content-Transfer-Encoding: 7bit |
| |
| Hi Derick, |
| |
| Enjoy :-) |
| |
| -- |
| "Nearly all men can stand adversity, but if you want to test a man's |
| character, give him power." - Abraham Lincoln |
| |
| --=-2i2F/vg6h1WtQWmgdHTG |
| Content-Disposition: attachment; filename=.sawfishrc |
| Content-Type: text/plain; name=.sawfishrc; charset=ISO-8859-1 |
| Content-Transfer-Encoding: 7bit |
| |
| ;; -*- lisp -*- |
| |
| (setq |
| move-snap-edges t |
| image-load-path (append '("~/.gnome/pixmaps") image-load-path) |
| load-path (append '("~/.sawfish") load-path) |
| ) |
| |
| (require 'gimme) |
| ;;(require 'sawfish-defaults) |
| |
| --=-2i2F/vg6h1WtQWmgdHTG |
| Content-Disposition: attachment; filename=gimme.jl |
| Content-Type: application/octet-stream; name=gimme.jl |
| Content-Transfer-Encoding: 8bit |
| |
| ;; gimme.jl -- fast window access keyboard accelerators -*- lisp -*- |
| ;; $Id: gimme.jl,v 1.1 2002/04/15 08:38:57 ssb Exp $ |
| ;; |
| ;; Copyright (C) 2000, 2001, 2002 Stig Sfther Bakken <myfriend@php.net> |
| ;; |
| ;; This file is not part of sawfish. |
| ;; |
| ;; Gimme is free software; you can redistribute it and/or modify it |
| ;; under the terms of the GNU General Public License as published by |
| ;; the Free Software Foundation; either version 2, or (at your option) |
| ;; any later version. |
| ;; |
| ;; gimme is distributed in the hope that it will be useful, but |
| ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| ;; GNU General Public License for more details. |
| ;; |
| ;; You should have received a copy of the GNU General Public License |
| ;; along with gimme; see the file COPYING. If not, write to |
| ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| ;; |
| |
| ;; How to use: |
| ;; |
| ;; 1. Save this file as ~/.sawfish/gimme.jl |
| ;; |
| ;; 2. Add the following to ~/.sawfishrc: |
| ;; (require 'gimme) |
| ;; |
| ;; 3. Customize your bindings to use some of the gimme functions, for |
| ;; example: |
| ;; |
| ;; M-S-e gimme-exact-class "Emacs" "emacs" |
| ;; |
| ;; When you hit meta+shift+e, sawfish will focus to the first found |
| ;; Emacs window, switching workspaces if necessary, or run "emacs" |
| ;; in the background if not found. |
| ;; |
| ;; Configure sawfish with the programs you use every day, disconnect |
| ;; your mouse and see how long you can do without it. |
| ;; |
| (provide 'gimme) |
| |
| |
| ;; customization options |
| |
| (defgroup gimme "Gimme" :group focus) |
| |
| (defcustom gimme-ignore-iconified-windows t |
| "Ignore windows that are iconified." |
| :group (focus gimme) |
| :type boolean) |
| |
| |
| ;; code |
| |
| (define (ssb-find-windows-by what query info-func match-func) |
| "Returns a list of windows whose class or name matches QUERY." |
| (filter (lambda (win) |
| (and |
| (or (not (window-get win 'iconified)) |
| (not gimme-ignore-iconified-windows)) |
| (match-func query (info-func win)))) |
| (managed-windows))) |
| |
| (define (ssb-select-window-by what name) |
| "Finds a single window based on name or class. If several matching |
| windows exist, a single one is selected: if the currently focused |
| window matches, the next window is selected (wrapping if necessary), |
| if not the first matching window is selected. WHAT can be one of |
| `class', `exact-class', `name' or `exact-name'." |
| (let* ((info-func |
| (if (or (eq what 'class) (eq what 'exact-class)) |
| (lambda (w) (aref (get-x-text-property w 'WM_CLASS) 1)) |
| window-name)) |
| (match-func |
| (if (or (eq what 'exact-class) (eq what 'exact-name)) |
| string= |
| string-match)) |
| (current (info-func (input-focus))) |
| (windows (ssb-find-windows-by 'what name info-func match-func)) |
| (loopwins windows)) |
| (catch 'selected |
| (when (null windows) |
| (throw 'selected nil)) |
| (when (string-match name current) |
| (while loopwins |
| (when (and (eq (car loopwins) (input-focus)) |
| (cdr loopwins)) |
| (throw 'selected (car (cdr loopwins)))) |
| (set 'loopwins (cdr loopwins)))) |
| (throw 'selected (car windows))))) |
| |
| (define (ssb-goto-window win) |
| (when (not (window-get win 'sticky)) |
| (select-workspace (nearest-workspace-with-window win current-workspace))) |
| (when (window-get win 'iconified) |
| (show-window win)) |
| ;; (when cycle-raise-windows |
| ;; (raise-window win)) |
| (raise-window win) |
| (warp-cursor-to-window win) |
| ;; (when cycle-warp-pointer |
| ;; (warp-cursor-to-window win)) |
| (when (window-get win 'shaded) |
| (unshade-window win)) |
| ;; (when (and cycle-focus-windows (window-really-wants-input-p win)) |
| ;; (set-input-focus win)) |
| (set-input-focus win) |
| ) |
| |
| (define (gimme what name #!optional command) |
| (let* |
| ((win (if (eq what 'window) |
| name (ssb-select-window-by what name)))) |
| (if win |
| (ssb-goto-window win) |
| (if command |
| (system (concat command " &")))))) |
| |
| (define (gimme-name name #!optional command) |
| "Focus on a window with NAME as part of its name/title, or start PROGRAM. |
| If focus is already on a matching window, cycle to the next" |
| (gimme 'name name command)) |
| |
| (define-command 'gimme-name gimme-name |
| #:spec "sWindow name:\nsCommand:" |
| #:type `(and (labelled ,(_ "Window name:") string) |
| (labelled ,(_ "Command:") string))) |
| |
| (define (gimme-class class #!optional command) |
| "Focus on a window with CLASS as part of its class, or start PROGRAM. |
| If focus is already on a matching window, cycle to the next" |
| (gimme 'class class command)) |
| |
| (define-command 'gimme-class gimme-class |
| #:spec "sWindow class:\nsCommand:" |
| #:type `(and (labelled ,(_ "Window class:") string) |
| (labelled ,(_ "Command:") string))) |
| |
| (define (gimme-exact-name name #!optional command) |
| "Focus on a window with NAME as its exact name/title, or start PROGRAM. |
| If focus is already on a matching window, cycle to the next" |
| (gimme 'exact-name name command)) |
| |
| (define-command 'gimme-exact-name gimme-exact-name |
| #:spec "sWindow name:\nsCommand:" |
| #:type `(and (labelled ,(_ "Window name:") string) |
| (labelled ,(_ "Command:") string))) |
| |
| (define (gimme-exact-class class #!optional command) |
| "Focus on a window with CLASS as its exact class, or start PROGRAM. |
| If focus is already on a matching window, cycle to the next" |
| (gimme 'class class command)) |
| |
| (define-command 'gimme-exact-class gimme-exact-class |
| #:spec "sWindow class:\nsCommand:" |
| #:type `(and (labelled ,(_ "Window class:") string) |
| (labelled ,(_ "Command:") string))) |
| |
| --=-2i2F/vg6h1WtQWmgdHTG-- |
| |