(require 'gnome) (require 'gnome-menu) (bind-keys global-keymap "M-F1" '(select-workspace 0)) (bind-keys global-keymap "M-F2" '(select-workspace 1)) (bind-keys global-keymap "M-F3" '(select-workspace 2)) (bind-keys global-keymap "M-F4" '(select-workspace 3)) (bind-keys global-keymap "M-F5" '(select-workspace 4)) (bind-keys global-keymap "M-F6" '(select-workspace 5)) (unbind-keys global-keymap "C-Right") (unbind-keys global-keymap "C-Left") (bind-keys global-keymap "S-M-Down" '(if (< current-workspace (/ preallocated-workspaces 2)) (select-workspace (+ current-workspace (/ preallocated-workspaces 2))))) (bind-keys global-keymap "S-M-Up" '(if (> current-workspace (- (/ preallocated-workspaces 2) 1)) (select-workspace (- current-workspace (/ preallocated-workspaces 2))))) (bind-keys global-keymap "S-M-Left" '(if (and (> current-workspace 0) (not (eq current-workspace (/ preallocated-workspaces 2)))) (select-workspace (- current-workspace 1)))) (bind-keys global-keymap "S-M-Right" '(if (and (< current-workspace (- preallocated-workspaces 1)) (not (eq current-workspace (- (/ preallocated-workspaces 2) 1)))) (select-workspace (+ current-workspace 1)))) (defun jrb-recognize-wm-classes (w) (let ((class (get-x-text-property w 'WM_CLASS))) (when (and class (>= (length class) 2) (string= (aref class 1) "GnomeTerminal")) (window-put w 'type 'unframed)))) (add-hook 'before-add-window-hook 'jrb-recognize-wm-classes) (custom-set-keymap (quote border-keymap) (quote (keymap (resize-window-interactively . "Button1-Move") (move-window-interactively . "Button3-Move") (raise-lower-window . "Button3-Off")))) (custom-set-keymap (quote menu-button-keymap) (quote (keymap (popup-window-menu . "Button1-Click1") (popup-window-menu . "Button3-Click1")))) (custom-set-keymap (quote title-keymap) (quote (keymap (toggle-window-shaded . "Button1-Click2") (toggle-window-shaded . "Button2-Click2") (move-window-interactively . "Button1-Move") (move-window-interactively . "Button2-Move") (raise-window . "Button1-Off") (raise-lower-window . "Button2-Off") (popup-window-menu . "Button3-M-Click")))) (custom-set-keymap (quote root-window-keymap) (quote (keymap (nop . "Button2-Off") (popup-root-menu . "Button2-Click1")))) (custom-set-keymap (quote window-keymap) (quote (keymap (popup-window-menu . "Button3-M-Click1") (move-window-interactively . "Button1-M-Click1") (resize-window-interactively . "Button2-M-Click1") (toggle-window-shaded . "Button1-M-Click2")))) (custom-set-keymap (quote window-keymap) (quote (keymap (send-to-workspace:1 . "S-M-F1") (send-to-workspace:2 . "S-M-F2") (send-to-workspace:3 . "S-M-F3") (send-to-workspace:4 . "S-M-F4") (send-to-workspace:5 . "S-M-F5") (send-to-workspace:6 . "S-M-F6") (popup-window-menu . "Button3-M-Click1") (move-window-interactively . "Button1-M-Click1") (resize-window-interactively . "Button2-M-Click1") (toggle-window-shaded . "Button1-M-Click2")))) ; Iconify all windows (defvar *iconified-windows* nil) (defun iconify-all () "" (interactive) (setq *iconified-windows* nil) (let* ((wins (stacking-order)) (len (length wins)) (i 0)) (while (< i len) (let ((w (nth i wins))) (cond ((and (eq current-workspace (window-get w 'workspace)) (not (window-get w 'iconified))) (setq *iconified-windows* (cons w *iconified-windows*)) (iconify-window w)))) (setq i (+ i 1))))) (defun uniconify-windows (wins) (cond ((not (null wins)) (uniconify-window (car wins)) (uniconify-windows (cdr wins))))) (defun uniconify-all () "" (interactive) (uniconify-windows *iconified-windows*)) (bind-keys global-keymap "F9" 'iconify-all) (bind-keys global-keymap "F10" 'uniconify-all) ;; ; (defvar jrb-workspace-timer nil) ; (defconst jrb-workspace-timer-time 1) ; (defun jrb-workspace-hook (current-workspace) ; (when jrb-workspace-timer ; (delete-timer jrb-workspace-timer) ; (setq jrb-workspace-timer nil)) ; (show-message (format nil "Workspace %d" current-workspace)) ; (setq jrb-workspace-timer (make-timer 'jrb-workspace-timer-callback ; jrb-workspace-timer-time )) ; ) ; (defun jrb-workspace-timer-callback () ; (show-message nil) ; (delete-timer jrb-workspace-timer) ; (setq jrb-workspace-timer nil) ; ) ; (add-hook 'enter-workspace-hook 'jrb-workspace-hook) ;;;; Make sawmill remember the currently focused window when exiting a ;;;; workspace and then refocus it when re-entering that workspace. ;;;; ;;;; Copyright (C) 1999 Kevin Sivits ;;;; There is no warranty and no restriction on redistribution. ;;; Currently a window is brought to the top when refocused. This is ;;; done because if a window overlaps the upper right hand corner ;;; of the focused window and you are in focus follow mouse mode, the ;;; overlapping window will get the focus instead. ;;; If this behavior bothers you, set the value to nil. (defvar raise-on-refocus-jrb t) ;;; alist of previously focused windows (defvar focus-alist-jrb nil) (defun return-focus-jrb () (let ((new-workspace (assoc current-workspace focus-alist-jrb))) (when (and (not (null new-workspace)) (not (null (cdr new-workspace))) (equal (window-get (cdr new-workspace) 'workspace) (car new-workspace))) (if raise-on-refocus-jrb (raise-window (cdr new-workspace))) (if (not (eq focus-mode 'click)) (warp-cursor-to-window (cdr new-workspace)) (set-input-focus (cdr new-workspace)))))) (defun save-focus-jrb () (let ((old-workspace (assoc current-workspace focus-alist-jrb))) (if (null old-workspace) (if (input-focus) (setq focus-alist-jrb (cons (cons current-workspace (input-focus)) focus-alist-jrb))) (rplacd old-workspace (input-focus))))) (add-hook 'leave-workspace-hook 'save-focus-jrb) (add-hook 'enter-workspace-hook 'return-focus-jrb)