"Fossies" - the Fresh Open Source Software Archive

Member "xbindkeys-1.8.7/xbindkeysrc-combo.scm" (1 Mar 2020, 2193 Bytes) of package /linux/privat/xbindkeys-1.8.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lisp source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    2 ; Start of xbindkeys configuration ;
    3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    4 ;; This configuration is guile based.
    5 ;;
    6 ;; This configuration allow combo keys.
    7 ;; ie Control+z Control+e -> xterm
    8 ;;    Control+z z         -> rxvt
    9 ;;    Control+z Control+g -> quit second mode
   10 ;;
   11 ;; It also allow to add or remove a key on the fly!
   12 
   13 
   14 
   15 
   16 (define (display-n str)
   17     "Display a string then newline"
   18   (display str)
   19   (newline))
   20 
   21 
   22 (define (first-binding)
   23     "First binding"
   24   (xbindkey '(control shift q) "xterm")
   25   (xbindkey-function '(control a)
   26              (lambda ()
   27                (display "Hello from Scheme!")
   28                (newline)))
   29   (xbindkey-function '(shift p)
   30              (lambda ()
   31                (run-command "xterm")))
   32   ;; set directly keycode (here shift + m with my keyboard)
   33   (xbindkey-function '("m:0x1"  "c:47") 
   34              (lambda ()
   35                (display "------ Adding control k -----")
   36                (newline)
   37                (xbindkey '(control k) "rxvt")
   38                (grab-all-keys)))
   39   (xbindkey-function '(shift i)
   40              (lambda ()
   41                (display "Remove control k")
   42                (newline)
   43                (remove-xbindkey '(control k))
   44                (grab-all-keys)))
   45   (xbindkey-function '(shift o)
   46              (lambda ()
   47                (display "Remove control a")
   48                (newline)
   49                (remove-xbindkey '(control a))
   50                (grab-all-keys)))
   51   (xbindkey-function '(control z) second-binding))
   52                
   53 
   54 
   55 (define (reset-first-binding)
   56     "reset first binding"
   57   (display-n "reset first binding")
   58   (ungrab-all-keys)
   59   (remove-all-keys)
   60   (first-binding)
   61   (grab-all-keys))
   62 
   63 (define (second-binding)
   64     "Second binding"
   65   (display "New binding")
   66   (ungrab-all-keys)
   67   (remove-all-keys)
   68   (xbindkey-function '(control e)
   69              (lambda ()
   70                (display-n "Control e")
   71                (run-command "xterm")
   72                (reset-first-binding)))
   73   (xbindkey-function 'z
   74              (lambda ()
   75                (display-n "z (second)")
   76                (run-command "rxvt")
   77                (reset-first-binding)))
   78   (xbindkey-function '(control g) reset-first-binding)
   79   (debug)
   80   (grab-all-keys))
   81                
   82 
   83 
   84 
   85 (first-binding)
   86 
   87 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   88 ; End of xbindkeys configuration ;
   89 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;