From 9c426f266eea5166df8f900d472cbfd5323af61a Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 20 Nov 2012 01:13:19 +0100 Subject: .sawfish/rc --- .sawfish/rc | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/.sawfish/rc b/.sawfish/rc index cae7880..8a6e9c5 100644 --- a/.sawfish/rc +++ b/.sawfish/rc @@ -5,6 +5,8 @@ (require 'sawfish.wm.ext.match-window) (require 'sawfish.wm.util.display-window) (require 'sawfish.wm.util.prompt) +(require 'sawfish.wm.util.window-order) +(require 'sawfish.wm.commands.x-cycle) (define oni:window-packing-keymap (make-keymap)) (define oni:window-growing-keymap (make-keymap)) @@ -43,17 +45,24 @@ way I like them." (define-command 'oni:place-emacs-windows oni:place-emacs-windows) -(defun oni:run-or-raise (command class) +(defun oni:run-or-raise (command #!key id name class role) "Either run COMMAND, or if a window with class CLASS is found, raise it." - (let ((w (get-window-by-class class))) - (if w - (display-window w) + (let* ((windows (filter + (lambda (x) + (and (or (not id) (equal (window-id x) id)) + (or (not name (equal (window-name x) name))) + (or (not class) (equal (window-class x) class)) + (or (not role) (equal (window-role x) role)))) + (window-order))) + (first (car windows)) + (w (if (equal first (input-focus)) (last windows) first))) + (if w (display-window w) (run-shell-command command)))) (setq default-frame-style 'naquadah) (setq prompt-color (cons (get-color "#eeeeec") - (get-color "#252e2b"))) + (get-color "#111113"))) (setq user-apps-menu '(("Emacs" (system "emacsclient -c &")) ("Terminal" (system "urxvt &")))) @@ -103,21 +112,25 @@ raise it." "w" oni:window-management-keymap) ;; (ungrab-keymap global-keymap) -(bind-keys global-keymap - "Super-!" '(run-shell-command (prompt-for-string "Run: ")) - "C-M-l" '(run-shell-command "i3lock -c \"#000000\"") - "Super-e" '(oni:run-or-raise (getenv "EDITOR") "Emacs") - "Super-E" '(run-shell-command (getenv "EDITOR")) - "Super-w" '(run-shell-command (getenv "BROWSER")) - "Super-c" '(run-shell-command "urxvt") - "Super-TAB" 'cycle-windows - "Super-x" oni:extended-keymap - "Super-f" 'pack-window-right - "Super-b" 'pack-window-left - "Super-n" 'pack-window-down - "Super-p" 'pack-window-up - "Menu" 'popup-root-menu - "Super-M" 'maximize-window-toggle) +(bind-keys + global-keymap + "Super-!" '(run-shell-command (prompt-for-string "Run: ")) + "C-M-l" '(run-shell-command "i3lock -c \"#000000\"") + "Super-e" '(oni:run-or-raise (getenv "EDITOR") #:class "Emacs") + "Super-E" '(run-shell-command (getenv "EDITOR")) + "Super-w" '(oni:run-or-raise (getenv "BROWSER") #:class "Conkeror") + "Super-W" '(run-shell-command (getenv "BROWSER")) + "Super-c" '(oni:run-or-raise "urxvt" #:class "URxvt") + "Super-C" '(run-shell-command "urxvt") + "Super-TAB" 'cycle-windows + "C-Super-TAB" 'cycle-class + "Super-x" oni:extended-keymap + "Super-f" 'pack-window-right + "Super-b" 'pack-window-left + "Super-n" 'pack-window-down + "Super-p" 'pack-window-up + "Menu" 'popup-root-menu + "Super-M" 'maximize-window-toggle) ;; (grab-keymap global-keymap) (add-window-matcher '((WM_CLASS . "^Firefox/Navigator$")) -- cgit v1.2.3-54-g00ecf