Date copyright and version update
[clfswm.git] / src / bindings.lisp
blob76464840769cea662a714e822030f80c8a6e01e7
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) 2010 Philippe Brochard <hocwp@free.fr>
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*)
39 (defun help-on-clfswm ()
40 "Open the help and info window"
41 (open-menu (find-menu 'help-menu)))
44 (defun set-default-main-keys ()
45 (define-main-key ("F1" :mod-1) 'help-on-clfswm)
46 (define-main-key ("Home" :mod-1 :control :shift) 'exit-clfswm)
47 (define-main-key ("Right" :mod-1) 'select-next-brother)
48 (define-main-key ("Left" :mod-1) 'select-previous-brother)
49 (define-main-key ("Down" :mod-1) 'select-previous-level)
50 (define-main-key ("Up" :mod-1) 'select-next-level)
51 (define-main-key ("Tab" :mod-1) 'select-next-child)
52 (define-main-key ("Tab" :mod-1 :shift) 'select-previous-child)
53 (define-main-key ("Tab" :shift) 'switch-to-last-child)
54 (define-main-key ("Return" :mod-1) 'enter-frame)
55 (define-main-key ("Return" :mod-1 :shift) 'leave-frame)
56 (define-main-key ("Return" :mod-5) 'frame-toggle-maximize)
57 (define-main-key ("Page_Up" :mod-1) 'frame-lower-child)
58 (define-main-key ("Page_Down" :mod-1) 'frame-raise-child)
59 (define-main-key ("Home" :mod-1) 'switch-to-root-frame)
60 (define-main-key ("Home" :mod-1 :shift) 'switch-and-select-root-frame)
61 (define-main-key ("F10" :mod-1) 'fast-layout-switch)
62 (define-main-key ("F10" :shift) 'show-all-frames-info-key)
63 (define-main-key ("F10" :shift :mod-1) 'show-all-frames-info)
64 (define-main-key ("F10" :control) 'toggle-show-root-frame)
65 (define-main-key (#\b :mod-1) 'banish-pointer)
66 ;; Escape
67 (define-main-key ("Escape" :control) 'ask-close/kill-current-window)
68 ;; Second mode
69 (define-main-key (#\t :mod-1) 'second-key-mode)
70 (define-main-key ("less" :control) 'second-key-mode)
71 ;; Bind or jump functions
72 (define-main-key ("1" :mod-1) 'bind-or-jump 1)
73 (define-main-key ("2" :mod-1) 'bind-or-jump 2)
74 (define-main-key ("3" :mod-1) 'bind-or-jump 3)
75 (define-main-key ("4" :mod-1) 'bind-or-jump 4)
76 (define-main-key ("5" :mod-1) 'bind-or-jump 5)
77 (define-main-key ("6" :mod-1) 'bind-or-jump 6)
78 (define-main-key ("7" :mod-1) 'bind-or-jump 7)
79 (define-main-key ("8" :mod-1) 'bind-or-jump 8)
80 (define-main-key ("9" :mod-1) 'bind-or-jump 9)
81 (define-main-key ("0" :mod-1) 'bind-or-jump 10))
83 (add-hook *binding-hook* 'set-default-main-keys)
89 ;;; Mouse actions
90 (defun mouse-click-to-focus-and-move-window (window root-x root-y)
91 "Move and focus the current child - Create a new frame on the root window"
92 (declare (ignore window))
93 (stop-button-event)
94 (mouse-focus-move/resize-generic root-x root-y #'move-frame t))
97 (defun mouse-click-to-focus-and-resize-window (window root-x root-y)
98 "Resize and focus the current child - Create a new frame on the root window"
99 (declare (ignore window))
100 (stop-button-event)
101 (mouse-focus-move/resize-generic root-x root-y #'resize-frame t))
105 (defun set-default-main-mouse ()
106 (define-main-mouse (1) 'mouse-click-to-focus-and-move)
107 (define-main-mouse (2) 'mouse-middle-click)
108 (define-main-mouse (3) 'mouse-click-to-focus-and-resize)
109 (define-main-mouse (1 :mod-1) 'mouse-click-to-focus-and-move-window)
110 (define-main-mouse (3 :mod-1) 'mouse-click-to-focus-and-resize-window)
111 (define-main-mouse (1 :control :mod-1) 'mouse-move-child-over-frame)
112 (define-main-mouse (4) 'mouse-select-next-level)
113 (define-main-mouse (5) 'mouse-select-previous-level)
114 (define-main-mouse (4 :mod-1) 'mouse-enter-frame)
115 (define-main-mouse (5 :mod-1) 'mouse-leave-frame))
117 (add-hook *binding-hook* 'set-default-main-mouse)