src/clfswm-configuration.lisp (create-configuration-menu): Change the config system...
[clfswm.git] / src / package.lisp
blob4f869b94824d880aa35c53acfce15c9a890c8167
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Package definition
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2010 Philippe Brochard <hocwp@free.fr>
9 ;;;
10 ;;; This program is free software; you can redistribute it and/or modify
11 ;;; it under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or
13 ;;; (at your option) any later version.
14 ;;;
15 ;;; This program is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with this program; if not, write to the Free Software
22 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 ;;;
24 ;;; --------------------------------------------------------------------------
26 (in-package :cl-user)
28 (defpackage clfswm
29 (:use :common-lisp :my-html :tools :version)
30 ;; (:shadow :defun)
31 (:export :main
32 :reload-clfswm
33 :reset-clfswm
34 :exit-clfswm))
38 (in-package :clfswm)
40 ;;; CONFIG - Compress motion notify ?
41 ;; This variable may be useful to speed up some slow version of CLX.
42 ;; It is particulary useful with CLISP/MIT-CLX (and others).
43 (defconfig *have-to-compress-notify* t nil
44 "Compress event notify?
45 This variable may be useful to speed up some slow version of CLX.
46 It is particulary useful with CLISP/MIT-CLX.")
48 (defparameter *modifier-alias* '((:alt :mod-1) (:alt-l :mod-1)
49 (:numlock :mod-2)
50 (:super_l :mod-4)
51 (:alt-r :mod-5) (:alt-gr :mod-5)
52 (:capslock :lock))
53 "Syntax: (modifier-alias effective-modifier)")
56 (defparameter *display* nil)
57 (defparameter *screen* nil)
58 (defparameter *root* nil)
59 (defparameter *no-focus-window* nil)
61 (defconfig *loop-timeout* 0.1 nil
62 "Maximum time (in seconds) to wait before calling *loop-hook*")
64 (defparameter *pixmap-buffer* nil)
66 (defparameter *contrib-dir* "")
68 (defparameter *default-font* nil)
69 ;;(defparameter *default-font-string* "9x15")
70 (defconfig *default-font-string* "fixed" nil
71 "The default font used in clfswm")
73 (defconfig *color-move-window* "DeepPink" 'Main-mode
74 "Color when moving or resizing a windows")
76 (defparameter *child-selection* nil)
78 ;;; CONFIG - Default frame datas
79 (defconfig *default-frame-data*
80 (list '(:tile-size 0.8) '(:tile-space-size 0.1)
81 '(:fast-layout (tile-left-layout tile-layout))
82 '(:main-layout-windows nil))
83 nil
84 "Default slots set in frame date")
87 ;;; CONFIG - Default managed window type for a frame
88 ;;; type can be :all, :normal, :transient, :maxsize, :desktop, :dock, :toolbar, :menu, :utility, :splash, :dialog
89 (defconfig *default-managed-type* '(:normal) nil
90 "Default managed window types")
91 ;;(defparameter *default-managed-type* '(:normal :maxsize :transient))
92 ;;(defparameter *default-managed-type* '(:normal :transient :maxsize :desktop :dock :toolbar :menu :utility :splash :dialog))
93 ;;(defparameter *default-managed-type* '())
94 ;;(defparameter *default-managed-type* '(:all))
97 ;;; CONFIG - Default focus policy
98 (defconfig *default-focus-policy* :click nil
99 "Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select.")
102 (defclass frame ()
103 ((name :initarg :name :accessor frame-name :initform nil)
104 (number :initarg :number :accessor frame-number :initform 0)
105 ;;; Float size between 0 and 1 - Manipulate only this variable and not real size
106 (x :initarg :x :accessor frame-x :initform 0.1)
107 (y :initarg :y :accessor frame-y :initform 0.1)
108 (w :initarg :w :accessor frame-w :initform 0.8)
109 (h :initarg :h :accessor frame-h :initform 0.8)
110 ;;; Real size (integer) in screen size - Don't set directly this variables
111 ;;; they may be recalculated by the layout manager.
112 (rx :initarg :rx :accessor frame-rx :initform 0)
113 (ry :initarg :ry :accessor frame-ry :initform 0)
114 (rw :initarg :rw :accessor frame-rw :initform 800)
115 (rh :initarg :rh :accessor frame-rh :initform 600)
116 (layout :initarg :layout :accessor frame-layout :initform nil
117 :documentation "Layout to display windows on a frame")
118 (nw-hook :initarg :nw-hook :accessor frame-nw-hook :initform nil
119 :documentation "Hook done by the frame when a new window is mapped")
120 (managed-type :initarg :managed-type :accessor frame-managed-type
121 :initform *default-managed-type*
122 :documentation "Managed window type")
123 (forced-managed-window :initarg :forced-managed-window
124 :accessor frame-forced-managed-window
125 :initform nil
126 :documentation "A list of forced managed windows (wm-name or window)")
127 (forced-unmanaged-window :initarg :forced-unmanaged-window
128 :accessor frame-forced-unmanaged-window
129 :initform nil
130 :documentation "A list of forced unmanaged windows (wm-name or window)")
131 (show-window-p :initarg :show-window-p :accessor frame-show-window-p :initform t)
132 (hidden-children :initarg :hidden-children :accessor frame-hidden-children :initform nil
133 :documentation "A list of hidden children")
134 (selected-pos :initarg :selected-pos :accessor frame-selected-pos :initform 0
135 :documentation "The position in the child list of the selected child")
136 (focus-policy :initarg :focus-ploicy :accessor frame-focus-policy
137 :initform *default-focus-policy*)
138 (window :initarg :window :accessor frame-window :initform nil)
139 (gc :initarg :gc :accessor frame-gc :initform nil)
140 (child :initarg :child :accessor frame-child :initform nil)
141 (data :initarg :data :accessor frame-data
142 :initform *default-frame-data*
143 :documentation "An assoc list to store additional data")))
147 (defparameter *root-frame* nil
148 "Root of the root - ie the root frame")
149 (defparameter *current-root* nil
150 "The current fullscreen maximized child")
151 (defparameter *current-child* nil
152 "The current child with the focus")
154 (defparameter *show-root-frame-p* nil)
157 (defparameter *main-keys* nil)
158 (defparameter *main-mouse* nil)
159 (defparameter *second-keys* nil)
160 (defparameter *second-mouse* nil)
161 (defparameter *info-keys* nil)
162 (defparameter *info-mouse* nil)
163 (defparameter *query-keys* nil)
164 (defparameter *circulate-keys* nil)
165 (defparameter *circulate-keys-release* nil)
166 (defparameter *expose-keys* nil)
167 (defparameter *expose-mouse* nil)
170 (defparameter *other-window-manager* nil)
173 (defstruct menu name item doc)
174 (defstruct menu-item key value)
177 (defparameter *menu* (make-menu :name 'main :doc "Main menu"))
182 (defconfig *binding-hook* nil 'Hook
183 "Hook executed when keys/buttons are bounds")
185 (defconfig *loop-hook* nil 'Hook
186 "Hook executed on each event loop")
188 (defconfig *main-entrance-hook* nil 'Hook
189 "Hook executed on the main function entrance after
190 loading configuration file and before opening the display.")
193 (defparameter *in-second-mode* nil)
196 ;;; Placement variables. A list of two absolute coordinates
197 ;;; or a function: 'Y-X-placement' for absolute placement or
198 ;;; 'Y-X-child-placement' for child relative placement.
199 ;;; Where Y-X are one of:
201 ;;; top-left top-middle top-right
202 ;;; middle-left middle-middle middle-right
203 ;;; bottom-left bottom-middle bottom-right
205 (defconfig *banish-pointer-placement* 'bottom-right-placement
206 'Placement "Pointer banishment placement")
207 (defconfig *second-mode-placement* 'top-middle-placement
208 'Placement "Second mode window placement")
209 (defconfig *info-mode-placement* 'top-left-placement
210 'Placement "Info mode window placement")
211 (defconfig *query-mode-placement* 'top-left-placement
212 'Placement "Query mode window placement")
213 (defconfig *circulate-mode-placement* 'bottom-middle-placement
214 'Placement "Circulate mode window placement")
215 (defconfig *expose-mode-placement* 'top-left-child-placement
216 'Placement "Expose mode window placement (Selection keys position)")
217 (defconfig *notify-window-placement* 'bottom-right-placement
218 'Placement "Notify window placement")
222 (defparameter *in-process-existing-windows* nil)
224 ;; For debug - redefine defun
225 ;;(shadow :defun)
227 ;;(defmacro defun (name args &body body)
228 ;; `(progn
229 ;; (format t "defun: ~A ~A~%" ',name ',args)
230 ;; (force-output)
231 ;; (cl:defun ,name ,args
232 ;; (handler-case
233 ;; (progn
234 ;; ,@body)
235 ;; (error (c)
236 ;; (format t "New defun: Error in ~A : ~A~%" ',name c)
237 ;; (format t "Root tree=~A~%All windows=~A~%"
238 ;; (xlib:query-tree *root*) (get-all-windows))
239 ;; (force-output))))))