From pbrochard at common-lisp.net Mon Sep 1 21:05:29 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Mon, 1 Sep 2008 17:05:29 -0400 (EDT) Subject: [clfswm-cvs] r156 - in clfswm: . src Message-ID: <20080901210529.BDC53120AB@common-lisp.net> Author: pbrochard Date: Mon Sep 1 17:05:29 2008 New Revision: 156 Modified: clfswm/ChangeLog clfswm/src/clfswm-layout.lisp Log: src/clfswm-layout.lisp (set-gimp-layout): Change the layout to main-window-right-layout. Change the keybinding for (shift)alt+tab to not select windows in the main window lisst. Bind F8 to add a window in the main window list. Bind F9 to remove a window in the main window list. Change the focus policy to :sloppy. (set-previous-layout): Restore the previous layout, keybinding and focus policy. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Mon Sep 1 17:05:29 2008 @@ -1,3 +1,14 @@ +2008-09-01 Philippe Brochard + + * src/clfswm-layout.lisp (set-gimp-layout): Change the layout to + main-window-right-layout. Change the keybinding for (shift)alt+tab + to not select windows in the main window lisst. + Bind F8 to add a window in the main window list. + Bind F9 to remove a window in the main window list. + Change the focus policy to :sloppy. + (set-previous-layout): Restore the previous layout, keybinding and + focus policy. + 2008-08-31 Philippe Brochard * src/clfswm-menu.lisp (add-menu-comment): Add comments in menu. Modified: clfswm/src/clfswm-layout.lisp ============================================================================== --- clfswm/src/clfswm-layout.lisp (original) +++ clfswm/src/clfswm-layout.lisp Mon Sep 1 17:05:29 2008 @@ -545,8 +545,76 @@ (setf (frame-data-slot *current-child* :main-window-list) nil)) (leave-second-mode)) -(register-layout-sub-menu 'frame-main-window-layout-menu "Main window layout menu" - '(("r" set-main-window-right-layout) + + + + + + + +(defun select-next/previous-child-no-main-window (fun-rotate) + "Select the next/previous child - Skip windows in main window list" + (when (frame-p *current-child*) + (with-slots (child) *current-child* + (let* ((main-windows (frame-data-slot *current-child* :main-window-list)) + (to-skip? (not (= (length main-windows) + (length child))))) + (labels ((rec () + (setf child (funcall fun-rotate child)) + (when (and to-skip? + (member (frame-selected-child *current-child*) main-windows)) + (rec)))) + (unselect-all-frames) + (rec) + (show-all-children)))))) + + +(defun select-next-child-no-main-window () + "Select the next child - Skip windows in main window list" + (select-next/previous-child-no-main-window #'rotate-list)) + +(defun select-previous-child-no-main-window () + "Select the previous child - Skip windows in main window list" + (select-next/previous-child-no-main-window #'anti-rotate-list)) + + + +(defun set-gimp-layout () + "A GIMP Layout: Mod-1+F8 to add define a main window. Mod-1+F9 to undefine it" + (when (frame-p *current-child*) + (define-main-key ("F8" :mod-1) 'add-in-main-window-list) + (define-main-key ("F9" :mod-1) 'remove-in-main-window-list) + (define-main-key ("Tab" :mod-1) 'select-next-child-no-main-window) + (define-main-key ("Tab" :mod-1 :shift) 'select-previous-child-no-main-window) + (setf (frame-data-slot *current-child* :focus-policy-save) + (frame-focus-policy *current-child*)) + (setf (frame-focus-policy *current-child*) :sloppy) + (setf (frame-data-slot *current-child* :layout-save) + (frame-layout *current-child*)) + (set-main-window-right-layout))) + + +(defun set-previous-layout () + "Restore the previous layout" + (undefine-main-key ("F8" :mod-1)) + (undefine-main-key ("F9" :mod-1)) + (define-main-key ("Tab" :mod-1) 'select-next-child) + (define-main-key ("Tab" :mod-1 :shift) 'select-previous-child) + (setf (frame-focus-policy *current-child*) + (frame-data-slot *current-child* :focus-policy-save)) + (setf (frame-layout *current-child*) + (frame-data-slot *current-child* :layout-save)) + (leave-second-mode)) + + + + +(register-layout-sub-menu 'frame-main-window-layout-menu "Main window layout menu (GIMP layout)" + '("-=- GIMP Layout -=-" + ("g" set-gimp-layout) + ("p" set-previous-layout) + "-=- Main window layout -=-" + ("r" set-main-window-right-layout) ("l" set-main-window-left-layout) ("t" set-main-window-top-layout) ("b" set-main-window-bottom-layout) @@ -554,3 +622,5 @@ ("a" add-in-main-window-list) ("v" remove-in-main-window-list) ("c" clear-main-window-list))) + + From pbrochard at common-lisp.net Tue Sep 2 13:45:08 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Tue, 2 Sep 2008 09:45:08 -0400 (EDT) Subject: [clfswm-cvs] r157 - in clfswm: . src Message-ID: <20080902134508.AEEF95C18E@common-lisp.net> Author: pbrochard Date: Tue Sep 2 09:45:05 2008 New Revision: 157 Modified: clfswm/ChangeLog clfswm/TODO clfswm/src/clfswm-layout.lisp clfswm/src/clfswm-second-mode.lisp clfswm/src/clfswm.lisp clfswm/src/package.lisp Log: Add a specific GIMP layout menu. (help-on-gimp-layout): Describe how to use the GIMP layout. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Tue Sep 2 09:45:05 2008 @@ -1,3 +1,8 @@ +2008-09-02 Philippe Brochard + + * src/clfswm-layout.lisp: Add a specific GIMP layout menu. + (help-on-gimp-layout): Describe how to use the GIMP layout. + 2008-09-01 Philippe Brochard * src/clfswm-layout.lisp (set-gimp-layout): Change the layout to Modified: clfswm/TODO ============================================================================== --- clfswm/TODO (original) +++ clfswm/TODO Tue Sep 2 09:45:05 2008 @@ -7,9 +7,15 @@ =============== Should handle these soon. -- A Gimp layout example (a main window and all others on the left) [Philippe] - + Alt-Tab cycle only on non-main windows - + Focus policy to sloppy focus. +- From stumpwm: [Philippe] + "In other news stumpwm should catch unhandled errors, restart, and + print an error message. And there is now a soft-restart command. With + this in place I suspect you will need to restart stumpwm very rarely + and it won't spontaneously bring down X." + => Reset all -> place clfswm in its starting state. + +- Sloppy focus strict -> focus windows only in the current frame + Sloppy select -> select frame on mouse enter. - Hook to open next window in named/numbered frame [Philippe] @@ -29,13 +35,6 @@ - cd/pwd a la shell to navigate throw frames. [Philippe] -- From stumpwm: [Philippe] - "In other news stumpwm should catch unhandled errors, restart, and - print an error message. And there is now a soft-restart command. With - this in place I suspect you will need to restart stumpwm very rarely - and it won't spontaneously bring down X." - => Reset all -> place clfswm in its starting state. - - Zoom Modified: clfswm/src/clfswm-layout.lisp ============================================================================== --- clfswm/src/clfswm-layout.lisp (original) +++ clfswm/src/clfswm-layout.lisp Tue Sep 2 09:45:05 2008 @@ -548,7 +548,15 @@ - +(register-layout-sub-menu 'frame-main-window-layout-menu "Main window layout menu" + '(("r" set-main-window-right-layout) + ("l" set-main-window-left-layout) + ("t" set-main-window-top-layout) + ("b" set-main-window-bottom-layout) + "-=- Actions on main windows list -=-" + ("a" add-in-main-window-list) + ("v" remove-in-main-window-list) + ("c" clear-main-window-list))) @@ -578,19 +586,34 @@ (select-next/previous-child-no-main-window #'anti-rotate-list)) +(defun mouse-click-to-focus-and-move-no-main-window (window root-x root-y) + "Move and focus the current frame or focus the current window parent. +Or do actions on corners - Skip windows in main window list" + (unless (do-corner-action root-x root-y *corner-main-mode-left-button*) + (if (and (frame-p *current-child*) + (member window (frame-data-slot *current-child* :main-window-list))) + (replay-button-event) + (mouse-click-to-focus-generic window root-x root-y #'move-frame)))) + + (defun set-gimp-layout () - "A GIMP Layout: Mod-1+F8 to add define a main window. Mod-1+F9 to undefine it" + "The GIMP Layout" (when (frame-p *current-child*) + ;; Note: There is no need to ungrab/grab keys because this + ;; is done when leaving the second mode. (define-main-key ("F8" :mod-1) 'add-in-main-window-list) (define-main-key ("F9" :mod-1) 'remove-in-main-window-list) + (define-main-key ("F10" :mod-1) 'clear-main-window-list) (define-main-key ("Tab" :mod-1) 'select-next-child-no-main-window) (define-main-key ("Tab" :mod-1 :shift) 'select-previous-child-no-main-window) + (define-main-mouse (1) 'mouse-click-to-focus-and-move-no-main-window) (setf (frame-data-slot *current-child* :focus-policy-save) (frame-focus-policy *current-child*)) (setf (frame-focus-policy *current-child*) :sloppy) (setf (frame-data-slot *current-child* :layout-save) (frame-layout *current-child*)) + ;; Set the default layout and leave the second mode. (set-main-window-right-layout))) @@ -598,8 +621,10 @@ "Restore the previous layout" (undefine-main-key ("F8" :mod-1)) (undefine-main-key ("F9" :mod-1)) + (undefine-main-key ("F10" :mod-1)) (define-main-key ("Tab" :mod-1) 'select-next-child) (define-main-key ("Tab" :mod-1 :shift) 'select-previous-child) + (define-main-mouse (1) 'mouse-click-to-focus-and-move) (setf (frame-focus-policy *current-child*) (frame-data-slot *current-child* :focus-policy-save)) (setf (frame-layout *current-child*) @@ -607,12 +632,27 @@ (leave-second-mode)) +(defun help-on-gimp-layout () + "Help on the GIMP layout" + (info-mode `(("-=- Help on The GIMP layout -=-" ,*info-color-title*) + "" + "The GIMP layout is a main-window-layout with a sloppy focus policy." + "You can change the main windows direction with the layout menu." + "" + "Press Alt+F8 to add a window to the main windows list." + "Press Alt+F9 to remove a window from the main windows list." + "Press Alt+F10 to clear the main windows list." + "" + "You can select a main window with the right mouse button." + "" + "Use the layout menu to restore the previous layout and keybinding.")) + (leave-second-mode)) -(register-layout-sub-menu 'frame-main-window-layout-menu "Main window layout menu (GIMP layout)" - '("-=- GIMP Layout -=-" - ("g" set-gimp-layout) +(register-layout-sub-menu 'frame-gimp-layout-menu "The GIMP layout menu" + '(("g" set-gimp-layout) ("p" set-previous-layout) + ("h" help-on-gimp-layout) "-=- Main window layout -=-" ("r" set-main-window-right-layout) ("l" set-main-window-left-layout) Modified: clfswm/src/clfswm-second-mode.lisp ============================================================================== --- clfswm/src/clfswm-second-mode.lisp (original) +++ clfswm/src/clfswm-second-mode.lisp Tue Sep 2 09:45:05 2008 @@ -25,8 +25,6 @@ (in-package :clfswm) -(defparameter *in-second-mode* nil) - (defparameter *sm-window* nil) (defparameter *sm-font* nil) (defparameter *sm-gc* nil) Modified: clfswm/src/clfswm.lisp ============================================================================== --- clfswm/src/clfswm.lisp (original) +++ clfswm/src/clfswm.lisp Tue Sep 2 09:45:05 2008 @@ -214,7 +214,8 @@ *pixmap-buffer* (xlib:create-pixmap :width (xlib:screen-width *screen*) :height (xlib:screen-height *screen*) :depth (xlib:screen-root-depth *screen*) - :drawable *root*)) + :drawable *root*) + *in-second-mode* nil) (xgrab-init-pointer) (xgrab-init-keyboard) (init-last-child) Modified: clfswm/src/package.lisp ============================================================================== --- clfswm/src/package.lisp (original) +++ clfswm/src/package.lisp Tue Sep 2 09:45:05 2008 @@ -220,6 +220,7 @@ "Config(Hook group):") +(defparameter *in-second-mode* nil) ;; For debug - redefine defun ;;(shadow :defun) From pbrochard at common-lisp.net Tue Sep 2 20:40:36 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Tue, 2 Sep 2008 16:40:36 -0400 (EDT) Subject: [clfswm-cvs] r158 - in clfswm: . doc src Message-ID: <20080902204036.0584C120A6@common-lisp.net> Author: pbrochard Date: Tue Sep 2 16:40:35 2008 New Revision: 158 Modified: clfswm/ChangeLog clfswm/TODO clfswm/doc/keys.html clfswm/doc/keys.txt clfswm/doc/menu.html clfswm/doc/menu.txt clfswm/src/bindings-second-mode.lisp clfswm/src/bindings.lisp clfswm/src/clfswm-corner.lisp clfswm/src/clfswm-menu.lisp clfswm/src/clfswm-util.lisp clfswm/src/clfswm.lisp clfswm/src/menu-def.lisp clfswm/src/package.lisp Log: main, main-unprotected: Handle error in a superior main function. Now CLFSWM can't break the X session. It just reinitialize the display and run a new main loop. reload-clfswm: New function to reload CLFSWM. Rename quit-clfswm to exit-clfswm. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Tue Sep 2 16:40:35 2008 @@ -1,5 +1,18 @@ 2008-09-02 Philippe Brochard + * src/clfswm-menu.lisp (init-menu): New function. + + * src/clfswm-util.lisp (reload-clfswm): New function to reload + CLFSWM. + (exit-clfswm): Rename quit-clfswm to exit-clfswm. + + * src/clfswm.lisp (main, main-unprotected): Handle error in a + superior main function. Now CLFSWM can't break the X session. It + just reinitialize the display and run a new main loop. + + * src/clfswm-corner.lisp: Make *clfswm-terminal* and + *vt-keyboard-on* global to avoid warnings when loading clfswm. + * src/clfswm-layout.lisp: Add a specific GIMP layout menu. (help-on-gimp-layout): Describe how to use the GIMP layout. Modified: clfswm/TODO ============================================================================== --- clfswm/TODO (original) +++ clfswm/TODO Tue Sep 2 16:40:35 2008 @@ -7,13 +7,6 @@ =============== Should handle these soon. -- From stumpwm: [Philippe] - "In other news stumpwm should catch unhandled errors, restart, and - print an error message. And there is now a soft-restart command. With - this in place I suspect you will need to restart stumpwm very rarely - and it won't spontaneously bring down X." - => Reset all -> place clfswm in its starting state. - - Sloppy focus strict -> focus windows only in the current frame Sloppy select -> select frame on mouse enter. @@ -35,7 +28,6 @@ - cd/pwd a la shell to navigate throw frames. [Philippe] - - Zoom Concept: Modified: clfswm/doc/keys.html ============================================================================== --- clfswm/doc/keys.html (original) +++ clfswm/doc/keys.html Tue Sep 2 16:40:35 2008 @@ -49,7 +49,7 @@ Home - Quit clfswm + Exit clfswm @@ -758,7 +758,7 @@ Home - Quit clfswm + Exit clfswm Modified: clfswm/doc/keys.txt ============================================================================== --- clfswm/doc/keys.txt (original) +++ clfswm/doc/keys.txt Tue Sep 2 16:40:35 2008 @@ -7,7 +7,7 @@ -------------- Mod-1 F1 Open the help and info window - Mod-1 Control Shift Home Quit clfswm + Mod-1 Control Shift Home Exit clfswm Mod-1 Right Select the next sister frame Mod-1 Left Select the previous sister frame Mod-1 Down Select the previous level in frame @@ -80,7 +80,7 @@ Return Leave second mode Escape Leave second mode T Tile with spaces the current frame - Mod-1 Control Shift Home Quit clfswm + Mod-1 Control Shift Home Exit clfswm Mod-1 Right Select the next sister frame Mod-1 Left Select the previous sister frame Mod-1 Down Select the previous level in frame Modified: clfswm/doc/menu.html ============================================================================== --- clfswm/doc/menu.html (original) +++ clfswm/doc/menu.html Tue Sep 2 16:40:35 2008 @@ -38,6 +38,9 @@

y: < Utility menu >

+

+ *: < CLFSWM menu > +


Child-Menu @@ -126,6 +129,9 @@

f: < Main window layout menu >

+

+ g: < The GIMP layout menu > +


Frame-Fast-Layout-Menu @@ -202,6 +208,46 @@


+ Frame-Gimp-Layout-Menu +

+

+ g: The GIMP Layout +

+

+ p: Restore the previous layout +

+

+ h: Help on the GIMP layout +

+

+ -=- Main window layout -=- +

+

+ r: Main window right: Main windows on the right. Others on the left. +

+

+ l: Main window left: Main windows on the left. Others on the right. +

+

+ t: Main window top: Main windows on the top. Others on the bottom. +

+

+ b: Main window bottom: Main windows on the bottom. Others on the top. +

+

+ -=- Actions on main windows list -=- +

+

+ a: Add the current window in the main window list +

+

+ v: Remove the current window from the main window list +

+

+ c: Clear the main window list +

+
+

Frame-Nw-Hook-Menu

@@ -451,6 +497,16 @@ exclam: Run a program from the query input


+

+ Clfswm-Menu +

+

+ r: Reload clfswm +

+

+ x: Exit clfswm +

+

This documentation was produced with the CLFSWM auto-doc functions. To reproduce it, use the produce-menu-doc-html-in-file or Modified: clfswm/doc/menu.txt ============================================================================== --- clfswm/doc/menu.txt (original) +++ clfswm/doc/menu.txt Tue Sep 2 16:40:35 2008 @@ -9,6 +9,7 @@ n: < Action by name menu > u: < Action by number menu > y: < Utility menu > +*: < CLFSWM menu > Child-Menu r: Rename the current child @@ -41,6 +42,7 @@ d: < Tile in one direction layout menu > e: < Tile with some space on one side menu > f: < Main window layout menu > +g: < The GIMP layout menu > Frame-Fast-Layout-Menu s: Switch between two layouts @@ -70,6 +72,20 @@ v: Remove the current window from the main window list c: Clear the main window list +Frame-Gimp-Layout-Menu +g: The GIMP Layout +p: Restore the previous layout +h: Help on the GIMP layout +-=- Main window layout -=- +r: Main window right: Main windows on the right. Others on the left. +l: Main window left: Main windows on the left. Others on the right. +t: Main window top: Main windows on the top. Others on the bottom. +b: Main window bottom: Main windows on the bottom. Others on the top. +-=- Actions on main windows list -=- +a: Add the current window in the main window list +v: Remove the current window from the main window list +c: Clear the main window list + Frame-Nw-Hook-Menu a: Open the next window in the current frame b: Open the next window in the current root @@ -162,6 +178,10 @@ colon: Eval a lisp form from the query input exclam: Run a program from the query input +Clfswm-Menu +r: Reload clfswm +x: Exit clfswm + This documentation was produced with the CLFSWM auto-doc functions. To reproduce it, use the produce-menu-doc-in-file or the produce-all-docs function from the Lisp REPL. Modified: clfswm/src/bindings-second-mode.lisp ============================================================================== --- clfswm/src/bindings-second-mode.lisp (original) +++ clfswm/src/bindings-second-mode.lisp Tue Sep 2 16:40:35 2008 @@ -100,7 +100,7 @@ (define-second-key ("t") 'tile-space-current-frame) -(define-second-key ("Home" :mod-1 :control :shift) 'quit-clfswm) +(define-second-key ("Home" :mod-1 :control :shift) 'exit-clfswm) (define-second-key ("Right" :mod-1) 'select-next-sister) (define-second-key ("Left" :mod-1) 'select-previous-sister) Modified: clfswm/src/bindings.lisp ============================================================================== --- clfswm/src/bindings.lisp (original) +++ clfswm/src/bindings.lisp Tue Sep 2 16:40:35 2008 @@ -33,11 +33,7 @@ (define-main-key ("F1" :mod-1) 'help-on-clfswm) -(defun quit-clfswm () - "Quit clfswm" - (throw 'exit-main-loop nil)) - -(define-main-key ("Home" :mod-1 :control :shift) 'quit-clfswm) +(define-main-key ("Home" :mod-1 :control :shift) 'exit-clfswm) (define-main-key ("Right" :mod-1) 'select-next-sister) (define-main-key ("Left" :mod-1) 'select-previous-sister) @@ -180,13 +176,13 @@ ;; ;;;;(define-main-key ("F1" :mod-1) 'help-on-clfswm) ;;;; -;;(defun quit-clfswm () +;;(defun exit-clfswm () ;; "Quit clfswm" ;; (throw 'exit-main-loop nil)) ;; ;; ;; -;;(define-main-key ("Home" :mod-1 :control :shift) 'quit-clfswm) +;;(define-main-key ("Home" :mod-1 :control :shift) 'exit-clfswm) ;; ;;(define-main-key (#\t :mod-1) 'second-key-mode) ;;(define-main-key ("less" :control) 'second-key-mode) Modified: clfswm/src/clfswm-corner.lisp ============================================================================== --- clfswm/src/clfswm-corner.lisp (original) +++ clfswm/src/clfswm-corner.lisp Tue Sep 2 16:40:35 2008 @@ -109,46 +109,42 @@ (setf *current-root* parent)) t) -(let ((vt-keyboard-on nil)) - (defun init-virtual-keyboard () - (setf vt-keyboard-on nil)) - (defun present-virtual-keyboard () - "Present a virtual keyboard" - (stop-button-event) - (do-shell (if vt-keyboard-on - *virtual-keyboard-kill-cmd* - *virtual-keyboard-cmd*)) - (setf vt-keyboard-on (not vt-keyboard-on)) - t)) - - -(let ((terminal nil)) - (defun init-clfswm-terminal () - (setf terminal nil)) - (defun present-clfswm-terminal () - "Hide/Unhide a terminal" - (stop-button-event) - (let ((found nil)) - (dolist (win (xlib:query-tree *root*)) - (when (string-equal (xlib:wm-name win) *clfswm-terminal-name*) - (setf found t) - (unless (equal terminal win) - (setf terminal win) - (hide-window terminal)))) - (unless found - (do-shell *clfswm-terminal-cmd*) - (loop :with done = nil :until done - :do (dolist (win (xlib:query-tree *root*)) - (when (string-equal (xlib:wm-name win) *clfswm-terminal-name*) - (setf terminal win - done t)))) - (hide-window terminal))) - (cond ((window-hidden-p terminal) (unhide-window terminal) - (focus-window terminal) - (raise-window terminal)) - (t (hide-window terminal) - (show-all-children nil))) - t)) + +(defun present-virtual-keyboard () + "Present a virtual keyboard" + (stop-button-event) + (do-shell (if *vt-keyboard-on* + *virtual-keyboard-kill-cmd* + *virtual-keyboard-cmd*)) + (setf *vt-keyboard-on* (not *vt-keyboard-on*)) + t) + + + +(defun present-clfswm-terminal () + "Hide/Unhide a terminal" + (stop-button-event) + (let ((found nil)) + (dolist (win (xlib:query-tree *root*)) + (when (string-equal (xlib:wm-name win) *clfswm-terminal-name*) + (setf found t) + (unless (equal *clfswm-terminal* win) + (setf *clfswm-terminal* win) + (hide-window *clfswm-terminal*)))) + (unless found + (do-shell *clfswm-terminal-cmd*) + (loop :with done = nil :until done + :do (dolist (win (xlib:query-tree *root*)) + (when (string-equal (xlib:wm-name win) *clfswm-terminal-name*) + (setf *clfswm-terminal* win + done t)))) + (hide-window *clfswm-terminal*))) + (cond ((window-hidden-p *clfswm-terminal*) (unhide-window *clfswm-terminal*) + (focus-window *clfswm-terminal*) + (raise-window *clfswm-terminal*)) + (t (hide-window *clfswm-terminal*) + (show-all-children nil))) + t) (defun ask-close/kill-current-window () Modified: clfswm/src/clfswm-menu.lisp ============================================================================== --- clfswm/src/clfswm-menu.lisp (original) +++ clfswm/src/clfswm-menu.lisp Tue Sep 2 16:40:35 2008 @@ -99,6 +99,8 @@ +(defun init-menu () + (setf *menu* (make-menu :name 'main :doc "Main menu"))) Modified: clfswm/src/clfswm-util.lisp ============================================================================== --- clfswm/src/clfswm-util.lisp (original) +++ clfswm/src/clfswm-util.lisp Tue Sep 2 16:40:35 2008 @@ -34,6 +34,19 @@ +(defun exit-clfswm () + "Exit clfswm" + (throw 'exit-clfswm nil)) + + +(defun reload-clfswm () + "Reload clfswm" + (format t "~&-*- Reloading CLFSWM -*-~%") + (asdf:oos 'asdf:load-op :clfswm) + (throw 'exit-main-loop nil)) + + + (defun rename-current-child () "Rename the current child" Modified: clfswm/src/clfswm.lisp ============================================================================== --- clfswm/src/clfswm.lisp (original) +++ clfswm/src/clfswm.lisp Tue Sep 2 16:40:35 2008 @@ -215,12 +215,12 @@ :height (xlib:screen-height *screen*) :depth (xlib:screen-root-depth *screen*) :drawable *root*) - *in-second-mode* nil) + *in-second-mode* nil + *clfswm-terminal* nil + *vt-keyboard-on* nil) (xgrab-init-pointer) (xgrab-init-keyboard) (init-last-child) - (init-virtual-keyboard) - (init-clfswm-terminal) (xlib:map-window *no-focus-window*) (dbg *display*) (setf (xlib:window-event-mask *root*) (xlib:make-event-mask :substructure-redirect @@ -242,7 +242,7 @@ (show-all-children *current-root*) (grab-main-keys) (xlib:display-finish-output *display*)) - + (defun xdg-config-home () @@ -269,25 +269,28 @@ -(defun main (&key (display (or (getenv "DISPLAY") ":0")) protocol - (base-dir (directory-namestring (or *load-truename* "")))) +(defun main-unprotected (&key (display (or (getenv "DISPLAY") ":0")) protocol + (base-dir (directory-namestring (or *load-truename* ""))) + error-msg) (setf *contrib-dir* base-dir) (read-conf-file) (handler-case (open-display display protocol) (xlib:access-error (c) - (format t "~&~A~&Maybe another window manager is running.~%" c) + (format t "~&~A~&Maybe another window manager is running. [1]~%" c) (force-output) - (return-from main 'init-display-error))) + (return-from main-unprotected 'init-display-error))) (handler-case (init-display) (xlib:access-error (c) (ungrab-main-keys) (xlib:destroy-window *no-focus-window*) (xlib:close-display *display*) - (format t "~&~A~&Maybe another window manager is running.~%" c) + (format t "~&~A~&Maybe another window manager is running. [2]~%" c) (force-output) - (return-from main 'init-display-error))) + (return-from main-unprotected 'init-display-error))) + (when error-msg + (info-mode error-msg)) (unwind-protect (catch 'exit-main-loop (main-loop)) @@ -295,6 +298,22 @@ (xlib:destroy-window *no-focus-window*) (xlib:free-pixmap *pixmap-buffer*) (xlib:close-display *display*))) - + + + +(defun main (&key (display (or (getenv "DISPLAY") ":0")) protocol + (base-dir (directory-namestring (or *load-truename* "")))) + (let (error-msg) + (catch 'exit-clfswm + (loop + (handler-case + (main-unprotected :display display :protocol protocol :base-dir base-dir + :error-msg error-msg) + (error (c) + (let ((msg (format nil "CLFSWM Error: ~A." c))) + (format t "~&~A~%Reinitializing...~%" msg) + (setf error-msg (list (list msg *info-color-title*) + "Reinitializing..."))))))))) + Modified: clfswm/src/menu-def.lisp ============================================================================== --- clfswm/src/menu-def.lisp (original) +++ clfswm/src/menu-def.lisp Tue Sep 2 16:40:35 2008 @@ -27,6 +27,8 @@ (in-package :clfswm) +(init-menu) + ;;; Here is a small example of menu manipulation: ;;(add-menu-key 'main "a" 'help-on-second-mode) @@ -45,10 +47,6 @@ ;;(define-second-key ("a") 'open-menu) - - - - (add-sub-menu 'main "c" 'child-menu "Child menu") (add-sub-menu 'main "f" 'frame-menu "Frame menu") (add-sub-menu 'main "w" 'window-menu "Window menu") @@ -56,6 +54,7 @@ (add-sub-menu 'main "n" 'action-by-name-menu "Action by name menu") (add-sub-menu 'main "u" 'action-by-number-menu "Action by number menu") (add-sub-menu 'main "y" 'utility-menu "Utility menu") +(add-sub-menu 'main #\* 'clfswm-menu "CLFSWM menu") @@ -169,3 +168,7 @@ (add-menu-key 'utility-menu "colon" 'eval-from-query-string) (add-menu-key 'utility-menu "exclam" 'run-program-from-query-string) + +(add-menu-key 'clfswm-menu "r" 'reload-clfswm) +(add-menu-key 'clfswm-menu "x" 'exit-clfswm) + Modified: clfswm/src/package.lisp ============================================================================== --- clfswm/src/package.lisp (original) +++ clfswm/src/package.lisp Tue Sep 2 16:40:35 2008 @@ -28,7 +28,9 @@ (defpackage clfswm (:use :common-lisp :my-html :tools :version) ;;(:shadow :defun) - (:export :main)) + (:export :main + :reload-clfswm + :exit-clfswm)) @@ -155,7 +157,7 @@ (defstruct menu-item key value) -(defvar *menu* (make-menu :name 'main :doc "Main menu")) +(defparameter *menu* (make-menu :name 'main :doc "Main menu")) ;;; Main mode hooks (set in clfswm.lisp) @@ -222,6 +224,10 @@ (defparameter *in-second-mode* nil) + +(defparameter *vt-keyboard-on* nil) +(defparameter *clfswm-terminal* nil) + ;; For debug - redefine defun ;;(shadow :defun) ;; From pbrochard at common-lisp.net Wed Sep 3 20:10:00 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Wed, 3 Sep 2008 16:10:00 -0400 (EDT) Subject: [clfswm-cvs] r159 - in clfswm: . doc src Message-ID: <20080903201000.8D3872808F@common-lisp.net> Author: pbrochard Date: Wed Sep 3 16:09:59 2008 New Revision: 159 Modified: clfswm/ChangeLog clfswm/doc/keys.html clfswm/doc/keys.txt clfswm/doc/menu.html clfswm/doc/menu.txt clfswm/src/clfswm-util.lisp clfswm/src/menu-def.lisp clfswm/src/package.lisp Log: Reset-clfswm: new function Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Wed Sep 3 16:09:59 2008 @@ -1,3 +1,7 @@ +2008-09-03 Philippe Brochard + + * src/clfswm-util.lisp (reset-clfswm): New function. + 2008-09-02 Philippe Brochard * src/clfswm-menu.lisp (init-menu): New function. Modified: clfswm/doc/keys.html ============================================================================== --- clfswm/doc/keys.html (original) +++ clfswm/doc/keys.html Wed Sep 3 16:09:59 2008 @@ -241,6 +241,17 @@ + Mod-1 + + + B + + + Move the pointer to the lower right corner of the screen + + + + Control Shift @@ -285,10 +296,10 @@ - Control + Mod-1 - Less + T Switch to editing mode @@ -296,13 +307,13 @@ - Mod-1 + Control - Agrave + Less - Bind or jump to a slot + Switch to editing mode @@ -310,7 +321,7 @@ Mod-1 - Ccedilla + |1| Bind or jump to a slot @@ -321,7 +332,7 @@ Mod-1 - Underscore + |2| Bind or jump to a slot @@ -332,7 +343,7 @@ Mod-1 - Egrave + |3| Bind or jump to a slot @@ -343,7 +354,7 @@ Mod-1 - Minus + |4| Bind or jump to a slot @@ -354,7 +365,7 @@ Mod-1 - Parenleft + |5| Bind or jump to a slot @@ -365,7 +376,7 @@ Mod-1 - Quoteright + |6| Bind or jump to a slot @@ -376,7 +387,7 @@ Mod-1 - Quotedbl + |7| Bind or jump to a slot @@ -387,7 +398,7 @@ Mod-1 - Eacute + |8| Bind or jump to a slot @@ -398,7 +409,7 @@ Mod-1 - Ampersand + |9| Bind or jump to a slot @@ -406,13 +417,13 @@ - + Mod-1 - Twosuperior + |0| - Move the pointer to the lower right corner of the screen + Bind or jump to a slot @@ -1140,7 +1151,7 @@ Mod-1 - Agrave + |1| Bind or jump to a slot @@ -1151,7 +1162,7 @@ Mod-1 - Ccedilla + |2| Bind or jump to a slot @@ -1162,7 +1173,7 @@ Mod-1 - Underscore + |3| Bind or jump to a slot @@ -1173,7 +1184,7 @@ Mod-1 - Egrave + |4| Bind or jump to a slot @@ -1184,7 +1195,7 @@ Mod-1 - Minus + |5| Bind or jump to a slot @@ -1195,7 +1206,7 @@ Mod-1 - Parenleft + |6| Bind or jump to a slot @@ -1206,7 +1217,7 @@ Mod-1 - Quoteright + |7| Bind or jump to a slot @@ -1217,7 +1228,7 @@ Mod-1 - Quotedbl + |8| Bind or jump to a slot @@ -1228,7 +1239,7 @@ Mod-1 - Eacute + |9| Bind or jump to a slot @@ -1239,7 +1250,7 @@ Mod-1 - Ampersand + |0| Bind or jump to a slot Modified: clfswm/doc/keys.txt ============================================================================== --- clfswm/doc/keys.txt (original) +++ clfswm/doc/keys.txt Wed Sep 3 16:09:59 2008 @@ -25,22 +25,23 @@ Mod-1 Menu Show all frames info windows until a key is release Shift Menu Show all frames info windows Control Menu Show/Hide the root frame + Mod-1 B Move the pointer to the lower right corner of the screen Control Shift Escape Close focus window: Delete the focus window in all frames and workspaces Mod-1 Control Shift Escape Kill focus window: Destroy the focus window in all frames and workspaces Control Escape Remove the focus window in the current frame Shift Escape Unhide all hidden windows into the current child + Mod-1 T Switch to editing mode Control Less Switch to editing mode - Mod-1 Agrave Bind or jump to a slot - Mod-1 Ccedilla Bind or jump to a slot - Mod-1 Underscore Bind or jump to a slot - Mod-1 Egrave Bind or jump to a slot - Mod-1 Minus Bind or jump to a slot - Mod-1 Parenleft Bind or jump to a slot - Mod-1 Quoteright Bind or jump to a slot - Mod-1 Quotedbl Bind or jump to a slot - Mod-1 Eacute Bind or jump to a slot - Mod-1 Ampersand Bind or jump to a slot - Twosuperior Move the pointer to the lower right corner of the screen + Mod-1 |1| Bind or jump to a slot + Mod-1 |2| Bind or jump to a slot + Mod-1 |3| Bind or jump to a slot + Mod-1 |4| Bind or jump to a slot + Mod-1 |5| Bind or jump to a slot + Mod-1 |6| Bind or jump to a slot + Mod-1 |7| Bind or jump to a slot + Mod-1 |8| Bind or jump to a slot + Mod-1 |9| Bind or jump to a slot + Mod-1 |0| Bind or jump to a slot Mouse buttons actions in main mode: @@ -115,16 +116,16 @@ H start an xclock Shift Menu Show all frames info windows Control Menu Show/Hide the root frame - Mod-1 Agrave Bind or jump to a slot - Mod-1 Ccedilla Bind or jump to a slot - Mod-1 Underscore Bind or jump to a slot - Mod-1 Egrave Bind or jump to a slot - Mod-1 Minus Bind or jump to a slot - Mod-1 Parenleft Bind or jump to a slot - Mod-1 Quoteright Bind or jump to a slot - Mod-1 Quotedbl Bind or jump to a slot - Mod-1 Eacute Bind or jump to a slot - Mod-1 Ampersand Bind or jump to a slot + Mod-1 |1| Bind or jump to a slot + Mod-1 |2| Bind or jump to a slot + Mod-1 |3| Bind or jump to a slot + Mod-1 |4| Bind or jump to a slot + Mod-1 |5| Bind or jump to a slot + Mod-1 |6| Bind or jump to a slot + Mod-1 |7| Bind or jump to a slot + Mod-1 |8| Bind or jump to a slot + Mod-1 |9| Bind or jump to a slot + Mod-1 |0| Bind or jump to a slot Mouse buttons actions in second mode: Modified: clfswm/doc/menu.html ============================================================================== --- clfswm/doc/menu.html (original) +++ clfswm/doc/menu.html Wed Sep 3 16:09:59 2008 @@ -501,7 +501,10 @@ Clfswm-Menu

- r: Reload clfswm + r: Reset clfswm +

+

+ l: Reload clfswm

x: Exit clfswm Modified: clfswm/doc/menu.txt ============================================================================== --- clfswm/doc/menu.txt (original) +++ clfswm/doc/menu.txt Wed Sep 3 16:09:59 2008 @@ -179,7 +179,8 @@ exclam: Run a program from the query input Clfswm-Menu -r: Reload clfswm +r: Reset clfswm +l: Reload clfswm x: Exit clfswm Modified: clfswm/src/clfswm-util.lisp ============================================================================== --- clfswm/src/clfswm-util.lisp (original) +++ clfswm/src/clfswm-util.lisp Wed Sep 3 16:09:59 2008 @@ -38,12 +38,16 @@ "Exit clfswm" (throw 'exit-clfswm nil)) +(defun reset-clfswm () + "Reset clfswm" + (throw 'exit-main-loop nil)) + (defun reload-clfswm () "Reload clfswm" (format t "~&-*- Reloading CLFSWM -*-~%") (asdf:oos 'asdf:load-op :clfswm) - (throw 'exit-main-loop nil)) + (reset-clfswm)) Modified: clfswm/src/menu-def.lisp ============================================================================== --- clfswm/src/menu-def.lisp (original) +++ clfswm/src/menu-def.lisp Wed Sep 3 16:09:59 2008 @@ -169,6 +169,7 @@ (add-menu-key 'utility-menu "exclam" 'run-program-from-query-string) -(add-menu-key 'clfswm-menu "r" 'reload-clfswm) +(add-menu-key 'clfswm-menu "r" 'reset-clfswm) +(add-menu-key 'clfswm-menu "l" 'reload-clfswm) (add-menu-key 'clfswm-menu "x" 'exit-clfswm) Modified: clfswm/src/package.lisp ============================================================================== --- clfswm/src/package.lisp (original) +++ clfswm/src/package.lisp Wed Sep 3 16:09:59 2008 @@ -30,6 +30,7 @@ ;;(:shadow :defun) (:export :main :reload-clfswm + :reset-clfswm :exit-clfswm)) From pbrochard at common-lisp.net Wed Sep 3 20:40:49 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Wed, 3 Sep 2008 16:40:49 -0400 (EDT) Subject: [clfswm-cvs] r160 - in clfswm: . doc src Message-ID: <20080903204049.B34F8690DD@common-lisp.net> Author: pbrochard Date: Wed Sep 3 16:40:41 2008 New Revision: 160 Modified: clfswm/ChangeLog clfswm/TODO clfswm/doc/menu.html clfswm/doc/menu.txt clfswm/src/clfswm-util.lisp clfswm/src/clfswm.lisp clfswm/src/menu-def.lisp clfswm/src/package.lisp Log: handle-enter-notify: Add a sloppy strict focus policy -> Sloppy focus only for windows in the current frame. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Wed Sep 3 16:40:41 2008 @@ -1,5 +1,8 @@ 2008-09-03 Philippe Brochard + * src/clfswm.lisp (handle-enter-notify): Add a sloppy strict focus + policy -> Sloppy focus only for windows in the current frame. + * src/clfswm-util.lisp (reset-clfswm): New function. 2008-09-02 Philippe Brochard Modified: clfswm/TODO ============================================================================== --- clfswm/TODO (original) +++ clfswm/TODO Wed Sep 3 16:40:41 2008 @@ -7,15 +7,12 @@ =============== Should handle these soon. -- Sloppy focus strict -> focus windows only in the current frame - Sloppy select -> select frame on mouse enter. - - Hook to open next window in named/numbered frame [Philippe] - Ensure-unique-number/name (new function) [Philippe] - Show config -> list and display documentation for all tweakable global variables. [Philippe] - TODO : remove src/test.lisp src/load-test.lisp + TODO : In ~/.clfswmrc: ;;;; AUTO-CONFIG - Do not edit those lines by hands: they are overwritten by CLFSWM (defparameter *ma-var* value) Modified: clfswm/doc/menu.html ============================================================================== --- clfswm/doc/menu.html (original) +++ clfswm/doc/menu.html Wed Sep 3 16:40:41 2008 @@ -352,10 +352,13 @@ Frame-Focus-Policy

