added a shortcut for saving the layout (F11)
This commit is contained in:
		
							parent
							
								
									a6b01632eb
								
							
						
					
					
						commit
						04455cd104
					
				| 
						 | 
					@ -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:")
 | 
					  (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")
 | 
					  (kill-client keys "M-c")
 | 
				
			||||||
  (user-bindings binding-list '(("F2" exec "xterm")))
 | 
					  (user-bindings binding-list '(("F2" exec "xterm")))
 | 
				
			||||||
 | 
					  (save-layout keys "F11")
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define-record-type root-wm :root-wm
 | 
					(define-record-type root-wm :root-wm
 | 
				
			||||||
  (make-root-wm dpy managers current-manager initial-manager in-channel
 | 
					  (make-root-wm dpy managers current-manager initial-manager in-channel
 | 
				
			||||||
		options finish)
 | 
							options finish cross-ref-hack)
 | 
				
			||||||
  root-wm?
 | 
					  root-wm?
 | 
				
			||||||
  (dpy root-wm:dpy)
 | 
					  (dpy root-wm:dpy)
 | 
				
			||||||
  (managers root-wm:managers set-root-wm:managers!)
 | 
					  (managers root-wm:managers set-root-wm:managers!)
 | 
				
			||||||
| 
						 | 
					@ -35,14 +36,15 @@
 | 
				
			||||||
  (initial-manager root-wm:initial-manager)
 | 
					  (initial-manager root-wm:initial-manager)
 | 
				
			||||||
  (in-channel root-wm:in-channel)
 | 
					  (in-channel root-wm:in-channel)
 | 
				
			||||||
  (options root-wm:options)
 | 
					  (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)
 | 
					(define (root-wm-managers root-wm)
 | 
				
			||||||
  (filter (lambda (wm)
 | 
					  (filter (lambda (wm)
 | 
				
			||||||
	    (window-exists? (root-wm:dpy root-wm) (wm:window wm)))
 | 
						    (window-exists? (root-wm:dpy root-wm) (wm:window wm)))
 | 
				
			||||||
	  (root-wm:managers root-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))
 | 
					  (let* ((window (default-root-window dpy))
 | 
				
			||||||
	 (screen (display:default-screen dpy))
 | 
						 (screen (display:default-screen dpy))
 | 
				
			||||||
	 (options (create-options dpy (screen:default-colormap screen)
 | 
						 (options (create-options dpy (screen:default-colormap screen)
 | 
				
			||||||
| 
						 | 
					@ -53,7 +55,7 @@
 | 
				
			||||||
	 (initial-manager (create-workspace-manager in-channel dpy window
 | 
						 (initial-manager (create-workspace-manager in-channel dpy window
 | 
				
			||||||
						    options))
 | 
											    options))
 | 
				
			||||||
	 (root-wm (make-root-wm dpy '() #f initial-manager in-channel 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)
 | 
					    (set-root-wm:current-manager! root-wm initial-manager)
 | 
				
			||||||
    (add-manager! root-wm initial-manager)
 | 
					    (add-manager! root-wm initial-manager)
 | 
				
			||||||
| 
						 | 
					@ -67,6 +69,7 @@
 | 
				
			||||||
		create-switch-wm create-move-wm
 | 
							create-switch-wm create-move-wm
 | 
				
			||||||
		execute attach quit
 | 
							execute attach quit
 | 
				
			||||||
		create-workspace
 | 
							create-workspace
 | 
				
			||||||
 | 
							save-layout
 | 
				
			||||||
		kill-client))
 | 
							kill-client))
 | 
				
			||||||
    (for-each (lambda (binding)
 | 
					    (for-each (lambda (binding)
 | 
				
			||||||
		(grab-shortcut dpy window (car binding) (cons 'binding binding)
 | 
							(grab-shortcut dpy window (car binding) (cons 'binding binding)
 | 
				
			||||||
| 
						 | 
					@ -135,7 +138,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (root-wm-configure-window root-wm window changes)
 | 
					(define (root-wm-configure-window root-wm window changes)
 | 
				
			||||||
  (let ((wm (manager-of-window root-wm window)))
 | 
					  (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))
 | 
					    (wm-configure-window (or wm (root-wm:current-manager root-wm))
 | 
				
			||||||
			 window changes)))
 | 
								 window changes)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -343,12 +345,18 @@
 | 
				
			||||||
		      '(#\y #\Y #\n #\N) #f)))
 | 
							      '(#\y #\Y #\n #\N) #f)))
 | 
				
			||||||
       (if (memq a '(#\y #\Y))
 | 
					       (if (memq a '(#\y #\Y))
 | 
				
			||||||
	   (exit #t))))
 | 
						   (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
 | 
					    (else
 | 
				
			||||||
     (if (and (pair? (car msg)) (eq? 'binding (car (car msg))))
 | 
					     (if (and (pair? (car msg)) (eq? 'binding (car (car msg))))
 | 
				
			||||||
	 (let* ((binding (cdr (car msg)))
 | 
						 (let* ((binding (cdr (car msg)))
 | 
				
			||||||
		(time (second msg))
 | 
							(time (second msg))
 | 
				
			||||||
		(command (cdr binding)))
 | 
							(command (cdr binding)))
 | 
				
			||||||
	   (mdisplay "binding: " binding " command: " command "\n")
 | 
					 | 
				
			||||||
	   (case (car command)
 | 
						   (case (car command)
 | 
				
			||||||
	     ((exec) (run (sh -c ,(string-append (cadr command) " &"))))
 | 
						     ((exec) (run (sh -c ,(string-append (cadr command) " &"))))
 | 
				
			||||||
	     (else (warn "unknown binding command" command))))
 | 
						     (else (warn "unknown binding command" command))))
 | 
				
			||||||
| 
						 | 
					@ -413,8 +421,6 @@
 | 
				
			||||||
	     ((eq? (event-type focus-in) (any-event-type e))
 | 
						     ((eq? (event-type focus-in) (any-event-type e))
 | 
				
			||||||
	      (let ((mode (focus-change-event-mode e))
 | 
						      (let ((mode (focus-change-event-mode e))
 | 
				
			||||||
		    (detail (focus-change-event-detail 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))
 | 
							(if (and (eq? mode (notify-mode normal))
 | 
				
			||||||
			 (or (eq? detail (notify-detail inferior))
 | 
								 (or (eq? detail (notify-detail inferior))
 | 
				
			||||||
			     (eq? detail (notify-detail ancestor))
 | 
								     (eq? detail (notify-detail ancestor))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue