root/clfswm/doc/dot-clfswmrc

Revision 191, 9.9 kB (checked in by pbrochard, 4 weeks ago)

TODO and configuration file update

Line 
1;;; -*- lisp -*-
2;;;
3;;; CLFSWM configuration file example
4;;;
5;;; Send me your configuration file at pbrochard _at_ common-lisp -dot- net
6;;; if you want to share it with others.
7
8(in-package :clfswm)
9
10
11
12;;;; Uncomment the line above if you need default modifiers (or not)
13;;(with-capslock)
14;;(with-numlock)
15;;(without-capslock)
16;;(without-cnumlock)
17
18;;;; Uncomment the line above if you want to enable the notify event compression.
19;;;; This variable may be useful to speed up some slow version of CLX
20;;;; It is particulary useful with CLISP/MIT-CLX.
21;; (setf *have-to-compress-notify* t)
22
23
24
25;;; -- Azerty configuration --
26;;; For the main mode
27;;(defun my-binding ()
28;;  (define-main-key ("twosuperior") 'banish-pointer)
29;;  (undefine-main-multi-keys (#\t :mod-1) (#\b :mod-1) (#\b :mod-1 :control))
30;;  (undefine-main-multi-keys ("1" :mod-1) ("2" :mod-1) ("3" :mod-1)
31;;                          ("4" :mod-1) ("5" :mod-1) ("6" :mod-1)
32;;                          ("7" :mod-1) ("8" :mod-1) ("9" :mod-1) ("0" :mod-1))
33;;  (define-main-key ("ampersand" :mod-1) 'bind-or-jump 1)
34;;  (define-main-key ("eacute" :mod-1) 'bind-or-jump 2)
35;;  (define-main-key ("quotedbl" :mod-1) 'bind-or-jump 3)
36;;  (define-main-key ("quoteright" :mod-1) 'bind-or-jump 4)
37;;  (define-main-key ("parenleft" :mod-1) 'bind-or-jump 5)
38;;  (define-main-key ("minus" :mod-1) 'bind-or-jump 6)
39;;  (define-main-key ("egrave" :mod-1) 'bind-or-jump 7)
40;;  (define-main-key ("underscore" :mod-1) 'bind-or-jump 8)
41;;  (define-main-key ("ccedilla" :mod-1) 'bind-or-jump 9)
42;;  (define-main-key ("agrave" :mod-1) 'bind-or-jump 10)
43;;  ;; For the second mode
44;;  (undefine-second-multi-keys ("1" :mod-1) ("2" :mod-1) ("3" :mod-1)
45;;                            ("4" :mod-1) ("5" :mod-1) ("6" :mod-1)
46;;                            ("7" :mod-1) ("8" :mod-1) ("9" :mod-1) ("0" :mod-1))
47;;  (define-second-key ("ampersand" :mod-1) 'bind-or-jump 1)
48;;  (define-second-key ("eacute" :mod-1) 'bind-or-jump 2)
49;;  (define-second-key ("quotedbl" :mod-1) 'bind-or-jump 3)
50;;  (define-second-key ("quoteright" :mod-1) 'bind-or-jump 4)
51;;  (define-second-key ("parenleft" :mod-1) 'bind-or-jump 5)
52;;  (define-second-key ("minus" :mod-1) 'bind-or-jump 6)
53;;  (define-second-key ("egrave" :mod-1) 'bind-or-jump 7)
54;;  (define-second-key ("underscore" :mod-1) 'bind-or-jump 8)
55;;  (define-second-key ("ccedilla" :mod-1) 'bind-or-jump 9)
56;;  (define-second-key ("agrave" :mod-1) 'bind-or-jump 10))
57;;
58;;(add-hook *binding-hook* 'my-binding)
59;;
60;;(dbg *binding-hook*)
61;;;;; -- Azerty configuration end --
62
63
64
65;;; Color configuration example
66;;;
67;;; See in package.lisp for all variables
68;;(setf *color-unselected* "Blue")
69
70
71;;; How to change the default fullscreen size
72;;(defun get-fullscreen-size ()
73;;  "Return the size of root child (values rx ry rw rh)
74;;You can tweak this to what you want"
75;;  (values -2 -2 (+ (xlib:screen-width *screen*) 2) (- (xlib:screen-height *screen*) 20)))
76
77
78;;; Contributed code example
79;;; See in the clfswm/contrib directory to find some contributed code
80;;; and se load-contrib to load them. For example:
81;;(load-contrib "contrib-example.lisp")
82
83
84
85;;; Binding example: Undefine Control-F1 and define  Control-F5 as a
86;;; new binding in main mode
87;;;
88;;; See bindings.lisp, bindings-second-mode.lisp and bindings-pager.lisp
89;;; for all default bindings definitions.
90;;(defun binding-example ()
91;;  (undefine-main-key ("F1" :mod-1))
92;;  (define-main-key ("F5" :mod-1) 'help-on-clfswm)
93;;  ;; Binding example for apwal
94;;  (define-second-key (#\Space)
95;;      (defun tpm-apwal ()
96;;      "Run Apwal"
97;;      (do-shell "exec apwal")
98;;      (show-all-windows-in-workspace (current-workspace))
99;;      (throw 'exit-second-loop nil))))
100;;
101;;(add-hook *binding-hook* 'binding-example)
102
103
104
105;;; Hook example
106;;;
107;;; See in package.lisp and clfswm.lisp, clfswm-second-mode.lisp
108;;; for hook examples
109;;(setf *key-press-hook* (list (lambda (&rest args) ; function 1
110;;                             (format t "Keyp press (before): ~A~%" args)
111;;                             (force-output))
112;;                           #'handle-key-press ; function 2 (default)
113;;                           (lambda (&rest args) ; function 3
114;;                             (declare (ignore args))
115;;                             (format t "Keyp press (after)~%")
116;;                             (force-output))))
117
118
119
120
121;;; A more complex example I use to record my desktop and show
122;;; documentation associated to each key press.
123;;(defun display-osd (formatter &rest args)
124;;  (do-shell "pkill osd_cat")
125;;  (do-shell (format nil "echo ~A | osd_cat -d 3 -p bottom -o -60 -f -*-fixed-*-*-*-*-16-*-*-*-*-*-*-1"
126;;                  (apply #'format nil formatter args)))
127;;  (force-output))
128;;
129;;(defun documentation-key-from-code (hash-key code state)
130;;  (documentation (first (find-key-from-code hash-key code state)) 'function))
131;;
132;;
133;;(defun key-string (hash-key code state)
134;;  (let* ((modifiers (xlib:make-state-keys state))
135;;       (keysym (keysym->keysym-name (xlib:keycode->keysym *display* code 0)))
136;;       (doc (documentation-key-from-code hash-key code state)))
137;;    (values (format nil "~:(~{~A+~}~A~) : ~S" modifiers keysym doc)
138;;          doc)))
139;;
140;;(defun display-doc (hash-key code state)
141;;  (multiple-value-bind (str doc)
142;;      (key-string hash-key code state)
143;;    (when doc
144;;      (display-osd "~A" str))))
145;;
146;;(defun display-key-osd-main (&rest event-slots &key code state &allow-other-keys)
147;;  (declare (ignore event-slots))
148;;  (display-doc *main-keys* code state))
149;;
150;;(defun display-key-osd-second (&rest event-slots &key code state &allow-other-keys)
151;;  (declare (ignore event-slots))
152;;  (display-doc *second-keys* code state))
153;;
154;;;; Define new hook or add to precedent one
155;;(if (consp *key-press-hook*)
156;;    (push #'display-key-osd-main *key-press-hook*)
157;;    (setf *key-press-hook* (list #'display-key-osd-main #'handle-key-press)))
158;;(setf *sm-key-press-hook* (list #'display-key-osd-second #'sm-handle-key-press))
159;;
160;;
161;;;;; Display menu functions
162;;(defun open-menu (&optional (menu *menu*))
163;;  "Open the main menu"
164;;  (let ((info-list nil)
165;;      (action nil))
166;;    (dolist (item (menu-item menu))
167;;      (let ((value (menu-item-value item)))
168;;      (push (typecase value
169;;              (menu (list (list (format nil "~A" (menu-item-key item)) *menu-color-menu-key*)
170;;                          (list (format nil ": < ~A >" (menu-doc value)) *menu-color-submenu*)))
171;;              (string (list (list (format nil "~A" (menu-item-value item)) *menu-color-comment*)))
172;;              (t (list (list (format nil "~A" (menu-item-key item)) *menu-color-key*)
173;;                       (format nil ": ~A" (documentation value 'function)))))
174;;            info-list)
175;;      (when (menu-item-key item)
176;;        (define-info-key-fun (list (menu-item-key item) 0)
177;;            (lambda (&optional args)
178;;              (declare (ignore args))
179;;              (setf action value)
180;;              (throw 'exit-info-loop nil))))))
181;;    (info-mode (nreverse info-list))
182;;    (dolist (item (menu-item menu))
183;;      (undefine-info-key-fun (list (menu-item-key item) 0)))
184;;    (typecase action
185;;      (menu
186;;       (display-osd "Open Menu: ~A" (menu-doc action)) ;; <- Display here
187;;       (open-menu action))
188;;      (t (when (fboundp action)
189;;         (display-osd "~A" (documentation action 'function)) ;; <- Display here
190;;         (funcall action))))))
191;;
192;;
193;;
194;;(defun get-fullscreen-size ()
195;;  "Return the size of root child (values rx ry rw rh)
196;;You can tweak this to what you want"
197;;  (values -2 -2 (+ (xlib:screen-width *screen*) 2) (- (xlib:screen-height *screen*) 20)))
198;;
199;;;;; -- Doc example end --
200
201
202;;;;; Init hook examples:
203;;(defun my-init-hook-1 ()
204;;  (dbg 'my-init-hook)
205;;  ;;(add-frame (create-frame :name "Default" :layout #'tile-left-layout :data (list '(:tile-size 0.6))) *root-frame*)
206;;  (add-frame (create-frame :name "The Gimp" :x 0.6 :y 0 :w 0.3 :h 0.2) *root-frame*)
207;;  (add-frame (create-frame :name "Net" :x 0.52 :y 0.3 :w 0.4 :h 0.3) *root-frame*)
208;;  (add-frame (create-frame :x 0.4 :y 0 :w 0.2 :h 0.3) (first (frame-child *root-frame*)))
209;;  (add-frame (create-frame :x 0.6 :y 0.4 :w 0.4 :h 0.2) (first (frame-child *root-frame*)))
210;;  (add-frame (create-frame :x 0.4 :y 0.7 :w 0.2 :h 0.3) (first (frame-child *root-frame*)))
211;;  (let ((frame (create-frame :name "The Qiv" :x 0 :y 0.4 :w 0.4 :h 0.2)))
212;;    (add-frame frame (first (frame-child *root-frame*)))
213;;    (add-frame (create-frame) frame))
214;;  (add-frame (create-frame :x 0.1 :y 0.55 :w 0.8 :h 0.43) *root-frame*)
215;;  (add-frame (create-frame :x 0.2 :y 0.1 :w 0.6 :h 0.4) (first (frame-child *root-frame*)))
216;;  (add-frame (create-frame :x 0.3 :y 0.55 :w 0.4 :h 0.3) (first (frame-child *root-frame*)))
217;;  (add-frame (create-frame :x 0.1 :y 0.1 :w 0.3 :h 0.6) (first (frame-child (first (frame-child *root-frame*)))))
218;;  (setf *current-child* (first (frame-child *current-root*)))
219;;  (setf (frame-layout *current-child*) #'tile-layout))
220;;
221;;(defun my-init-hook-2 ()
222;;  (dbg 'my-init-hook)
223;;  (add-frame (create-frame :name "Default" :layout #'tile-left-layout :data (list '(:tile-size 0.6))) *root-frame*)
224;;  (setf *current-child* (first (frame-child *current-root*)))
225;;  (setf (frame-layout *current-child*) #'tile-layout))
226;;
227;;
228;;(defun my-init-hook-3 ()
229;;  (dbg 'my-init-hook)
230;;  (add-frame (create-frame :name "plop" :x 0.1 :y 0.4 :w 0.7 :h 0.3) *root-frame*)
231;;  (add-frame (create-frame :name "Default" :layout nil :x 0.1 :y 0.5 :w 0.8 :h 0.5)
232;;           *root-frame*)
233;;  (setf *current-child* (first (frame-child *current-root*)))
234;;  (setf (frame-layout *root-frame*) nil))
235;;
236;;
237;;
238;;(defun my-init-hook-4 ()
239;;  (let ((frame (add-frame (create-frame :name "Default"
240;;                                        :layout #'tile-left-layout
241;;                                      :x 0.05 :y 0.05 :w 0.9 :h 0.9)
242;;                        *root-frame*)))
243;;    (setf *current-child* frame)))
244;;
245;;
246;;;;; Use this hook and prevent yourself to create a new frame to emulate
247;;;;; the MS Windows desktop style :)
248;;(defun my-init-hook-ms-windows-style ()
249;;  (setf (frame-managed-type *root-frame*) nil))
250;;
251;;
252;;;;; Here is another example useful with the ROX filer: Only the
253;;;;; root frame fullscreen with some space on the left for icons.
254;;(defun my-init-hook-rox-filer ()
255;;  (setf (frame-layout *root-frame*) #'tile-left-space-layout
256;;      (frame-data-slot *root-frame* :tile-size) 0.9))
257;;
258;;
259;;
260;;
261;;(setf *init-hook* #'my-init-hook-4)  ;; <- choose one in 1 to 4
262;;;;(setf *init-hook* nil)
263;;;;; Init hook end
Note: See TracBrowser for help on using the browser.