"Fossies" - the Fresh Open Source Software Archive

Member "xbindkeys-1.8.7/xbindkeysrc.scm" (1 Mar 2020, 4803 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 guile configuration ;;
    3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    4 ;; This configuration is guile based.
    5 ;;   http://www.gnu.org/software/guile/guile.html
    6 ;; any functions that work in guile will work here.
    7 ;; see EXTRA FUNCTIONS:
    8 
    9 ;; Version: 1.8.3
   10 
   11 ;; If you edit this file, do not forget to uncomment any lines
   12 ;; that you change.
   13 ;; The semicolon(;) symbol may be used anywhere for comments.
   14 
   15 ;; To specify a key, you can use 'xbindkeys --key' or
   16 ;; 'xbindkeys --multikey' and put one of the two lines in this file.
   17 
   18 ;; A list of keys is in /usr/include/X11/keysym.h and in
   19 ;; /usr/include/X11/keysymdef.h
   20 ;; The XK_ is not needed.
   21 
   22 ;; List of modifier:
   23 ;;   Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
   24 ;;   Mod3 (CapsLock), Mod4, Mod5 (Scroll).
   25 
   26 
   27 ;; The release modifier is not a standard X modifier, but you can
   28 ;; use it if you want to catch release instead of press events
   29 
   30 ;; By defaults, xbindkeys does not pay attention to modifiers
   31 ;; NumLock, CapsLock and ScrollLock.
   32 ;; Uncomment the lines below if you want to use them.
   33 ;; To dissable them, call the functions with #f
   34 
   35 
   36 ;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage
   37 ;;(set-numlock! #t)
   38 ;;(set-scrolllock! #t)
   39 ;;(set-capslock! #t)
   40 
   41 ;;;;; Scheme API reference
   42 ;;;;
   43 ;; Optional modifier state:
   44 ;; (set-numlock! #f or #t)
   45 ;; (set-scrolllock! #f or #t)
   46 ;; (set-capslock! #f or #t)
   47 ;;
   48 ;; Shell command key:
   49 ;; (xbindkey key "foo-bar-command [args]")
   50 ;; (xbindkey '(modifier* key) "foo-bar-command [args]")
   51 ;;
   52 ;; Scheme function key:
   53 ;; (xbindkey-function key function-name-or-lambda-function)
   54 ;; (xbindkey-function '(modifier* key) function-name-or-lambda-function)
   55 ;;
   56 ;; Other functions:
   57 ;; (remove-xbindkey key)
   58 ;; (run-command "foo-bar-command [args]")
   59 ;; (grab-all-keys)
   60 ;; (ungrab-all-keys)
   61 ;; (remove-all-keys)
   62 ;; (debug)
   63 
   64 
   65 ;; Examples of commands:
   66 
   67 (xbindkey '(control shift q) "xbindkeys_show")
   68 
   69 ;; set directly keycode (here control + f with my keyboard)
   70 (xbindkey '("m:0x4" "c:41") "xterm")
   71 
   72 ;; specify a mouse button
   73 (xbindkey '(control "b:2") "xterm")
   74 
   75 ;;(xbindkey '(shift mod2 alt s) "xterm -geom 50x20+20+20")
   76 
   77 ;; set directly keycode (control+alt+mod2 + f with my keyboard)
   78 (xbindkey '(alt "m:4" mod2 "c:0x29") "xterm")
   79 
   80 ;; Control+Shift+a  release event starts rxvt
   81 ;;(xbindkey '(release control shift a) "rxvt")
   82 
   83 ;; Control + mouse button 2 release event starts rxvt
   84 ;;(xbindkey '(releace control "b:2") "rxvt")
   85 
   86 
   87 ;; Extra features
   88 (xbindkey-function '(control a)
   89            (lambda ()
   90              (display "Hello from Scheme!")
   91              (newline)))
   92 
   93 (xbindkey-function '(shift p)
   94            (lambda ()
   95              (run-command "xterm")))
   96 
   97 
   98 ;; Double click test
   99 (xbindkey-function '(control w)
  100            (let ((count 0))
  101              (lambda ()
  102                (set! count (+ count 1))
  103                (if (> count 1)
  104                (begin
  105                 (set! count 0)
  106                 (run-command "xterm"))))))
  107 
  108 ;; Time double click test:
  109 ;;  - short double click -> run an xterm
  110 ;;  - long  double click -> run an rxvt
  111 (xbindkey-function '(shift w)
  112            (let ((time (current-time))
  113              (count 0))
  114              (lambda ()
  115                (set! count (+ count 1))
  116                (if (> count 1)
  117                (begin
  118                 (if (< (- (current-time) time) 1)
  119                 (run-command "xterm")
  120                 (run-command "rxvt"))
  121                 (set! count 0)))
  122                (set! time (current-time)))))
  123 
  124 
  125 ;; Chording keys test: Start differents program if only one key is
  126 ;; pressed or another if two keys are pressed.
  127 ;; If key1 is pressed start cmd-k1
  128 ;; If key2 is pressed start cmd-k2
  129 ;; If both are pressed start cmd-k1-k2 or cmd-k2-k1 following the
  130 ;;   release order
  131 (define (define-chord-keys key1 key2 cmd-k1 cmd-k2 cmd-k1-k2 cmd-k2-k1)
  132     "Define chording keys"
  133   (let ((k1 #f) (k2 #f))
  134     (xbindkey-function key1 (lambda () (set! k1 #t)))
  135     (xbindkey-function key2 (lambda () (set! k2 #t)))
  136     (xbindkey-function (cons 'release key1)
  137                (lambda ()
  138              (if (and k1 k2)
  139                  (run-command cmd-k1-k2)
  140                  (if k1 (run-command cmd-k1)))
  141              (set! k1 #f) (set! k2 #f)))
  142     (xbindkey-function (cons 'release key2)
  143                (lambda ()
  144              (if (and k1 k2)
  145                  (run-command cmd-k2-k1)
  146                  (if k2 (run-command cmd-k2)))
  147              (set! k1 #f) (set! k2 #f)))))
  148 
  149 
  150 ;; Example:
  151 ;;   Shift + b:1                   start an xterm
  152 ;;   Shift + b:3                   start an rxvt
  153 ;;   Shift + b:1 then Shift + b:3  start gv
  154 ;;   Shift + b:3 then Shift + b:1  start xpdf
  155 
  156 (define-chord-keys '(shift "b:1") '(shift "b:3")
  157   "xterm" "rxvt" "gv" "xpdf")
  158 
  159 ;; Here the release order have no importance
  160 ;; (the same program is started in both case)
  161 (define-chord-keys '(alt "b:1") '(alt "b:3")
  162   "gv" "xpdf" "xterm" "xterm")
  163 
  164 
  165 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  166 ;; End of xbindkeys guile configuration ;;
  167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;