From bef56b65d49feaa148f3cbc4e1add6dd7a1c9220 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 19 Nov 2012 23:23:22 +0100 Subject: .sawfish/rc --- .sawfish/rc | 129 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 68 insertions(+), 61 deletions(-) (limited to '.sawfish') diff --git a/.sawfish/rc b/.sawfish/rc index 23fd5e6..cae7880 100644 --- a/.sawfish/rc +++ b/.sawfish/rc @@ -1,47 +1,94 @@ +;; -*- mode: sawfish; -*- +(require 'rep.regexp) +(require 'sawfish.wm.commands.grow-pack) +(require 'sawfish.wm.commands.shrink-yank) +(require 'sawfish.wm.ext.match-window) +(require 'sawfish.wm.util.display-window) +(require 'sawfish.wm.util.prompt) + +(define oni:window-packing-keymap (make-keymap)) +(define oni:window-growing-keymap (make-keymap)) +(define oni:window-shrinking-keymap (make-keymap)) +(define oni:window-yanking-keymap (make-keymap)) +(define oni:window-management-keymap (make-keymap)) +(define oni:extended-keymap (make-keymap)) + +(defun oni:emacs-main-window-p (window) + "Check wether or not WINDOW is Emacs' main window." + (let ((name (window-name window))) + (and (string-match "^emacs: " name) + (not (string= "emacs: *Sauron*" name))))) + +(defun oni:place-emacs-windows () + "Place Emacs' main, sauron and optionally speedbar windows the +way I like them." + (let ((main-window (car (filter-windows oni:emacs-main-window-p))) + (sauron-window (get-window-by-name "emacs: *Sauron*")) + (speedbar-window (get-window-by-name "^Speedbar " #:regex t))) + (move-window-to main-window 0 0) + (move-window-to sauron-window 0 0) + + (set-window-type sauron-window 'transient) + (pack-window-down sauron-window) + (grow-window-right sauron-window) + + (when speedbar-window + (move-window-to speedbar-window 0 0) + (set-window-type speedbar-window 'transient) + (yank-window-right main-window) + (grow-window-down speedbar-window)) + + (grow-window-down main-window) + (grow-window-right main-window))) + +(define-command 'oni:place-emacs-windows oni:place-emacs-windows) + +(defun oni:run-or-raise (command class) + "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) + (run-shell-command command)))) + +(setq default-frame-style 'naquadah) +(setq prompt-color (cons (get-color "#eeeeec") + (get-color "#252e2b"))) (setq user-apps-menu '(("Emacs" (system "emacsclient -c &")) ("Terminal" (system "urxvt &")))) -(define oni:window-packing-keymap (make-keymap)) - (bind-keys oni:window-packing-keymap "p" 'pack-window-up "n" 'pack-window-down "b" 'pack-window-left "f" 'pack-window-right) -(define oni:window-growing-keymap (make-keymap)) - (bind-keys oni:window-growing-keymap "p" 'grow-window-up "n" 'grow-window-down "b" 'grow-window-left "f" 'grow-window-right) -(define oni:window-shrinking-keymap (make-keymap)) - (bind-keys oni:window-shrinking-keymap "p" 'shrink-window-up "n" 'shrink-window-down "b" 'shrink-window-left "f" 'shrink-window-right) -(define oni:window-yanking-keymap (make-keymap)) - (bind-keys oni:window-yanking-keymap "p" 'yank-window-up "n" 'yank-window-down "b" 'yank-window-left "f" 'yank-window-right) -(define oni:window-management-keymap (make-keymap)) - (bind-keys oni:window-management-keymap "M" 'maximize-window-toggle "p" oni:window-packing-keymap "g" oni:window-growing-keymap "s" oni:window-shrinking-keymap - "y" oni:window-yanking-keymap) + "y" oni:window-yanking-keymap + "E" 'oni:place-emacs-windows) (bind-keys global-keymap "XF86AudioPlay" '(run-shell-command "mpc toggle") @@ -52,10 +99,6 @@ "XF86AudioPrev" '(run-shell-command "mpc prev") "XF86AudioNext" '(run-shell-command "mpc next")) -(require 'sawfish.wm.util.prompt) - -(define oni:extended-keymap (make-keymap)) - (bind-keys oni:extended-keymap "w" oni:window-management-keymap) @@ -63,57 +106,21 @@ (bind-keys global-keymap "Super-!" '(run-shell-command (prompt-for-string "Run: ")) "C-M-l" '(run-shell-command "i3lock -c \"#000000\"") - "Super-e" '(run-shell-command (getenv "EDITOR")) + "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 - "Menu" 'popup-root-menu) + "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) -(setq prompt-color (cons (get-color "#eeeeec") - (get-color "#252e2b"))) - -(setq default-frame-style 'naquadah) - -(require 'sawfish.wm.ext.match-window) - (add-window-matcher '((WM_CLASS . "^Firefox/Navigator$")) '((position . north-east))) - -(require 'rep.regexp) -(require 'sawfish.wm.commands.grow-pack) -(require 'sawfish.wm.commands.shrink-yank) - -(defun oni:emacs-main-window-p (window) - "Check wether or not WINDOW is Emacs' main window." - (let ((name (window-name window))) - (and (string-match "^emacs: " name) - (not (string= "emacs: *Sauron*" name))))) - -(defun oni:place-emacs-windows () - "Place Emacs' main, sauron and optionally speedbar windows the -way I like them." - (let ((main-window (car (filter-windows oni:emacs-main-window-p))) - (sauron-window (get-window-by-name "emacs: *Sauron*")) - (speedbar-window (get-window-by-name "^Speedbar " #:regex t))) - (move-window-to main-window 0 0) - (move-window-to sauron-window 0 0) - - (set-window-type sauron-window 'transient) - (pack-window-down sauron-window) - (grow-window-right sauron-window) - - (when speedbar-window - (move-window-to speedbar-window 0 0) - (set-window-type speedbar-window 'transient) - (yank-window-right main-window) - (grow-window-down speedbar-window)) - - (grow-window-down main-window) - (grow-window-right main-window))) - -(define-command 'oni:place-emacs-windows oni:place-emacs-windows) - -(bind-keys oni:window-management-keymap - "E" 'oni:place-emacs-windows) +(add-window-matcher '((WM_CLASS . "^Conkeror/Navigator$")) + '((position . north-east))) -- cgit v1.2.3-54-g00ecf 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(-) (limited to '.sawfish') 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 From a5d05d17534e315524cdb5221428d9b01cbc95e6 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 20 Nov 2012 02:12:42 +0100 Subject: .sawfish/rc --- .sawfish/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.sawfish') diff --git a/.sawfish/rc b/.sawfish/rc index 8a6e9c5..700c1de 100644 --- a/.sawfish/rc +++ b/.sawfish/rc @@ -58,7 +58,7 @@ raise it." (first (car windows)) (w (if (equal first (input-focus)) (last windows) first))) (if w (display-window w) - (run-shell-command command)))) + (call-command `(run-shell-command ,command))))) (setq default-frame-style 'naquadah) (setq prompt-color (cons (get-color "#eeeeec") -- cgit v1.2.3-54-g00ecf From c545bedf7fa756531b0c486845a6f9af36a83eb2 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 20 Nov 2012 18:54:03 +0100 Subject: .sawfish/rc --- .sawfish/rc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '.sawfish') diff --git a/.sawfish/rc b/.sawfish/rc index 700c1de..684ce1d 100644 --- a/.sawfish/rc +++ b/.sawfish/rc @@ -109,7 +109,8 @@ raise it." "XF86AudioNext" '(run-shell-command "mpc next")) (bind-keys oni:extended-keymap - "w" oni:window-management-keymap) + "w" oni:window-management-keymap + "Super-b" 'popup-window-list-menu) ;; (ungrab-keymap global-keymap) (bind-keys @@ -133,7 +134,6 @@ raise it." "Super-M" 'maximize-window-toggle) ;; (grab-keymap global-keymap) -(add-window-matcher '((WM_CLASS . "^Firefox/Navigator$")) - '((position . north-east))) -(add-window-matcher '((WM_CLASS . "^Conkeror/Navigator$")) - '((position . north-east))) +(add-window-matcher '((WM_CLASS . "^(Firefox|Conkeror)/Navigator$")) + '((position . north-east) + (maximized . all))) -- cgit v1.2.3-54-g00ecf