Subject: FVWM: vi movement on windows

From: Keith Kaple <[email-masked]>
Date: Tue, 26 Jun 2001 10:04:37 -0400

I'd like to config for <control> <j|k|l|h> to move between the current desktop windows in a vi fashion based on the geometrical location of upper left corner.

Does anyone have a config for this?

thanks
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Max Ischenko <[email-masked]>
Date: Tue, 26 Jun 2001 17:16:58 +0300

> I'd like to config for <control> <j|k|l|h> to move between the current desktop windows in a vi fashion based on the geometrical location of upper left corner.

Read about Key and GotoPage commands in man fvwm2.

-- 
Best regards, Maxim F. Ischenko.

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 26 Jun 2001 16:22:25 +0200

> Does anyone have a config for this?

The "Direction" command may do what you want:

  key j a c Direction South (currentpage) Focus
  key k a c Direction North (currentpage) Focus
  key h a c Direction West (currentpage) Focus
  key l a c Direction East (currentpage) Focus

Window selection is not based on the top left corner though, but a
complex formula that takes the corners into account as well as the
window centers.  You need 2.2.x for the Direction command.

Bye

Dominik ^_^  ^_^

--
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Louis LeBlanc <[email-masked]>
Date: Tue, 26 Jun 2001 14:29:39 -0400

Kind of funny, I am changing every config I can get hold of to be more
VI-like, but it never occurred to me to do this to my wm!
Here is what I came up with, and it work for me:

First, my current setting for window scrolling (pretty much the
canned setup):

# press arrow + control anywhere, and scroll by 1 page
Key Left        A       C       Scroll -100 +0
Key Right       A       C       Scroll +100 +0
Key Up          A       C       Scroll +0   -100
Key Down        A       C       Scroll +0   +100
Key Left        A       C2      Scroll -100 +0
Key Right       A       C2      Scroll +100 +0
Key Up          A       C2      Scroll +0   -100
Key Down        A       C2      Scroll +0   +100

# VI like window scrolling
Key h           A       C       Scroll -100 +0
Key l           A       C       Scroll +100 +0
Key k           A       C       Scroll +0   -100
Key j           A       C       Scroll +0   +100
Key h           A       C2      Scroll -100 +0
Key l           A       C2      Scroll +100 +0
Key k           A       C2      Scroll +0   -100
Key j           A       C2      Scroll +0   +100

the last 4 in each bloc, with mod C2 allows me to get this behavior
even when the NumLock is on.  Yours may be different.

HTH

Lou

-- 
Louis LeBlanc
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
[email-masked]
http://acadia.ne.mediaone.net                Ô¿Ô¬
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Keith Kaple <[email-masked]>
Date: Tue, 26 Jun 2001 11:59:39 -0400

Thanks, this is closest to what I am looking for, but I guess it will take some work.  For example if I cascade 5 xterms in the upper right hand corner:

|___1_
  |___2_
    |___3_
      |___4_
        |___5_

I expect repeating j or k to move 12345 and 54321 respectively, they don't...

actually they go 1345 and 521, like it wants to work, but something else is "attracting" the focus to the wrong window...

I added !iconic and currentdesk, it seemed to change behavior to be a little better, but still not pure "closest window center" selection.

Tried FlipFocus too, is there anyway to alter the "complex formula"?  Or at least fake it out ;+)

Version 2.2.2

thanks,

K

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 27 Jun 2001 01:25:50 +0200

On Tue, Jun 26, 2001 at 11:59:39AM -0400, Keith Kaple wrote:
> Thanks, this is closest to what I am looking for, but I guess
> it will take some work.  For example if I cascade 5 xterms in
> the upper right hand corner:
> 
> |___1_
>   |___2_
>     |___3_
>       |___4_
>         |___5_
> 

Ah, yes.  Cascaded windows are usually not really in a
North-South relationship.  The code divides the area around a
window into four sectors:

  \  N  /
   \   /
    \ /
  W  o  E
    / \
   /   \
  /  S  \

Any window with its center in the South sector will be preferred
to any window in the E or W sector with its center lower than the
current window.  Cascading to the bottom right is just along the
border between S and E or even already in E.  Using S here does
not give predicatable results if your window are wider than they
are tall and E fails if they are taller.  Both fail if you have
tall and wide windows.  In your case, the best solution is to use
the diagonal directions SouthEast, NorthWest, ...

  NW  |  NE
      |
      |
  ----o----
      |
      |
  SW  |  SE

> actually they go 1345 and 521, like it wants to work, but
> something else is "attracting" the focus to the wrong window...
> 
> I added !iconic and currentdesk, it seemed to change behavior to
> be a little better, but still not pure "closest window center"
> selection.

The selection is base on the angle between the direction from
the window center and the lines between both window centers:

  +-----+
  |  o  |
  +-----+
     
       +-+
    +-+|2|
    |1|+-+
    +-+

Let's assume "o" has the focus.  The window centers of "1" and "2"
have exactly the same distance from "o", but since "1" deviates
0 degrees from the South direction while "2" deviates about 37
degrees.  So, "1" is chosen, not "2" - even if "2" were a bit
closer.

> Tried FlipFocus too, is there anyway to alter the "complex
> formula"?

Only by changing the code in the DirectionFunc() in builtins.c.
(Or CMD_Direction() in conditionals.c for 2.3.x).  We are aware
that this formula will never suit every need, but making it
configurable seemed overkill.

> Or at least fake it out ;+)
> 
> Version 2.2.2

Bye

Dominik ^_^  ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].