bindings.lisp 7.14 KB
Newer Older
Philippe Brochard's avatar
Philippe Brochard committed
1
2
3
4
5
6
7
8
9
;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
;;; Documentation: Bindings keys and mouse
;;;
;;; Note: Mod-1 is the Alt or Meta key, Mod-2 is the Numlock key.
;;; --------------------------------------------------------------------------
;;;
Philippe Brochard's avatar
Philippe Brochard committed
10
;;; (C) 2005-2015 Philippe Brochard <pbrochard@common-lisp.net>
Philippe Brochard's avatar
Philippe Brochard committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;
;;; --------------------------------------------------------------------------

(in-package :clfswm)

;;;,-----
;;;| CONFIG - Bindings main mode
;;;`-----


35
36
(add-hook *binding-hook* 'init-*main-keys* 'init-*main-mouse*)

37
38
39
40
41
42

(defun help-on-clfswm ()
  "Open the help and info window"
  (open-menu (find-menu 'help-menu)))


43
44
45
(defun set-default-main-keys ()
  (define-main-key ("F1" :mod-1) 'help-on-clfswm)
  (define-main-key ("Home" :mod-1 :control :shift) 'exit-clfswm)
46
47
  (define-main-key ("Right" :mod-1) 'select-next-brother)
  (define-main-key ("Left" :mod-1) 'select-previous-brother)
48
49
  (define-main-key ("Down" :mod-1) 'select-previous-level)
  (define-main-key ("Up" :mod-1) 'select-next-level)
50
51
52
53

  (define-main-key ("Right" :mod-1 :shift) 'select-next-brother-take-current)
  (define-main-key ("Left" :mod-1 :shift) 'select-previous-brother-take-current)

54
55
56
57
  (define-main-key ("Left" :control :mod-1) 'select-brother-spatial-move-left)
  (define-main-key ("Right" :control :mod-1) 'select-brother-spatial-move-right)
  (define-main-key ("Up" :control :mod-1) 'select-brother-spatial-move-up)
  (define-main-key ("Down" :control :mod-1) 'select-brother-spatial-move-down)
58
59
60
61
62
63

  (define-main-key ("Left" :control :mod-1 :shift) 'select-brother-spatial-move-left-take-current)
  (define-main-key ("Right" :control :mod-1 :shift) 'select-brother-spatial-move-right-take-current)
  (define-main-key ("Up" :control :mod-1 :shift) 'select-brother-spatial-move-up-take-current)
  (define-main-key ("Down" :control :mod-1 :shift) 'select-brother-spatial-move-down-take-current)

64
65
  (define-main-key ("Tab" :mod-1) 'select-next-child)
  (define-main-key ("Tab" :mod-1 :shift) 'select-previous-child)
66
  (define-main-key ("Tab" :mod-1 :control) 'select-next-subchild)
67
68
  (define-main-key ("Return" :mod-1) 'enter-frame)
  (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
72
73
74
  (define-main-key ("Page_Up" :mod-1) 'frame-select-previous-child)
  (define-main-key ("Page_Down" :mod-1) 'frame-select-next-child)
  (define-main-key ("Page_Up" :mod-1 :control) 'frame-lower-child)
  (define-main-key ("Page_Down" :mod-1 :control) 'frame-raise-child)
75
76
  (define-main-key ("Home" :mod-1) 'switch-to-root-frame)
  (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 ("Menu" :mod-5) 'expose-current-child-mode)
80
  (define-main-key ("F10" :mod-1) 'fast-layout-switch)
81
  (define-main-key ("F10" :shift :control) 'toggle-show-root-frame)
Philippe Brochard's avatar
Philippe Brochard committed
82
83
  (define-main-key ("F10") 'expose-windows-mode)
  (define-main-key ("F10" :control) 'expose-all-windows-mode)
84
85
86
  (define-main-key ("F12" :control) 'present-clfswm-terminal)
  (define-main-key ("F12" :shift) 'show-all-frames-info-key)
  (define-main-key ("F12" :shift :mod-1) 'show-all-frames-info)
87
  (define-main-key ("b" :mod-1) 'banish-pointer)
88
  ;; Escape
89
90
  (define-main-key ("Escape" :control) 'ask-close/kill-current-window)
  ;; Second mode
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  (define-main-key (#\t :mod-1) 'second-key-mode)
  (define-main-key ("less" :control) 'second-key-mode)
  ;; Bind or jump functions
  (define-main-key ("1" :mod-1) 'bind-or-jump 1)
  (define-main-key ("2" :mod-1) 'bind-or-jump 2)
  (define-main-key ("3" :mod-1) 'bind-or-jump 3)
  (define-main-key ("4" :mod-1) 'bind-or-jump 4)
  (define-main-key ("5" :mod-1) 'bind-or-jump 5)
  (define-main-key ("6" :mod-1) 'bind-or-jump 6)
  (define-main-key ("7" :mod-1) 'bind-or-jump 7)
  (define-main-key ("8" :mod-1) 'bind-or-jump 8)
  (define-main-key ("9" :mod-1) 'bind-or-jump 9)
  (define-main-key ("0" :mod-1) 'bind-or-jump 10))

(add-hook *binding-hook* 'set-default-main-keys)
Philippe Brochard's avatar
Philippe Brochard committed
106
107
108
109
110
111
112
113
114





;;; Mouse actions
(defun mouse-click-to-focus-and-move-window (window root-x root-y)
  "Move and focus the current child - Create a new frame on the root window"
  (declare (ignore window))
115
  (stop-button-event)
Philippe Brochard's avatar
Philippe Brochard committed
116
117
  (mouse-focus-move/resize-generic root-x root-y #'move-frame t))

118

Philippe Brochard's avatar
Philippe Brochard committed
119
120
121
(defun mouse-click-to-focus-and-resize-window (window root-x root-y)
  "Resize and focus the current child - Create a new frame on the root window"
  (declare (ignore window))
122
  (stop-button-event)
Philippe Brochard's avatar
Philippe Brochard committed
123
124
  (mouse-focus-move/resize-generic root-x root-y #'resize-frame t))

125

126
127
128
129
130
131
132
133
(defun mouse-click-to-focus-and-move-window-constrained (window root-x root-y)
  "Move (constrained by other frames) and focus the current child - Create a new frame on the root window"
  (declare (ignore window))
  (stop-button-event)
  (mouse-focus-move/resize-generic root-x root-y #'move-frame-constrained t))


(defun mouse-click-to-focus-and-resize-window-constrained (window root-x root-y)
134
  "Resize (constrained by other frames) and focus the current child - Create a new frame on the root window"
135
136
137
138
139
  (declare (ignore window))
  (stop-button-event)
  (mouse-focus-move/resize-generic root-x root-y #'resize-frame-constrained t))


140

141
142
143
144
145
146
(defun set-default-main-mouse ()
  (define-main-mouse (1) 'mouse-click-to-focus-and-move)
  (define-main-mouse (2) 'mouse-middle-click)
  (define-main-mouse (3) 'mouse-click-to-focus-and-resize)
  (define-main-mouse (1 :mod-1) 'mouse-click-to-focus-and-move-window)
  (define-main-mouse (3 :mod-1) 'mouse-click-to-focus-and-resize-window)
147
148
  (define-main-mouse (1 :mod-1 :shift) 'mouse-click-to-focus-and-move-window-constrained)
  (define-main-mouse (3 :mod-1 :shift) 'mouse-click-to-focus-and-resize-window-constrained)
149
  (define-main-mouse (1 :control :mod-1) 'mouse-move-child-over-frame)
150
151
152
  (define-main-mouse (4) 'mouse-select-next-level)
  (define-main-mouse (5) 'mouse-select-previous-level)
  (define-main-mouse (4 :mod-1) 'mouse-enter-frame)
153
154
155
156
157
  (define-main-mouse (5 :mod-1) 'mouse-leave-frame)
  (define-main-mouse (4 :mod-1 :control) 'dec-transparency)
  (define-main-mouse (5 :mod-1 :control) 'inc-transparency)
  (define-main-mouse (4 :mod-1 :control :shift) 'dec-transparency-slow)
  (define-main-mouse (5 :mod-1 :control :shift) 'inc-transparency-slow))
158
159

(add-hook *binding-hook* 'set-default-main-mouse)