So, after some thinking I made a first go at a window ring that behaves
like a stack.

Based on the following observations:

- The difference between a window ring and a stack is effective at
  the moment the modifier key is released.
  - at modifier-down time, we remember the "top of the stack".
  - at modifier-up time, we move window we moved to (if any) to the top
    of the stack.
- So if we can do some administrative work both when the modifier is pressed
  and when it is released, we can make a ring into a stack.
- We can already make bindings for pure modifier keys.
- All current bindings are for key-down events.
- We can make bindings for key-up events if we pretend this is a new modifier.

# This makes bindings for the usual window ring:
"Tab"     = m4             : all : f.warpring "next"
"Tab"     = m4 | s         : all : f.warpring "prev"
"Return"  = m4             : all : f.ring

# This turns the window ring behaviour into a stack behaviour:
# Note that the Super key corresponds to modifier 4.
"Super_L" =                : all : f.warpring "startstack"
"Super_L" = up | m4        : all : f.warpring "finishstack"


You can find a branch at
https://code.launchpad.net/~ctwm/ctwm/windowstack
(lp:~ctwm/ctwm/windowstack). I guess that's a "ctwm" more than needed
but I had to try a few times to get the syntax right and I didn't want
to overwrite trunk.

There are some things in it that I'm not so happy about yet.

- Names of things. startstack and finishstack aren't the best names, but
  the code in f.warpring looks at the first letter only right now to
  decide, so I wanted distinct first letters.

- I factored out some code to manipulate the window ring (add and remove
  a window) and I'm not sure in which source file that belongs.

- There are probably some edge cases that this code doesn't handle. I
  tested it lightly and that seemed to work though.

-Olaf.
-- 
Olaf 'Rhialto' Seibert -- rhialto at falu dot nl
___  Anyone who is capable of getting themselves made President should on
\X/  no account be allowed to do the job.       --Douglas Adams, "THGTTG"

Attachment: signature.asc
Description: PGP signature

Reply via email to