- c: Set a click focus policy for the current frame + c: Set a click focus policy for the current frame.

- s: Set a sloppy focus policy for the current frame + s: Set a sloppy focus policy for the current frame. +

+

+ t: Set a (strict) sloppy focus policy only for windows in the current frame.


Modified: clfswm/doc/menu.txt ============================================================================== --- clfswm/doc/menu.txt (original) +++ clfswm/doc/menu.txt Wed Sep 3 16:40:41 2008 @@ -124,8 +124,9 @@ a: Resize down the current frame to its minimal size Frame-Focus-Policy -c: Set a click focus policy for the current frame -s: Set a sloppy focus policy for the current frame +c: Set a click focus policy for the current frame. +s: Set a sloppy focus policy for the current frame. +t: Set a (strict) sloppy focus policy only for windows in the current frame. Frame-Managed-Window-Menu m: Change window types to be managed by a frame Modified: clfswm/src/clfswm-util.lisp ============================================================================== --- clfswm/src/clfswm-util.lisp (original) +++ clfswm/src/clfswm-util.lisp Wed Sep 3 16:40:41 2008 @@ -1084,14 +1084,21 @@ ;;; Focus policy functions -(defun current-frame-set-click-focus-policy () - "Set a click focus policy for the current frame" +(defun set-focus-policy-generic (focus-policy) (when (frame-p *current-child*) - (setf (frame-focus-policy *current-child*) :click)) + (setf (frame-focus-policy *current-child*) focus-policy)) (leave-second-mode)) + +(defun current-frame-set-click-focus-policy () + "Set a click focus policy for the current frame." + (set-focus-policy-generic :click)) + (defun current-frame-set-sloppy-focus-policy () - "Set a sloppy focus policy for the current frame" - (when (frame-p *current-child*) - (setf (frame-focus-policy *current-child*) :sloppy)) - (leave-second-mode)) + "Set a sloppy focus policy for the current frame." + (set-focus-policy-generic :sloppy)) + +(defun current-frame-set-sloppy-strict-focus-policy () + "Set a (strict) sloppy focus policy only for windows in the current frame." + (set-focus-policy-generic :sloppy-strict)) + Modified: clfswm/src/clfswm.lisp ============================================================================== --- clfswm/src/clfswm.lisp (original) +++ clfswm/src/clfswm.lisp Wed Sep 3 16:40:41 2008 @@ -121,12 +121,18 @@ (defun handle-enter-notify (&rest event-slots &key window root-x root-y &allow-other-keys) (declare (ignore event-slots)) - (when (eql :sloppy (if (frame-p *current-child*) - (frame-focus-policy *current-child*) - *default-focus-policy*)) - (unless (and (> root-x (- (xlib:screen-width *screen*) 3)) - (> root-y (- (xlib:screen-height *screen*) 3))) - (focus-window window)))) + (case (if (frame-p *current-child*) + (frame-focus-policy *current-child*) + *default-focus-policy*) + (:sloppy (unless (and (> root-x (- (xlib:screen-width *screen*) 3)) + (> root-y (- (xlib:screen-height *screen*) 3))) + (focus-window window))) + (:sloppy-strict (unless (and (> root-x (- (xlib:screen-width *screen*) 3)) + (> root-y (- (xlib:screen-height *screen*) 3))) + (when (and (frame-p *current-child*) + (member window (frame-child *current-child*))) + (focus-window window)))))) + Modified: clfswm/src/menu-def.lisp ============================================================================== --- clfswm/src/menu-def.lisp (original) +++ clfswm/src/menu-def.lisp Wed Sep 3 16:40:41 2008 @@ -114,6 +114,8 @@ (add-menu-key 'frame-focus-policy "c" 'current-frame-set-click-focus-policy) (add-menu-key 'frame-focus-policy "s" 'current-frame-set-sloppy-focus-policy) +(add-menu-key 'frame-focus-policy "t" 'current-frame-set-sloppy-strict-focus-policy) + (add-menu-key 'frame-managed-window-menu "m" 'current-frame-manage-window-type) (add-menu-key 'frame-managed-window-menu "a" 'current-frame-manage-all-window-type) Modified: clfswm/src/package.lisp ============================================================================== --- clfswm/src/package.lisp (original) +++ clfswm/src/package.lisp Wed Sep 3 16:40:41 2008 @@ -85,7 +85,7 @@ ;;; CONFIG - Default focus policy (defparameter *default-focus-policy* :click - "Config(): Default mouse focus policy. One of :click or :sloppy") + "Config(): Default mouse focus policy. One of :click, :sloppy or :sloppy-strict.") From pbrochard at common-lisp.net Wed Sep 3 20:50:39 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Wed, 3 Sep 2008 16:50:39 -0400 (EDT) Subject: [clfswm-cvs] r161 - in clfswm: . src Message-ID: <20080903205039.8C60122038@common-lisp.net> Author: pbrochard Date: Wed Sep 3 16:50:38 2008 New Revision: 161 Modified: clfswm/ChangeLog clfswm/clfswm.asd clfswm/src/clfswm-internal.lisp clfswm/src/clfswm-util.lisp clfswm/src/clfswm.lisp Log: main-unprotected: Exit clfswm on init error (ie: when another window manager is running). Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Wed Sep 3 16:50:38 2008 @@ -2,6 +2,8 @@ * src/clfswm.lisp (handle-enter-notify): Add a sloppy strict focus policy -> Sloppy focus only for windows in the current frame. + (main-unprotected): Exit clfswm on init error (ie: when another + window manager is running). * src/clfswm-util.lisp (reset-clfswm): New function. Modified: clfswm/clfswm.asd ============================================================================== --- clfswm/clfswm.asd (original) +++ clfswm/clfswm.asd Wed Sep 3 16:50:38 2008 @@ -46,7 +46,7 @@ (:file "clfswm-menu" :depends-on ("package" "clfswm-info")) (:file "menu-def" - :depends-on ("clfswm-menu")) + :depends-on ("clfswm-menu" "clfswm")) (:file "clfswm-util" :depends-on ("clfswm" "keysyms" "clfswm-info" "clfswm-second-mode" "clfswm-query" "clfswm-menu" "clfswm-autodoc" "clfswm-corner")) (:file "clfswm-query" Modified: clfswm/src/clfswm-internal.lisp ============================================================================== --- clfswm/src/clfswm-internal.lisp (original) +++ clfswm/src/clfswm-internal.lisp Wed Sep 3 16:50:38 2008 @@ -26,6 +26,7 @@ (in-package :clfswm) + ;;; Conversion functions ;;; Float -> Pixel conversion (defun x-fl->px (x parent) Modified: clfswm/src/clfswm-util.lisp ============================================================================== --- clfswm/src/clfswm-util.lisp (original) +++ clfswm/src/clfswm-util.lisp Wed Sep 3 16:50:38 2008 @@ -33,16 +33,6 @@ (load truename)))) - -(defun exit-clfswm () - "Exit clfswm" - (throw 'exit-clfswm nil)) - -(defun reset-clfswm () - "Reset clfswm" - (throw 'exit-main-loop nil)) - - (defun reload-clfswm () "Reload clfswm" (format t "~&-*- Reloading CLFSWM -*-~%") Modified: clfswm/src/clfswm.lisp ============================================================================== --- clfswm/src/clfswm.lisp (original) +++ clfswm/src/clfswm.lisp Wed Sep 3 16:50:38 2008 @@ -275,6 +275,20 @@ + + + +(defun exit-clfswm () + "Exit clfswm" + (throw 'exit-clfswm nil)) + +(defun reset-clfswm () + "Reset clfswm" + (throw 'exit-main-loop nil)) + + + + (defun main-unprotected (&key (display (or (getenv "DISPLAY") ":0")) protocol (base-dir (directory-namestring (or *load-truename* ""))) error-msg) @@ -285,7 +299,7 @@ (xlib:access-error (c) (format t "~&~A~&Maybe another window manager is running. [1]~%" c) (force-output) - (return-from main-unprotected 'init-display-error))) + (exit-clfswm))) (handler-case (init-display) (xlib:access-error (c) @@ -294,7 +308,7 @@ (xlib:close-display *display*) (format t "~&~A~&Maybe another window manager is running. [2]~%" c) (force-output) - (return-from main-unprotected 'init-display-error))) + (exit-clfswm))) (when error-msg (info-mode error-msg)) (unwind-protect From pbrochard at common-lisp.net Fri Sep 12 21:12:12 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Fri, 12 Sep 2008 17:12:12 -0400 (EDT) Subject: [clfswm-cvs] r162 - in clfswm: . doc src Message-ID: <20080912211212.9BB64431BE@common-lisp.net> Author: pbrochard Date: Fri Sep 12 17:12:11 2008 New Revision: 162 Modified: clfswm/ChangeLog clfswm/doc/menu.html clfswm/doc/menu.txt clfswm/src/clfswm-internal.lisp clfswm/src/clfswm-util.lisp clfswm/src/clfswm.lisp clfswm/src/menu-def.lisp clfswm/src/package.lisp Log: handle-enter-notify: sloppy-select mode. Select a child and its parents on mouse over. Add a menu entry to set a focus policy for all frames. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Fri Sep 12 17:12:11 2008 @@ -1,3 +1,15 @@ +2008-09-12 Philippe Brochard + + * src/menu-def.lisp: Add a menu to set a focus policy for all + frames. + + * src/clfswm-util.lisp (set-focus-policy-generic-for-all) + (all-frames-set-*-focus-policy): Set a focus policy for all + frames. + + * src/clfswm.lisp (handle-enter-notify): sloppy-select + mode. Select a child and its parents on mouse over. + 2008-09-03 Philippe Brochard * src/clfswm.lisp (handle-enter-notify): Add a sloppy strict focus Modified: clfswm/doc/menu.html ============================================================================== --- clfswm/doc/menu.html (original) +++ clfswm/doc/menu.html Fri Sep 12 17:12:11 2008 @@ -352,13 +352,34 @@ Frame-Focus-Policy

- c: Set a click focus policy for the current frame. + -=- For the current frame -=-

- s: Set a sloppy focus policy for the current frame. + a: Set a click focus policy for the current frame.

- t: Set a (strict) sloppy focus policy only for windows in the current frame. + b: Set a sloppy focus policy for the current frame. +

+

+ c: Set a (strict) sloppy focus policy only for windows in the current frame. +

+

+ d: Set a sloppy select policy for the current frame. +

+

+ -=- For all frames -=- +

+

+ e: Set a click focus policy for all frames. +

+

+ f: Set a sloppy focus policy for all frames. +

+

+ g: Set a (strict) sloppy focus policy for all frames. +

+

+ h: Set a sloppy select policy for all frames.


Modified: clfswm/doc/menu.txt ============================================================================== --- clfswm/doc/menu.txt (original) +++ clfswm/doc/menu.txt Fri Sep 12 17:12:11 2008 @@ -124,9 +124,16 @@ a: Resize down the current frame to its minimal size Frame-Focus-Policy -c: Set a click focus policy for the current frame. -s: Set a sloppy focus policy for the current frame. -t: Set a (strict) sloppy focus policy only for windows in the current frame. +-=- For the current frame -=- +a: Set a click focus policy for the current frame. +b: Set a sloppy focus policy for the current frame. +c: Set a (strict) sloppy focus policy only for windows in the current frame. +d: Set a sloppy select policy for the current frame. +-=- For all frames -=- +e: Set a click focus policy for all frames. +f: Set a sloppy focus policy for all frames. +g: Set a (strict) sloppy focus policy for all frames. +h: Set a sloppy select policy for all frames. Frame-Managed-Window-Menu m: Change window types to be managed by a frame Modified: clfswm/src/clfswm-internal.lisp ============================================================================== --- clfswm/src/clfswm-internal.lisp (original) +++ clfswm/src/clfswm-internal.lisp Fri Sep 12 17:12:11 2008 @@ -252,7 +252,7 @@ :colormap (xlib:screen-default-colormap *screen*) :border-width 1 :border (get-color "Red") - :event-mask '(:exposure :button-press :button-release :pointer-motion))) + :event-mask '(:exposure :button-press :button-release :pointer-motion :enter-window))) (gc (xlib:create-gcontext :drawable window :foreground (get-color "Green") :background (get-color "Black") @@ -369,6 +369,22 @@ +;;; Current window utilities +(defun get-current-window () + (typecase *current-child* + (xlib:window *current-child*) + (frame (frame-selected-child *current-child*)))) + +(defmacro with-current-window (&body body) + "Bind 'window' to the current window" + `(let ((window (get-current-window))) + (when (xlib:window-p window) + , at body))) + + + + + (defun display-frame-info (frame) (let ((dy (+ (xlib:max-char-ascent *default-font*) (xlib:max-char-descent *default-font*)))) (with-slots (name number gc window child hidden-children) frame Modified: clfswm/src/clfswm-util.lisp ============================================================================== --- clfswm/src/clfswm-util.lisp (original) +++ clfswm/src/clfswm-util.lisp Fri Sep 12 17:12:11 2008 @@ -864,21 +864,6 @@ -;;; Current window utilities -(defun get-current-window () - (typecase *current-child* - (xlib:window *current-child*) - (frame (frame-selected-child *current-child*)))) - -(defmacro with-current-window (&body body) - "Bind 'window' to the current window" - `(let ((window (get-current-window))) - (when (xlib:window-p window) - , at body))) - - - - ;;; Force window functions (defun force-window-in-frame () @@ -1090,5 +1075,33 @@ (defun current-frame-set-sloppy-strict-focus-policy () "Set a (strict) sloppy focus policy only for windows in the current frame." - (set-focus-policy-generic :sloppy-strict)) + (set-focus-policy-generic :sloppy-strict)) + +(defun current-frame-set-sloppy-select-policy () + "Set a sloppy select policy for the current frame." + (set-focus-policy-generic :sloppy-select)) + + + +(defun set-focus-policy-generic-for-all (focus-policy) + (with-all-frames (*root-frame* frame) + (setf (frame-focus-policy frame) focus-policy)) + (leave-second-mode)) + + +(defun all-frames-set-click-focus-policy () + "Set a click focus policy for all frames." + (set-focus-policy-generic-for-all :click)) + +(defun all-frames-set-sloppy-focus-policy () + "Set a sloppy focus policy for all frames." + (set-focus-policy-generic-for-all :sloppy)) + +(defun all-frames-set-sloppy-strict-focus-policy () + "Set a (strict) sloppy focus policy for all frames." + (set-focus-policy-generic-for-all :sloppy-strict)) + +(defun all-frames-set-sloppy-select-policy () + "Set a sloppy select policy for all frames." + (set-focus-policy-generic-for-all :sloppy-select)) Modified: clfswm/src/clfswm.lisp ============================================================================== --- clfswm/src/clfswm.lisp (original) +++ clfswm/src/clfswm.lisp Fri Sep 12 17:12:11 2008 @@ -121,17 +121,24 @@ (defun handle-enter-notify (&rest event-slots &key window root-x root-y &allow-other-keys) (declare (ignore event-slots)) - (case (if (frame-p *current-child*) - (frame-focus-policy *current-child*) - *default-focus-policy*) - (:sloppy (unless (and (> root-x (- (xlib:screen-width *screen*) 3)) - (> root-y (- (xlib:screen-height *screen*) 3))) - (focus-window window))) - (:sloppy-strict (unless (and (> root-x (- (xlib:screen-width *screen*) 3)) - (> root-y (- (xlib:screen-height *screen*) 3))) - (when (and (frame-p *current-child*) + (unless (and (> root-x (- (xlib:screen-width *screen*) 3)) + (> root-y (- (xlib:screen-height *screen*) 3))) + (case (if (frame-p *current-child*) + (frame-focus-policy *current-child*) + *default-focus-policy*) + (:sloppy (focus-window window)) + (:sloppy-strict (when (and (frame-p *current-child*) (member window (frame-child *current-child*))) - (focus-window window)))))) + (focus-window window))) + (:sloppy-select (let* ((child (find-child-under-mouse root-x root-y)) + (parent (find-parent-frame child))) + (unless (or (equal child *current-root*) + (equal (typecase child + (xlib:window parent) + (t child)) + *current-child*)) + (focus-all-children child parent) + (show-all-children))))))) Modified: clfswm/src/menu-def.lisp ============================================================================== --- clfswm/src/menu-def.lisp (original) +++ clfswm/src/menu-def.lisp Fri Sep 12 17:12:11 2008 @@ -112,9 +112,18 @@ (add-menu-key 'frame-resize-menu #\a 'current-frame-resize-all-dir-minimal) -(add-menu-key 'frame-focus-policy "c" 'current-frame-set-click-focus-policy) -(add-menu-key 'frame-focus-policy "s" 'current-frame-set-sloppy-focus-policy) -(add-menu-key 'frame-focus-policy "t" 'current-frame-set-sloppy-strict-focus-policy) +(add-menu-comment 'frame-focus-policy "-=- For the current frame -=-") +(add-menu-key 'frame-focus-policy "a" 'current-frame-set-click-focus-policy) +(add-menu-key 'frame-focus-policy "b" 'current-frame-set-sloppy-focus-policy) +(add-menu-key 'frame-focus-policy "c" 'current-frame-set-sloppy-strict-focus-policy) +(add-menu-key 'frame-focus-policy "d" 'current-frame-set-sloppy-select-policy) +(add-menu-comment 'frame-focus-policy "-=- For all frames -=-") +(add-menu-key 'frame-focus-policy "e" 'all-frames-set-click-focus-policy) +(add-menu-key 'frame-focus-policy "f" 'all-frames-set-sloppy-focus-policy) +(add-menu-key 'frame-focus-policy "g" 'all-frames-set-sloppy-strict-focus-policy) +(add-menu-key 'frame-focus-policy "h" 'all-frames-set-sloppy-select-policy) + + (add-menu-key 'frame-managed-window-menu "m" 'current-frame-manage-window-type) Modified: clfswm/src/package.lisp ============================================================================== --- clfswm/src/package.lisp (original) +++ clfswm/src/package.lisp Fri Sep 12 17:12:11 2008 @@ -85,7 +85,7 @@ ;;; CONFIG - Default focus policy (defparameter *default-focus-policy* :click - "Config(): Default mouse focus policy. One of :click, :sloppy or :sloppy-strict.") + "Config(): Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select.") From pbrochard at common-lisp.net Fri Sep 19 20:59:32 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Fri, 19 Sep 2008 16:59:32 -0400 (EDT) Subject: [clfswm-cvs] r163 - in clfswm: . src Message-ID: <20080919205932.DEECC5C189@common-lisp.net> Author: pbrochard Date: Fri Sep 19 16:59:32 2008 New Revision: 163 Modified: clfswm/ChangeLog clfswm/src/bindings-second-mode.lisp clfswm/src/menu-def.lisp clfswm/src/xlib-util.lisp Log: Handle the case where cursor is nil. (workaround on some CLX implementation). Change key binding for the CLFSWM menu entry. Bind 't' to tile-current-frame. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Fri Sep 19 16:59:32 2008 @@ -1,3 +1,13 @@ +2008-09-19 Philippe Brochard + + * src/bindings-second-mode.lisp: Bind "t" to tile-current-frame. + + * src/menu-def.lisp: Change key binding for the CLFSWM menu + entry. + + * src/xlib-util.lisp (xgrab-pointer): Handle the case where cursor + is nil. (workaround on some CLX implementation). + 2008-09-12 Philippe Brochard * src/menu-def.lisp: Add a menu to set a focus policy for all Modified: clfswm/src/bindings-second-mode.lisp ============================================================================== --- clfswm/src/bindings-second-mode.lisp (original) +++ clfswm/src/bindings-second-mode.lisp Fri Sep 19 16:59:32 2008 @@ -92,13 +92,12 @@ (define-second-key ("Escape") 'leave-second-mode) -(defun tile-space-current-frame () +(defun tile-current-frame () "Tile with spaces the current frame" - (explode-frame *current-child*) - (set-layout-once #'tile-space-layout) + (set-layout-once #'tile-layout) (leave-second-mode)) -(define-second-key ("t") 'tile-space-current-frame) +(define-second-key ("t") 'tile-current-frame) (define-second-key ("Home" :mod-1 :control :shift) 'exit-clfswm) Modified: clfswm/src/menu-def.lisp ============================================================================== --- clfswm/src/menu-def.lisp (original) +++ clfswm/src/menu-def.lisp Fri Sep 19 16:59:32 2008 @@ -54,7 +54,7 @@ (add-sub-menu 'main "n" 'action-by-name-menu "Action by name menu") (add-sub-menu 'main "u" 'action-by-number-menu "Action by number menu") (add-sub-menu 'main "y" 'utility-menu "Utility menu") -(add-sub-menu 'main #\* 'clfswm-menu "CLFSWM menu") +(add-sub-menu 'main "m" 'clfswm-menu "CLFSWM menu") Modified: clfswm/src/xlib-util.lisp ============================================================================== --- clfswm/src/xlib-util.lisp (original) +++ clfswm/src/xlib-util.lisp Fri Sep 19 16:59:32 2008 @@ -352,17 +352,19 @@ (setf pointer-grabbed t) (let* ((white (xlib:make-color :red 1.0 :green 1.0 :blue 1.0)) (black (xlib:make-color :red 0.0 :green 0.0 :blue 0.0))) - (if cursor-char - (setf cursor-font (xlib:open-font *display* "cursor") - cursor (xlib:create-glyph-cursor :source-font cursor-font - :source-char cursor-char - :mask-font cursor-font - :mask-char cursor-mask-char - :foreground black - :background white)) - (setf cursor nil)) - (xlib:grab-pointer root pointer-mask - :owner-p owner-p :sync-keyboard-p nil :sync-pointer-p nil :cursor cursor))) + (cond (cursor-char + (setf cursor-font (xlib:open-font *display* "cursor") + cursor (xlib:create-glyph-cursor :source-font cursor-font + :source-char (or cursor-char 68) + :mask-font cursor-font + :mask-char (or cursor-mask-char 69) + :foreground black + :background white)) + (xlib:grab-pointer root pointer-mask + :owner-p owner-p :sync-keyboard-p nil :sync-pointer-p nil :cursor cursor)) + (t + (xlib:grab-pointer root pointer-mask + :owner-p owner-p :sync-keyboard-p nil :sync-pointer-p nil))))) (defun xungrab-pointer () "Remove the grab on the cursor and restore the cursor shape." From pbrochard at common-lisp.net Fri Sep 19 21:00:11 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Fri, 19 Sep 2008 17:00:11 -0400 (EDT) Subject: [clfswm-cvs] r164 - clfswm/doc Message-ID: <20080919210011.7074112064@common-lisp.net> Author: pbrochard Date: Fri Sep 19 17:00:07 2008 New Revision: 164 Modified: clfswm/doc/menu.html clfswm/doc/menu.txt Log: Documentation update Modified: clfswm/doc/menu.html ============================================================================== --- clfswm/doc/menu.html (original) +++ clfswm/doc/menu.html Fri Sep 19 17:00:07 2008 @@ -39,7 +39,7 @@ y: < Utility menu >

- *: < CLFSWM menu > + m: < CLFSWM menu >


Modified: clfswm/doc/menu.txt ============================================================================== --- clfswm/doc/menu.txt (original) +++ clfswm/doc/menu.txt Fri Sep 19 17:00:07 2008 @@ -9,7 +9,7 @@ n: < Action by name menu > u: < Action by number menu > y: < Utility menu > -*: < CLFSWM menu > +m: < CLFSWM menu > Child-Menu r: Rename the current child From pbrochard at common-lisp.net Fri Sep 19 21:01:31 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Fri, 19 Sep 2008 17:01:31 -0400 (EDT) Subject: [clfswm-cvs] r165 - in clfswm: doc src Message-ID: <20080919210131.52A0B6D07A@common-lisp.net> Author: pbrochard Date: Fri Sep 19 17:01:31 2008 New Revision: 165 Modified: clfswm/doc/keys.html clfswm/doc/keys.txt clfswm/src/bindings-second-mode.lisp Log: Documentation update Modified: clfswm/doc/keys.html ============================================================================== --- clfswm/doc/keys.html (original) +++ clfswm/doc/keys.html Fri Sep 19 17:01:31 2008 @@ -758,7 +758,7 @@ T - Tile with spaces the current frame + Tile the current frame Modified: clfswm/doc/keys.txt ============================================================================== --- clfswm/doc/keys.txt (original) +++ clfswm/doc/keys.txt Fri Sep 19 17:01:31 2008 @@ -80,7 +80,7 @@ Exclam Run a program from the query input Return Leave second mode Escape Leave second mode - T Tile with spaces the current frame + T Tile the current frame Mod-1 Control Shift Home Exit clfswm Mod-1 Right Select the next sister frame Mod-1 Left Select the previous sister frame Modified: clfswm/src/bindings-second-mode.lisp ============================================================================== --- clfswm/src/bindings-second-mode.lisp (original) +++ clfswm/src/bindings-second-mode.lisp Fri Sep 19 17:01:31 2008 @@ -93,7 +93,7 @@ (defun tile-current-frame () - "Tile with spaces the current frame" + "Tile the current frame" (set-layout-once #'tile-layout) (leave-second-mode)) From pbrochard at common-lisp.net Mon Sep 22 09:27:23 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Mon, 22 Sep 2008 05:27:23 -0400 (EDT) Subject: [clfswm-cvs] r167 - clfswm Message-ID: <20080922092723.DC10C3F0CF@common-lisp.net> Author: pbrochard Date: Mon Sep 22 05:27:22 2008 New Revision: 167 Modified: clfswm/ChangeLog Log: show-all-children: Do not raise a child by default => far less flickering. (Changelog update) Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Mon Sep 22 05:27:22 2008 @@ -1,3 +1,8 @@ +2008-09-22 Philippe Brochard + + * src/clfswm-internal.lisp (show-all-children): Do not raise a + child by default => far less flickering. + 2008-09-19 Philippe Brochard * src/bindings-second-mode.lisp: Bind "t" to tile-current-frame. From pbrochard at common-lisp.net Mon Sep 22 09:26:29 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Mon, 22 Sep 2008 05:26:29 -0400 (EDT) Subject: [clfswm-cvs] r166 - clfswm/src Message-ID: <20080922092629.B16F675187@common-lisp.net> Author: pbrochard Date: Mon Sep 22 05:26:14 2008 New Revision: 166 Modified: clfswm/src/clfswm-internal.lisp Log: show-all-children: Do not raise a child by default => far less flickering. Modified: clfswm/src/clfswm-internal.lisp ============================================================================== --- clfswm/src/clfswm-internal.lisp (original) +++ clfswm/src/clfswm-internal.lisp Mon Sep 22 05:26:14 2008 @@ -592,14 +592,14 @@ (when list (multiple-value-bind (xo1 yo1 xo2 yo2) (child-coordinates (first list)) - (push (not (dolist (c (rest list)) - (multiple-value-bind (x1 y1 x2 y2) - (child-coordinates c) - (when (and (<= x1 xo1) - (>= x2 xo2) - (<= y1 yo1) - (>= y2 yo2)) - (return t))))) + (push (dolist (c (rest list) t) + (multiple-value-bind (x1 y1 x2 y2) + (child-coordinates c) + (when (and (<= x1 xo1) + (>= x2 xo2) + (<= y1 yo1) + (>= y2 yo2)) + (return nil)))) acc)) (rec (rest list))))) (rec children) @@ -629,7 +629,7 @@ for raise-p in (raise-p-list reversed-children) do (rec child root raise-p)))))) (rec-geom *current-root* nil t t) - (rec display-child nil t) + (rec display-child nil nil) (set-focus-to-current-child) geometry-change))) From pbrochard at common-lisp.net Mon Sep 22 20:02:44 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Mon, 22 Sep 2008 16:02:44 -0400 (EDT) Subject: [clfswm-cvs] r168 - in clfswm: . src Message-ID: <20080922200244.4A87A471B9@common-lisp.net> Author: pbrochard Date: Mon Sep 22 16:02:42 2008 New Revision: 168 Modified: clfswm/ChangeLog clfswm/TODO clfswm/src/clfswm-nw-hooks.lisp clfswm/src/clfswm-query.lisp clfswm/src/clfswm-util.lisp Log: named-frame-nw-hook/numbered-frame-nw-hook: open the next window in a named/numbered frame. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Mon Sep 22 16:02:42 2008 @@ -1,5 +1,13 @@ 2008-09-22 Philippe Brochard + * src/clfswm-nw-hooks.lisp (named-frame-nw-hook): New new window + hook: open the next window in a named frame. + (numbered-frame-nw-hook): New new window hook: open the next + window in a numbered frame. + + * src/clfswm-query.lisp (query-string): Grab the keyboard in all + cases. So query-string can be called even in the main mode. + * src/clfswm-internal.lisp (show-all-children): Do not raise a child by default => far less flickering. Modified: clfswm/TODO ============================================================================== --- clfswm/TODO (original) +++ clfswm/TODO Mon Sep 22 16:02:42 2008 @@ -7,10 +7,12 @@ =============== Should handle these soon. -- Hook to open next window in named/numbered frame [Philippe] - - Ensure-unique-number/name (new function) [Philippe] + +MAYBE +===== + - Show config -> list and display documentation for all tweakable global variables. [Philippe] TODO : In ~/.clfswmrc: @@ -20,9 +22,6 @@ ;;;; AUTO-CONFIG End : You can add your configurations below this line. -MAYBE -===== - - cd/pwd a la shell to navigate throw frames. [Philippe] - Zoom Modified: clfswm/src/clfswm-nw-hooks.lisp ============================================================================== --- clfswm/src/clfswm-nw-hooks.lisp (original) +++ clfswm/src/clfswm-nw-hooks.lisp Mon Sep 22 16:02:42 2008 @@ -185,3 +185,45 @@ (set-nw-hook #'leave-focus-frame-nw-hook)) (register-nw-hook 'set-leave-focus-frame-nw-hook) + + + + + +(defun nw-hook-open-in-frame (window frame) + (when (frame-p frame) + (pushnew window (frame-child frame)) + (unless (find-child frame *current-root*) + (hide-all *current-root*) + (setf *current-root* frame)) + (setf *current-child* frame) + (focus-all-children window frame) + (default-window-placement frame window) + (show-all-children *current-root*))) + +;;; Open a new window in a named frame +(defun named-frame-nw-hook (frame window) + (clear-nw-hook frame) + (let* ((frame-name (ask-frame-name "Open the next window in frame named:")) + (new-frame (find-frame-by-name frame-name))) + (nw-hook-open-in-frame window new-frame))) + +(defun set-named-frame-nw-hook () + "Open the next window in a named frame" + (set-nw-hook #'named-frame-nw-hook)) + +(register-nw-hook 'set-named-frame-nw-hook) + + +;;; Open a new window in a numbered frame +(defun numbered-frame-nw-hook (frame window) + (clear-nw-hook frame) + (let ((new-frame (find-frame-by-number (query-number "Open a new frame in the group numbered:")))) + (nw-hook-open-in-frame window new-frame))) + +(defun set-numbered-frame-nw-hook () + "Open the next window in a numbered frame" + (set-nw-hook #'numbered-frame-nw-hook)) + +(register-nw-hook 'set-numbered-frame-nw-hook) + Modified: clfswm/src/clfswm-query.lisp ============================================================================== --- clfswm/src/clfswm-query.lisp (original) +++ clfswm/src/clfswm-query.lisp Mon Sep 22 16:02:42 2008 @@ -80,7 +80,9 @@ :line-style :solid)) (result-string default) (pos (length default)) - (local-history history)) + (local-history history) + (grab-keyboard-p (xgrab-keyboard-p)) + (grab-pointer-p (xgrab-pointer-p))) (labels ((add-cursor (string) (concatenate 'string (subseq string 0 pos) "|" (subseq string pos))) (print-string () @@ -168,6 +170,9 @@ (:exposure (print-string))) t)) (xgrab-pointer *root* 92 93) + (unless grab-keyboard-p + (ungrab-main-keys) + (xgrab-keyboard *root*)) (xlib:map-window window) (print-string) (wait-no-key-or-button-press) @@ -177,7 +182,11 @@ (xlib:process-event *display* :handler #'handle-query)) (xlib:destroy-window window) (xlib:close-font font) - (xgrab-pointer *root* 66 67))) + (xungrab-keyboard) + (grab-main-keys) + (if grab-pointer-p + (xgrab-pointer *root* 66 67) + (xungrab-pointer)))) (values (when (member done '(:Return :Complet)) (push result-string history) result-string) Modified: clfswm/src/clfswm-util.lisp ============================================================================== --- clfswm/src/clfswm-util.lisp (original) +++ clfswm/src/clfswm-util.lisp Mon Sep 22 16:02:42 2008 @@ -321,9 +321,6 @@ ;;; Frame name actions -;;;(loop :for str :in '("The Gimp" "The klm" "klm" "abc") ;; Test -;;; :when (zerop (or (search "ThE" str :test #'string-equal) -1)) -;;; :collect str) (defun ask-frame-name (msg) "Ask a frame name" (let ((all-frame-name nil) From pbrochard at common-lisp.net Mon Sep 22 20:03:28 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Mon, 22 Sep 2008 16:03:28 -0400 (EDT) Subject: [clfswm-cvs] r169 - clfswm/doc Message-ID: <20080922200328.60BF75F072@common-lisp.net> Author: pbrochard Date: Mon Sep 22 16:03:27 2008 New Revision: 169 Modified: clfswm/doc/menu.html clfswm/doc/menu.txt Log: Documentation update Modified: clfswm/doc/menu.html ============================================================================== --- clfswm/doc/menu.html (original) +++ clfswm/doc/menu.html Mon Sep 22 16:03:27 2008 @@ -268,6 +268,12 @@

f: Open the next window in the current frame and leave the focus on the current child

+

+ g: Open the next window in a named frame +

+

+ h: Open the next window in a numbered frame +


Frame-Movement-Menu Modified: clfswm/doc/menu.txt ============================================================================== --- clfswm/doc/menu.txt (original) +++ clfswm/doc/menu.txt Mon Sep 22 16:03:27 2008 @@ -93,6 +93,8 @@ d: Open the next window in a new frame in the root frame e: Open the next window in a new frame in the parent frame f: Open the next window in the current frame and leave the focus on the current child +g: Open the next window in a named frame +h: Open the next window in a numbered frame Frame-Movement-Menu p: < Frame pack menu > From pbrochard at common-lisp.net Mon Sep 22 20:06:33 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Mon, 22 Sep 2008 16:06:33 -0400 (EDT) Subject: [clfswm-cvs] r170 - clfswm Message-ID: <20080922200633.3B9CD6D07A@common-lisp.net> Author: pbrochard Date: Mon Sep 22 16:06:32 2008 New Revision: 170 Modified: clfswm/clfswm.asd Log: clfswm.asd update Modified: clfswm/clfswm.asd ============================================================================== --- clfswm/clfswm.asd (original) +++ clfswm/clfswm.asd Mon Sep 22 16:06:32 2008 @@ -47,10 +47,10 @@ :depends-on ("package" "clfswm-info")) (:file "menu-def" :depends-on ("clfswm-menu" "clfswm")) + (:file "clfswm-query" + :depends-on ("package" "config" "xlib-util")) (:file "clfswm-util" :depends-on ("clfswm" "keysyms" "clfswm-info" "clfswm-second-mode" "clfswm-query" "clfswm-menu" "clfswm-autodoc" "clfswm-corner")) - (:file "clfswm-query" - :depends-on ("package" "config")) (:file "clfswm-layout" :depends-on ("package" "clfswm-internal" "clfswm-util" "clfswm-info" "menu-def")) (:file "clfswm-pack" From pbrochard at common-lisp.net Tue Sep 23 13:16:40 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Tue, 23 Sep 2008 09:16:40 -0400 (EDT) Subject: [clfswm-cvs] r171 - in clfswm: . src Message-ID: <20080923131640.35FB213071@common-lisp.net> Author: pbrochard Date: Tue Sep 23 09:16:39 2008 New Revision: 171 Modified: clfswm/ChangeLog clfswm/src/clfswm-internal.lisp clfswm/src/clfswm-util.lisp clfswm/src/menu-def.lisp Log: ensure-unique-name/number: New function and menu entry. Modified: clfswm/ChangeLog ============================================================================== --- clfswm/ChangeLog (original) +++ clfswm/ChangeLog Tue Sep 23 09:16:39 2008 @@ -1,3 +1,9 @@ +2008-09-23 Philippe Brochard + + * src/clfswm-util.lisp (ensure-unique-name): New function and menu + entry. + (ensure-unique-number): New function and menu entry. + 2008-09-22 Philippe Brochard * src/clfswm-nw-hooks.lisp (named-frame-nw-hook): New new window Modified: clfswm/src/clfswm-internal.lisp ============================================================================== --- clfswm/src/clfswm-internal.lisp (original) +++ clfswm/src/clfswm-internal.lisp Tue Sep 23 09:16:39 2008 @@ -141,6 +141,22 @@ "???") +(defgeneric set-child-name (child name)) + +(defmethod set-child-name ((child xlib:window) name) + (setf (xlib:wm-name child) name)) + +(defmethod set-child-name ((child frame) name) + (setf (frame-name child) name)) + +(defmethod set-child-name (child name) + (declare (ignore child name))) + +(defsetf child-name set-child-name) + + + + (defgeneric child-fullname (child)) (defmethod child-fullname ((child xlib:window)) Modified: clfswm/src/clfswm-util.lisp ============================================================================== --- clfswm/src/clfswm-util.lisp (original) +++ clfswm/src/clfswm-util.lisp Tue Sep 23 09:16:39 2008 @@ -1102,3 +1102,47 @@ "Set a sloppy select policy for all frames." (set-focus-policy-generic-for-all :sloppy-select)) + + +;;; Ensure unique name/number functions +(defun extract-number-from-name (name) + (when (stringp name) + (let* ((pos (1+ (or (position #\. name :from-end t) -1))) + (number (parse-integer name :junk-allowed t :start pos))) + (values number + (if number (subseq name 0 (1- pos)) name))))) + + + + +(defun ensure-unique-name () + "Ensure that all children names are unique" + (with-all-children (*root-frame* child) + (multiple-value-bind (num1 name1) + (extract-number-from-name (child-name child)) + (declare (ignore num1)) + (when name1 + (let ((acc nil)) + (with-all-children (*root-frame* c) + (unless (equal child c)) + (multiple-value-bind (num2 name2) + (extract-number-from-name (child-name c)) + (when (string-equal name1 name2) + (push num2 acc)))) + (dbg acc) + (when (> (length acc) 1) + (setf (child-name child) + (format nil "~A.~A" name1 + (1+ (find-free-number (loop for i in acc when i collect (1- i))))))))))) + (leave-second-mode)) + +(defun ensure-unique-number () + "Ensure that all children numbers are unique" + (let ((num -1)) + (with-all-frames (*root-frame* frame) + (setf (frame-number frame) (incf num)))) + (leave-second-mode)) + + + + \ No newline at end of file Modified: clfswm/src/menu-def.lisp ============================================================================== --- clfswm/src/menu-def.lisp (original) +++ clfswm/src/menu-def.lisp Tue Sep 23 09:16:39 2008 @@ -59,6 +59,8 @@ (add-menu-key 'child-menu "r" 'rename-current-child) +(add-menu-key 'child-menu "e" 'ensure-unique-name) +(add-menu-key 'child-menu "n" 'ensure-unique-number) (add-menu-key 'child-menu "x" 'remove-current-child-from-tree) (add-menu-key 'child-menu "Delete" 'remove-current-child) (add-menu-key 'child-menu "h" 'hide-current-child) From pbrochard at common-lisp.net Tue Sep 23 13:17:32 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Tue, 23 Sep 2008 09:17:32 -0400 (EDT) Subject: [clfswm-cvs] r172 - in clfswm: . doc Message-ID: <20080923131732.6DD3A471B9@common-lisp.net> Author: pbrochard Date: Tue Sep 23 09:17:32 2008 New Revision: 172 Modified: clfswm/TODO clfswm/doc/menu.html clfswm/doc/menu.txt Log: Documentation update Modified: clfswm/TODO ============================================================================== --- clfswm/TODO (original) +++ clfswm/TODO Tue Sep 23 09:17:32 2008 @@ -7,8 +7,6 @@ =============== Should handle these soon. -- Ensure-unique-number/name (new function) [Philippe] - MAYBE ===== Modified: clfswm/doc/menu.html ============================================================================== --- clfswm/doc/menu.html (original) +++ clfswm/doc/menu.html Tue Sep 23 09:17:32 2008 @@ -49,6 +49,12 @@ r: Rename the current child

+ e: Ensure that all children names are unique +

+

+ n: Ensure that all children numbers are unique +

+

x: Remove the current child from the CLFSWM tree

Modified: clfswm/doc/menu.txt ============================================================================== --- clfswm/doc/menu.txt (original) +++ clfswm/doc/menu.txt Tue Sep 23 09:17:32 2008 @@ -13,6 +13,8 @@ Child-Menu r: Rename the current child +e: Ensure that all children names are unique +n: Ensure that all children numbers are unique x: Remove the current child from the CLFSWM tree Delete: Remove the current child from its parent frame h: Hide the current child From pbrochard at common-lisp.net Tue Sep 23 19:34:59 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Tue, 23 Sep 2008 15:34:59 -0400 (EDT) Subject: [clfswm-cvs] r173 - clfswm/doc Message-ID: <20080923193459.455AD7C047@common-lisp.net> Author: pbrochard Date: Tue Sep 23 15:34:58 2008 New Revision: 173 Modified: clfswm/doc/dot-clfswmrc Log: dot-clfswmrc update Modified: clfswm/doc/dot-clfswmrc ============================================================================== --- clfswm/doc/dot-clfswmrc (original) +++ clfswm/doc/dot-clfswmrc Tue Sep 23 15:34:58 2008 @@ -20,8 +20,11 @@ (setf *color-unselected* "Blue") -;;(defparameter *fullscreen* '(0 4 800 570)) -(defparameter *fullscreen* '(0 0 1024 750)) +;;; How to change the default fullscreen size +(defun get-fullscreen-size () + "Return the size of root child (values rx ry rw rh) +You can tweak this to what you want" + (values -2 -2 (+ (xlib:screen-width *screen*) 2) (- (xlib:screen-height *screen*) 20))) ;;; Contributed code example @@ -54,7 +57,7 @@ ;;;; Reloading example -(defun reload-clfswm () +(defun my-reload-clfswm () "Reload clfswm" (format t "RELOADING... ") (ungrab-main-keys) @@ -64,7 +67,7 @@ (format t "Done!~%")) -(define-main-key ("F2" :mod-1) 'reload-clfswm) +(define-main-key ("F2" :mod-1) 'my-reload-clfswm) (define-main-key ("F3" :mod-1) (lambda () (do-shell "rxvt"))) @@ -91,7 +94,7 @@ ;;; documentation associated to each key press. (defun display-osd (formatter &rest args) (do-shell "pkill osd_cat") - (do-shell (format nil "echo ~A | osd_cat -d 3 -p bottom -o -45 -f -*-fixed-*-*-*-*-12-*-*-*-*-*-*-1" + (do-shell (format nil "echo ~A | osd_cat -d 3 -p bottom -o -60 -f -*-fixed-*-*-*-*-16-*-*-*-*-*-*-1" (apply #'format nil formatter args))) (force-output)) @@ -120,12 +123,51 @@ (declare (ignore event-slots)) (display-doc *second-keys* code state)) -;; Define new hook or add to the previous one +;; Define new hook or add to precedent one (if (consp *key-press-hook*) (push #'display-key-osd-main *key-press-hook*) (setf *key-press-hook* (list #'display-key-osd-main #'handle-key-press))) (setf *sm-key-press-hook* (list #'display-key-osd-second #'sm-handle-key-press)) + +;;; Display menu functions +(defun open-menu (&optional (menu *menu*)) + "Open the main menu" + (let ((info-list nil) + (action nil)) + (dolist (item (menu-item menu)) + (let ((value (menu-item-value item))) + (push (typecase value + (menu (list (list (format nil "~A" (menu-item-key item)) *menu-color-menu-key*) + (list (format nil ": < ~A >" (menu-doc value)) *menu-color-submenu*))) + (string (list (list (format nil "~A" (menu-item-value item)) *menu-color-comment*))) + (t (list (list (format nil "~A" (menu-item-key item)) *menu-color-key*) + (format nil ": ~A" (documentation value 'function))))) + info-list) + (when (menu-item-key item) + (define-info-key-fun (list (menu-item-key item) 0) + (lambda (&optional args) + (declare (ignore args)) + (setf action value) + (throw 'exit-info-loop nil)))))) + (info-mode (nreverse info-list)) + (dolist (item (menu-item menu)) + (undefine-info-key-fun (list (menu-item-key item) 0))) + (typecase action + (menu + (display-osd "Open Menu: ~A" (menu-doc action)) ;; <- Display here + (open-menu action)) + (t (when (fboundp action) + (display-osd "~A" (documentation action 'function)) ;; <- Display here + (funcall action)))))) + + + +(defun get-fullscreen-size () + "Return the size of root child (values rx ry rw rh) +You can tweak this to what you want" + (values -2 -2 (+ (xlib:screen-width *screen*) 2) (- (xlib:screen-height *screen*) 20))) + ;;; -- Doc example end -- From pbrochard at common-lisp.net Sun Sep 28 21:02:29 2008 From: pbrochard at common-lisp.net (pbrochard at common-lisp.net) Date: Sun, 28 Sep 2008 17:02:29 -0400 (EDT) Subject: [clfswm-cvs] r174 - in clfswm: . src Message-ID: <20080928210229.90ADB7903C@common-lisp.net> Author: pbrochard Date: Sun Sep 28 17:02:28 2008 New Revision: 174 Modified: clfswm/TODO clfswm/src/clfswm-second-mode.lisp Log: TODO update Modified: clfswm/TODO ============================================================================== --- clfswm/TODO (original) +++ clfswm/TODO Sun Sep 28 17:02:28 2008 @@ -7,9 +7,7 @@ =============== Should handle these soon. - -MAYBE -===== +- Handle numlock properly (add :mod-2 in bindings if necessary) - Show config -> list and display documentation for all tweakable global variables. [Philippe] TODO : @@ -19,6 +17,18 @@ ... ;;;; AUTO-CONFIG End : You can add your configurations below this line. +- Remote access to the clfswm REPL [Philippe] + Protocol: Server: Ask: random-number + Client: Reply: associated random-number + Server: Ok + Client: a lisp form (+ 2 2) + ... + Random-number at compile time: '((rnd-1-server rnd-1-client) (rnd-1-server rnd-1-client) (rnd-1-server rnd-1-client) ...) + + + +MAYBE +===== - cd/pwd a la shell to navigate throw frames. [Philippe] @@ -40,10 +50,3 @@ - Mouse support in menu? -- Remote access to the clfswm REPL [Philippe] - Protocol: Server: Ask: random-number - Client: Reply: associated random-number - Server: Ok - Client: a lisp form (+ 2 2) - ... - Random-number a compile time: '((rnd-1-server rnd-1-client) (rnd-1-server rnd-1-client) (rnd-1-server rnd-1-client) ...) Modified: clfswm/src/clfswm-second-mode.lisp ============================================================================== --- clfswm/src/clfswm-second-mode.lisp (original) +++ clfswm/src/clfswm-second-mode.lisp Sun Sep 28 17:02:28 2008 @@ -219,6 +219,8 @@ "Leave second mode" (cond (*in-second-mode* (banish-pointer) + (setf *in-second-mode* nil) (throw 'exit-second-loop nil)) - (t (show-all-children)))) + (t (setf *in-second-mode* nil) + (show-all-children))))