src/clfswm-query.lisp (query-print-string): Handle long lines correctly.
[clfswm.git] / src / bindings.lisp
blobebeb015f1595aca263976ba6ebaf7d361d9bac17
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*)
38 (defun test-hello ()
39 (info-mode '("Hello" "World")))
42 (defun help-on-clfswm ()
43 "Open the help and info window"
44 (open-menu (find-menu 'help-menu)))
47 (defun set-default-main-keys ()
48 (define-main-key ("F1" :mod-1) 'help-on-clfswm)
49 (define-main-key ("Home" :mod-1 :control :shift) 'exit-clfswm)
50 (define-main-key ("Right" :mod-1) 'select-next-brother)
51 (define-main-key ("Left" :mod-1) 'select-previous-brother)
52 (define-main-key ("Down" :mod-1) 'select-previous-level)
53 (define-main-key ("Up" :mod-1) 'select-next-level)
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 ("Tab" :shift) 'switch-to-last-child)
58 (define-main-key ("Return" :mod-1) 'enter-frame)
59 (define-main-key ("Return" :mod-1 :shift) 'leave-frame)
60 (define-main-key ("Return" :mod-5) 'frame-toggle-maximize)
61 (define-main-key ("Page_Up" :mod-1) 'frame-lower-child)
62 (define-main-key ("Page_Down" :mod-1) 'frame-raise-child)
63 (define-main-key ("Home" :mod-1) 'switch-to-root-frame)
64 (define-main-key ("Home" :mod-1 :shift) 'switch-and-select-root-frame)
65 (define-main-key ("F10" :mod-1) 'fast-layout-switch)
66 (define-main-key ("F10" :shift) 'show-all-frames-info-key)
67 (define-main-key ("F10" :shift :mod-1) 'show-all-frames-info)
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 (#\b :mod-1) 'banish-pointer)
73 ;; Escape
74 (define-main-key ("Escape" :control) 'ask-close/kill-current-window)
75 ;; Second mode
76 (define-main-key (#\t :mod-1) 'second-key-mode)
77 (define-main-key ("less" :control) 'second-key-mode)
78 ;; Bind or jump functions
79 (define-main-key ("1" :mod-1) 'bind-or-jump 1)
80 (define-main-key ("2" :mod-1) 'bind-or-jump 2)
81 (define-main-key ("3" :mod-1) 'bind-or-jump 3)
82 (define-main-key ("4" :mod-1) 'bind-or-jump 4)
83 (define-main-key ("5" :mod-1) 'bind-or-jump 5)
84 (define-main-key ("6" :mod-1) 'bind-or-jump 6)
85 (define-main-key ("7" :mod-1) 'bind-or-jump 7)
86 (define-main-key ("8" :mod-1) 'bind-or-jump 8)
87 (define-main-key ("9" :mod-1) 'bind-or-jump 9)
88 (define-main-key ("0" :mod-1) 'bind-or-jump 10))
90 (add-hook *binding-hook* 'set-default-main-keys)
96 ;;; Mouse actions
97 (defun mouse-click-to-focus-and-move-window (window root-x root-y)
98 "Move 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 #'move-frame t))
104 (defun mouse-click-to-focus-and-resize-window (window root-x root-y)
105 "Resize and focus the current child - Create a new frame on the root window"
106 (declare (ignore window))
107 (stop-button-event)
108 (mouse-focus-move/resize-generic root-x root-y #'resize-frame t))
112 (defun set-default-main-mouse ()
113 (define-main-mouse (1) 'mouse-click-to-focus-and-move)
114 (define-main-mouse (2) 'mouse-middle-click)
115 (define-main-mouse (3) 'mouse-click-to-focus-and-resize)
116 (define-main-mouse (1 :mod-1) 'mouse-click-to-focus-and-move-window)
117 (define-main-mouse (3 :mod-1) 'mouse-click-to-focus-and-resize-window)
118 (define-main-mouse (1 :control :mod-1) 'mouse-move-child-over-frame)
119 (define-main-mouse (4) 'mouse-select-next-level)
120 (define-main-mouse (5) 'mouse-select-previous-level)
121 (define-main-mouse (4 :mod-1) 'mouse-enter-frame)
122 (define-main-mouse (5 :mod-1) 'mouse-leave-frame))
124 (add-hook *binding-hook* 'set-default-main-mouse)