Load clfswm.asd from load.lisp
[clfswm.git] / src / bindings.lisp
blob48b78a0ca4218d61b4a4afbe35b8f6308ff84a1d
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Bindings keys and mouse
6 ;;;
7 ;;; Note: Mod-1 is the Alt or Meta key, Mod-2 is the Numlock key.
8 ;;; --------------------------------------------------------------------------
9 ;;;
10 ;;; (C) 2005-2013 Philippe Brochard <pbrochard@common-lisp.net>
11 ;;;
12 ;;; This program is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or
15 ;;; (at your option) any later version.
16 ;;;
17 ;;; This program is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with this program; if not, write to the Free Software
24 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 ;;;
26 ;;; --------------------------------------------------------------------------
28 (in-package :clfswm)
30 ;;;,-----
31 ;;;| CONFIG - Bindings main mode
32 ;;;`-----
35 (add-hook *binding-hook* 'init-*main-keys* 'init-*main-mouse*)
38 (defun help-on-clfswm ()
39 "Open the help and info window"
40 (open-menu (find-menu 'help-menu)))
43 (defun set-default-main-keys ()
44 (define-main-key ("F1" :mod-1) 'help-on-clfswm)
45 (define-main-key ("Home" :mod-1 :control :shift) 'exit-clfswm)
46 (define-main-key ("Right" :mod-1) 'select-next-brother)
47 (define-main-key ("Left" :mod-1) 'select-previous-brother)
48 (define-main-key ("Down" :mod-1) 'select-previous-level)
49 (define-main-key ("Up" :mod-1) 'select-next-level)
51 (define-main-key ("Right" :mod-1 :shift) 'select-next-brother-take-current)
52 (define-main-key ("Left" :mod-1 :shift) 'select-previous-brother-take-current)
54 (define-main-key ("Left" :control :mod-1) 'select-brother-spatial-move-left)
55 (define-main-key ("Right" :control :mod-1) 'select-brother-spatial-move-right)
56 (define-main-key ("Up" :control :mod-1) 'select-brother-spatial-move-up)
57 (define-main-key ("Down" :control :mod-1) 'select-brother-spatial-move-down)
59 (define-main-key ("Left" :control :mod-1 :shift) 'select-brother-spatial-move-left-take-current)
60 (define-main-key ("Right" :control :mod-1 :shift) 'select-brother-spatial-move-right-take-current)
61 (define-main-key ("Up" :control :mod-1 :shift) 'select-brother-spatial-move-up-take-current)
62 (define-main-key ("Down" :control :mod-1 :shift) 'select-brother-spatial-move-down-take-current)
64 (define-main-key ("Tab" :mod-1) 'select-next-child)
65 (define-main-key ("Tab" :mod-1 :shift) 'select-previous-child)
66 (define-main-key ("Tab" :mod-1 :control) 'select-next-subchild)
67 (define-main-key ("Return" :mod-1) 'enter-frame)
68 (define-main-key ("Return" :mod-1 :shift) 'leave-frame)
69 (define-main-key ("Return" :mod-1 :control) 'frame-toggle-maximize)
70 (define-main-key ("Return" :mod-5) 'frame-toggle-maximize)
71 (define-main-key ("Page_Up" :mod-1) 'frame-select-previous-child)
72 (define-main-key ("Page_Down" :mod-1) 'frame-select-next-child)
73 (define-main-key ("Page_Up" :mod-1 :control) 'frame-lower-child)
74 (define-main-key ("Page_Down" :mod-1 :control) 'frame-raise-child)
75 (define-main-key ("Home" :mod-1) 'switch-to-root-frame)
76 (define-main-key ("Home" :mod-1 :shift) 'switch-and-select-root-frame)
77 (define-main-key ("Menu") 'fastswitch-mode)
78 (define-main-key ("Menu" :control) 'fastswitch-move-mode)
79 (define-main-key ("F10" :mod-1) 'fast-layout-switch)
80 (define-main-key ("F10" :shift :control) 'toggle-show-root-frame)
81 (define-main-key ("F10") 'expose-windows-mode)
82 (define-main-key ("F10" :control) 'expose-all-windows-mode)
83 (define-main-key ("F12" :control) 'present-clfswm-terminal)
84 (define-main-key ("F12" :shift) 'show-all-frames-info-key)
85 (define-main-key ("F12" :shift :mod-1) 'show-all-frames-info)
86 (define-main-key ("b" :mod-1) 'banish-pointer)
87 ;; Escape
88 (define-main-key ("Escape" :control) 'ask-close/kill-current-window)
89 ;; Second mode
90 (define-main-key (#\t :mod-1) 'second-key-mode)
91 (define-main-key ("less" :control) 'second-key-mode)
92 ;; Bind or jump functions
93 (define-main-key ("1" :mod-1) 'bind-or-jump 1)
94 (define-main-key ("2" :mod-1) 'bind-or-jump 2)
95 (define-main-key ("3" :mod-1) 'bind-or-jump 3)
96 (define-main-key ("4" :mod-1) 'bind-or-jump 4)
97 (define-main-key ("5" :mod-1) 'bind-or-jump 5)
98 (define-main-key ("6" :mod-1) 'bind-or-jump 6)
99 (define-main-key ("7" :mod-1) 'bind-or-jump 7)
100 (define-main-key ("8" :mod-1) 'bind-or-jump 8)
101 (define-main-key ("9" :mod-1) 'bind-or-jump 9)
102 (define-main-key ("0" :mod-1) 'bind-or-jump 10))
104 (add-hook *binding-hook* 'set-default-main-keys)
110 ;;; Mouse actions
111 (defun mouse-click-to-focus-and-move-window (window root-x root-y)
112 "Move and focus the current child - Create a new frame on the root window"
113 (declare (ignore window))
114 (stop-button-event)
115 (mouse-focus-move/resize-generic root-x root-y #'move-frame t))
118 (defun mouse-click-to-focus-and-resize-window (window root-x root-y)
119 "Resize and focus the current child - Create a new frame on the root window"
120 (declare (ignore window))
121 (stop-button-event)
122 (mouse-focus-move/resize-generic root-x root-y #'resize-frame t))
125 (defun mouse-click-to-focus-and-move-window-constrained (window root-x root-y)
126 "Move (constrained by other frames) and focus the current child - Create a new frame on the root window"
127 (declare (ignore window))
128 (stop-button-event)
129 (mouse-focus-move/resize-generic root-x root-y #'move-frame-constrained t))
132 (defun mouse-click-to-focus-and-resize-window-constrained (window root-x root-y)
133 "Resize (constrained by other frames) and focus the current child - Create a new frame on the root window"
134 (declare (ignore window))
135 (stop-button-event)
136 (mouse-focus-move/resize-generic root-x root-y #'resize-frame-constrained t))
140 (defun set-default-main-mouse ()
141 (define-main-mouse (1) 'mouse-click-to-focus-and-move)
142 (define-main-mouse (2) 'mouse-middle-click)
143 (define-main-mouse (3) 'mouse-click-to-focus-and-resize)
144 (define-main-mouse (1 :mod-1) 'mouse-click-to-focus-and-move-window)
145 (define-main-mouse (3 :mod-1) 'mouse-click-to-focus-and-resize-window)
146 (define-main-mouse (1 :mod-1 :shift) 'mouse-click-to-focus-and-move-window-constrained)
147 (define-main-mouse (3 :mod-1 :shift) 'mouse-click-to-focus-and-resize-window-constrained)
148 (define-main-mouse (1 :control :mod-1) 'mouse-move-child-over-frame)
149 (define-main-mouse (4) 'mouse-select-next-level)
150 (define-main-mouse (5) 'mouse-select-previous-level)
151 (define-main-mouse (4 :mod-1) 'mouse-enter-frame)
152 (define-main-mouse (5 :mod-1) 'mouse-leave-frame)
153 (define-main-mouse (4 :mod-1 :control) 'dec-transparency)
154 (define-main-mouse (5 :mod-1 :control) 'inc-transparency)
155 (define-main-mouse (4 :mod-1 :control :shift) 'dec-transparency-slow)
156 (define-main-mouse (5 :mod-1 :control :shift) 'inc-transparency-slow))
158 (add-hook *binding-hook* 'set-default-main-mouse)