[clfswm-devel] Questions / Feature requests regarding the focus policy

Philippe Brochard pbrochard at common-lisp.net
Thu Mar 28 21:59:55 UTC 2013


Renaud Casenave-Péré a écrit :

> On Mon, Mar 25 2013, Philippe Brochard wrote:
>
[Sorry for the lag]

>> Ok, so we need to hack a new sloppy focus method which follow mouse over
>> windows and not only over frames. And we need to move the mouse on the
>> new focused window since its position may have changed according to the
>> frame layout used. Does something like :sloppy-select-window in commit
>> d6b1dd9 do what you want?
>> It's not finished code (there is some glitch) but the idea is here.
>
> Yes that's the behavior I was hoping for. Thank you.
>
Ok, so I'll clean it up.

>> Myself I think I don't like the automatic mouse move.
>
> I just thought of :tile-layout-keep-position when set to false, and you're
> right, if the mouse automatically moves, it would feel pretty weird...
> Maybe move it only when the focus changes with the keyboard... It's a more
> complex change than I thought.
>
I think we can focus window without changing their position even when
:tile-layout-keep-position is set to true.

This'll need some little more work. I'll have a look as soon as
possible. 

>> Ah, so, you can make it the default new window hook:
>>
>> (setf *default-nw-hook* 'leave-focus-frame-nw-hook)
>
> Oh, very nice. I didn't know it would work for every focus stealing. Thanks.
>
Yes, and you can write your own if your not happy with mine :-)


>> Yes you can paste it here or fork clfswm git repo and ask for a git pull
>> request.
>
> Here you go:
>
> #+begin_src lisp
> (defun three-columns-layout (child parent)
>   "Three Colums: main child in the middle, others on the two sides."
>   (with-slots (rx ry rw rh) parent
>     (let* ((managed-children (update-layout-managed-children child parent))
>            (pos (child-position child managed-children))
>            (len (max (1- (length managed-children)) 1))
>            (dy (round (/ rh (max (truncate (/ (+ (if (oddp pos) 1 0) len) 2)) 1))))
>            (size (or (frame-data-slot parent :tile-size) 0.75))
>            (other-size (if (> len 1) (/ (- 1 size) 2) (- 1 size))))
>       (if (> (length managed-children) 1)
>           (if (= pos 0)
>               (values (adj-border-xy (if (> len 1)
>                                          (round (+ rx (* rw other-size)))
>                                          rx) parent)
>                       (adj-border-xy ry parent)
>                       (adj-border-wh (round (* rw size)) child)
>                       (adj-border-wh rh child))
>               (values (adj-border-xy (if (oddp pos)
>                                          (round (+ rx (* rw (if (> len 1) (+ size other-size) size))))
>                                          rx) parent)
>                       (adj-border-xy (round (+ ry (* dy (truncate (/ (1- pos) 2))))) parent)
>                       (adj-border-wh (round (* rw other-size)) parent)
>                       (adj-border-wh dy parent)))
>           (no-layout child parent)))))
>
> (defun set-three-columns-layout ()
>   "Three Columns: main child in the middle, others on the two sides."
>   (layout-ask-size "Tile size in percent (%)" :tile-size)
>   (set-layout-managed-children)
>   (set-layout #'three-columns-layout))
> #+end_src
>
> It's a bit ugly, though... You are free to rewrite it as much as you want.
> At least it gets the job done.
>
Ok, same thing, I'll have a look as soon as possible.
Thanks a lot for the code.

>> yes, clfswm is very rich and I use myself only a few part of all its
>> features :-) 
>
> Yes, I see that :)





More information about the clfswm-devel mailing list