From 04455cd1048319072ad61578b1d5a74843cd2b33 Mon Sep 17 00:00:00 2001 From: frese Date: Wed, 7 May 2003 14:48:48 +0000 Subject: [PATCH] added a shortcut for saving the layout (F11) --- src/root-manager.scm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/root-manager.scm b/src/root-manager.scm index 304261c..bfd4f86 100644 --- a/src/root-manager.scm +++ b/src/root-manager.scm @@ -23,11 +23,12 @@ (create-workspace-question string "What kind of manager do you want in the new workspace?\n(S)witch or (M)ove windowmanager:") (kill-client keys "M-c") (user-bindings binding-list '(("F2" exec "xterm"))) + (save-layout keys "F11") ) (define-record-type root-wm :root-wm (make-root-wm dpy managers current-manager initial-manager in-channel - options finish) + options finish cross-ref-hack) root-wm? (dpy root-wm:dpy) (managers root-wm:managers set-root-wm:managers!) @@ -35,14 +36,15 @@ (initial-manager root-wm:initial-manager) (in-channel root-wm:in-channel) (options root-wm:options) - (finish root-wm:finish)) + (finish root-wm:finish) + (cross-ref-hack root-wm:cross-ref-hack)) (define (root-wm-managers root-wm) (filter (lambda (wm) (window-exists? (root-wm:dpy root-wm) (wm:window wm))) (root-wm:managers root-wm))) -(define (create-root-wm dpy options) +(define (create-root-wm dpy options cross-ref-hack) (let* ((window (default-root-window dpy)) (screen (display:default-screen dpy)) (options (create-options dpy (screen:default-colormap screen) @@ -53,7 +55,7 @@ (initial-manager (create-workspace-manager in-channel dpy window options)) (root-wm (make-root-wm dpy '() #f initial-manager in-channel options - (make-sync-point))) + (make-sync-point) cross-ref-hack)) ) (set-root-wm:current-manager! root-wm initial-manager) (add-manager! root-wm initial-manager) @@ -67,6 +69,7 @@ create-switch-wm create-move-wm execute attach quit create-workspace + save-layout kill-client)) (for-each (lambda (binding) (grab-shortcut dpy window (car binding) (cons 'binding binding) @@ -135,7 +138,6 @@ (define (root-wm-configure-window root-wm window changes) (let ((wm (manager-of-window root-wm window))) - (mdisplay "root-wm configure: " (list wm window changes) "\n") (wm-configure-window (or wm (root-wm:current-manager root-wm)) window changes))) @@ -343,12 +345,18 @@ '(#\y #\Y #\n #\N) #f))) (if (memq a '(#\y #\Y)) (exit #t)))) + + ((save-layout) + ;; we need backup-layout from config.scm, but opening config + ;; would be a cross-reference. + (((root-wm:cross-ref-hack root-wm) 'backup-layout) root-wm) + (bell (root-wm:dpy root-wm) 0)) + (else (if (and (pair? (car msg)) (eq? 'binding (car (car msg)))) (let* ((binding (cdr (car msg))) (time (second msg)) (command (cdr binding))) - (mdisplay "binding: " binding " command: " command "\n") (case (car command) ((exec) (run (sh -c ,(string-append (cadr command) " &")))) (else (warn "unknown binding command" command)))) @@ -413,8 +421,6 @@ ((eq? (event-type focus-in) (any-event-type e)) (let ((mode (focus-change-event-mode e)) (detail (focus-change-event-detail e))) -; (mdisplay "manager focus-event: " manager " " -; (focus-change-event-type e) " " detail "\n") (if (and (eq? mode (notify-mode normal)) (or (eq? detail (notify-detail inferior)) (eq? detail (notify-detail ancestor))