1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Bindings keys and mouse
7 ;;; Note: Mod-1 is the Alt or Meta key, Mod-2 is the Numlock key.
8 ;;; --------------------------------------------------------------------------
10 ;;; (C) 2012 Philippe Brochard <pbrochard@common-lisp.net>
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.
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.
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.
26 ;;; --------------------------------------------------------------------------
31 ;;;| CONFIG - Bindings main mode
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
)
50 (define-main-key ("Left" :control
:mod-1
) 'select-brother-spatial-move-left
)
51 (define-main-key ("Right" :control
:mod-1
) 'select-brother-spatial-move-right
)
52 (define-main-key ("Up" :control
:mod-1
) 'select-brother-spatial-move-up
)
53 (define-main-key ("Down" :control
:mod-1
) 'select-brother-spatial-move-down
)
54 (define-main-key ("Tab" :mod-1
) 'select-next-child
)
55 (define-main-key ("Tab" :mod-1
:shift
) 'select-previous-child
)
56 (define-main-key ("Tab" :mod-1
:control
) 'select-next-subchild
)
57 (define-main-key ("Return" :mod-1
) 'enter-frame
)
58 (define-main-key ("Return" :mod-1
:shift
) 'leave-frame
)
59 (define-main-key ("Return" :mod-1
:control
) 'frame-toggle-maximize
)
60 (define-main-key ("Return" :mod-5
) 'frame-toggle-maximize
)
61 (define-main-key ("Page_Up" :mod-1
) 'frame-select-previous-child
)
62 (define-main-key ("Page_Down" :mod-1
) 'frame-select-next-child
)
63 (define-main-key ("Page_Up" :mod-1
:control
) 'frame-lower-child
)
64 (define-main-key ("Page_Down" :mod-1
:control
) 'frame-raise-child
)
65 (define-main-key ("Home" :mod-1
) 'switch-to-root-frame
)
66 (define-main-key ("Home" :mod-1
:shift
) 'switch-and-select-root-frame
)
67 (define-main-key ("F10" :mod-1
) 'fast-layout-switch
)
68 (define-main-key ("F10" :shift
:control
) 'toggle-show-root-frame
)
69 (define-main-key ("F10") 'expose-windows-mode
)
70 (define-main-key ("F10" :control
) 'expose-all-windows-mode
)
71 (define-main-key ("L2" :control
) 'present-clfswm-terminal
)
72 (define-main-key ("L2" :shift
) 'show-all-frames-info-key
)
73 (define-main-key ("L2" :shift
:mod-1
) 'show-all-frames-info
)
74 (define-main-key ("b" :mod-1
) 'banish-pointer
)
76 (define-main-key ("Escape" :control
) 'ask-close
/kill-current-window
)
78 (define-main-key (#\t :mod-1
) 'second-key-mode
)
79 (define-main-key ("less" :control
) 'second-key-mode
)
80 ;; Bind or jump functions
81 (define-main-key ("1" :mod-1
) 'bind-or-jump
1)
82 (define-main-key ("2" :mod-1
) 'bind-or-jump
2)
83 (define-main-key ("3" :mod-1
) 'bind-or-jump
3)
84 (define-main-key ("4" :mod-1
) 'bind-or-jump
4)
85 (define-main-key ("5" :mod-1
) 'bind-or-jump
5)
86 (define-main-key ("6" :mod-1
) 'bind-or-jump
6)
87 (define-main-key ("7" :mod-1
) 'bind-or-jump
7)
88 (define-main-key ("8" :mod-1
) 'bind-or-jump
8)
89 (define-main-key ("9" :mod-1
) 'bind-or-jump
9)
90 (define-main-key ("0" :mod-1
) 'bind-or-jump
10))
92 (add-hook *binding-hook
* 'set-default-main-keys
)
99 (defun mouse-click-to-focus-and-move-window (window root-x root-y
)
100 "Move and focus the current child - Create a new frame on the root window"
101 (declare (ignore window
))
103 (mouse-focus-move/resize-generic root-x root-y
#'move-frame t
))
106 (defun mouse-click-to-focus-and-resize-window (window root-x root-y
)
107 "Resize and focus the current child - Create a new frame on the root window"
108 (declare (ignore window
))
110 (mouse-focus-move/resize-generic root-x root-y
#'resize-frame t
))
113 (defun mouse-click-to-focus-and-move-window-constrained (window root-x root-y
)
114 "Move (constrained by other frames) and focus the current child - Create a new frame on the root window"
115 (declare (ignore window
))
117 (mouse-focus-move/resize-generic root-x root-y
#'move-frame-constrained t
))
120 (defun mouse-click-to-focus-and-resize-window-constrained (window root-x root-y
)
121 "Resize (constrained by other frames) and focus the current child - Create a new frame on the root window"
122 (declare (ignore window
))
124 (mouse-focus-move/resize-generic root-x root-y
#'resize-frame-constrained t
))
128 (defun set-default-main-mouse ()
129 (define-main-mouse (1) 'mouse-click-to-focus-and-move
)
130 (define-main-mouse (2) 'mouse-middle-click
)
131 (define-main-mouse (3) 'mouse-click-to-focus-and-resize
)
132 (define-main-mouse (1 :mod-1
) 'mouse-click-to-focus-and-move-window
)
133 (define-main-mouse (3 :mod-1
) 'mouse-click-to-focus-and-resize-window
)
134 (define-main-mouse (1 :mod-1
:shift
) 'mouse-click-to-focus-and-move-window-constrained
)
135 (define-main-mouse (3 :mod-1
:shift
) 'mouse-click-to-focus-and-resize-window-constrained
)
136 (define-main-mouse (1 :control
:mod-1
) 'mouse-move-child-over-frame
)
137 (define-main-mouse (4) 'mouse-select-next-level
)
138 (define-main-mouse (5) 'mouse-select-previous-level
)
139 (define-main-mouse (4 :mod-1
) 'mouse-enter-frame
)
140 (define-main-mouse (5 :mod-1
) 'mouse-leave-frame
)
141 (define-main-mouse (4 :mod-1
:control
) 'dec-transparency
)
142 (define-main-mouse (5 :mod-1
:control
) 'inc-transparency
)
143 (define-main-mouse (4 :mod-1
:control
:shift
) 'dec-transparency-slow
)
144 (define-main-mouse (5 :mod-1
:control
:shift
) 'inc-transparency-slow
))
146 (add-hook *binding-hook
* 'set-default-main-mouse
)