added an option for user-defined bindings with "xterm" on F2 as the default
This commit is contained in:
		
							parent
							
								
									2ad315e33d
								
							
						
					
					
						commit
						0598918d0c
					
				| 
						 | 
				
			
			@ -22,6 +22,7 @@
 | 
			
		|||
  (create-workspace keys "F9")
 | 
			
		||||
  (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")))
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
(define-record-type root-wm :root-wm
 | 
			
		||||
| 
						 | 
				
			
			@ -67,6 +68,10 @@
 | 
			
		|||
		execute attach quit
 | 
			
		||||
		create-workspace
 | 
			
		||||
		kill-client))
 | 
			
		||||
    (for-each (lambda (binding)
 | 
			
		||||
		(grab-shortcut dpy window (car binding) (cons 'binding binding)
 | 
			
		||||
			       in-channel #t))
 | 
			
		||||
	      (get-option-value options 'user-bindings))
 | 
			
		||||
 | 
			
		||||
    (spawn* '(root-wm)
 | 
			
		||||
	    (lambda (release)
 | 
			
		||||
| 
						 | 
				
			
			@ -316,7 +321,16 @@
 | 
			
		|||
		      '(#\y #\Y #\n #\N) #f)))
 | 
			
		||||
       (if (memq a '(#\y #\Y))
 | 
			
		||||
	   (exit #t))))
 | 
			
		||||
    (else (warn "unhandled root message" msg))))
 | 
			
		||||
    (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))))
 | 
			
		||||
	 (warn "unhandled root message" msg)))))
 | 
			
		||||
 | 
			
		||||
(define (exec-complete str pos)
 | 
			
		||||
  ;; TODO
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue