Advertisement
Guest User

.xbindkeysrc.scm

a guest
Apr 24th, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 4.14 KB | None | 0 0
  1. (define (display-n str)
  2.   "Display a string then newline"
  3.   (display str)
  4.   (newline))
  5.  
  6. (define (supershiftpress key)
  7.     "Press key with Super and Shift held"
  8.     (run-command
  9.         (string-append "xdotool key Super_L+Shift_L+" key)))
  10.  
  11. (define (superpress key)
  12.     "Press key with Super held"
  13.     (run-command
  14.         (string-append "xdotool key Super_L+" key)))
  15.        
  16. (define (reset-to-primary-binding)
  17.   "Reset primary binding"
  18.   (ungrab-all-keys)
  19.     (display-n "released!")
  20.   (remove-all-keys)
  21.   (primary-binding)
  22.   (grab-all-keys))
  23.  
  24. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  25.  
  26. (define (primary-10)
  27.   "Iconify"
  28.   (supershiftpress "F1"))
  29.  
  30. (define (primary-11)
  31.   "Close"
  32.   (supershiftpress "F2"))
  33.  
  34. (define (primary-12)
  35.   "Maximize"
  36.   (supershiftpress "F3"))
  37.  
  38. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  39.  
  40. (define (secondary-1)
  41.   "Expo"
  42.   (supershiftpress "F11"))
  43.  
  44. (define (secondary-2)
  45.   "PlayPause"
  46.   (superpress "F5"))
  47.  
  48. (define (secondary-3)
  49.  "Show Desktop"
  50.   (supershiftpress "F10"))
  51.  
  52. (define (secondary-4)
  53.   "VolDown"
  54.   (superpress "F3"))
  55.  
  56. (define (secondary-5)
  57.   "VolUp"
  58.   (superpress "F2"))
  59.  
  60. (define (secondary-9)
  61.   "Raise"
  62.   (supershiftpress "F8"))
  63.  
  64. (define (secondary-10)
  65.   (display-n "secondary-10: Code Me"))
  66.  
  67. (define (secondary-11)
  68.   "Next"
  69.   (superpress "F7"))
  70.  
  71. (define (secondary-12)
  72.   "Prev"
  73.   (superpress "F6"))
  74.  
  75. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  76.  
  77. (define (tertiary-1)
  78.   "Close Tab"
  79.   (supershiftpress "w"))
  80.  
  81. (define (tertiary-2)
  82.    "xterm"
  83.   (run-command "xterm"))
  84.  
  85. (define (tertiary-3)
  86.   "New Tab"
  87.   (supershiftpress "t"))
  88.  
  89. (define (tertiary-4)
  90.   (display-n "tertiary-4: Code Me"))
  91.    
  92. (define (tertiary-5)
  93.   (display-n "tertiary-5: Code Me"))
  94.  
  95. (define (tertiary-8)
  96.   "Lower"
  97.   (supershiftpress "F9"))
  98.  
  99. (define (tertiary-10)
  100.   (display-n "tertiary-10: Code Me"))
  101.  
  102. (define (tertiary-11)
  103.   (display-n "tertiary-11: Code Me"))
  104.  
  105. (define (tertiary-12)
  106.   (display-n "tertiary-12: Code Me"))
  107.  
  108. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  109.  
  110. (define (primary-binding)
  111.   "Bind all primary bindings"
  112.   ;; 1 - 5 use the default action
  113.  
  114.   (xbindkey-function  '("b:8") second-binding)
  115.   (xbindkey-function  '("b:9") tertiary-binding)
  116.  
  117.   (xbindkey-function '("b:10") primary-10)
  118.   (xbindkey-function '("b:11") primary-11)
  119.   (xbindkey-function '("b:12") primary-12))
  120.  
  121. (define (second-binding) ;;bindings for the 8th button
  122.   "Bind all secondary binding"
  123.   (let ((modkey-used #f))
  124.     (ungrab-all-keys)
  125.     (remove-all-keys)
  126.     (xbindkey-function '("b:1")
  127.                        secondary-1)
  128.     (xbindkey-function '("b:2")
  129.                        secondary-2)
  130.     (xbindkey-function '("b:3")
  131.                        secondary-3)
  132.     (xbindkey-function '("b:4")
  133.                        secondary-4)
  134.     (xbindkey-function '("b:5")
  135.                        secondary-5)
  136.     (xbindkey-function '("b:9")
  137.                        secondary-9)
  138.     (xbindkey-function '("b:10")
  139.                        secondary-10)
  140.     (xbindkey-function '("b:11")
  141.                        secondary-11)
  142.     (xbindkey-function '("b:12")
  143.                        secondary-12)
  144.     (xbindkey-function '(release "b:8")
  145.                        reset-to-primary-binding)
  146.    (grab-all-keys)))
  147.  
  148. (define (tertiary-binding) ;;bindings for the 9th button
  149.   "Bind all tertiary binding"
  150.   (let ((modkey-used #f))
  151.     (ungrab-all-keys)
  152.     (remove-all-keys)
  153.     (xbindkey-function '("b:1")
  154.                        tertiary-1)
  155.     (xbindkey-function '("b:2")
  156.                        tertiary-2)
  157.     (xbindkey-function '("b:3")
  158.                        tertiary-3)
  159.     (xbindkey-function '("b:4")
  160.                        tertiary-4)
  161.     (xbindkey-function '("b:5")
  162.                        tertiary-5)
  163.     (xbindkey-function '("b:8")
  164.                        tertiary-8)
  165.     (xbindkey-function '("b:10")
  166.                        tertiary-10)
  167.     (xbindkey-function '("b:11")
  168.                        tertiary-11)
  169.     (xbindkey-function '("b:12")
  170.                        tertiary-12)
  171.     (xbindkey-function '(release "b:9")
  172.                        reset-to-primary-binding)
  173.     (grab-all-keys)))
  174.  
  175.  
  176. (grab-all-keys)
  177. (primary-binding)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement