Hi all,

A few years ago, for a solid month, I gave up my beloved Openbox for
ctwm. Here are some articles:

http://troubleshooters.com/linux/ctwm/

My reason was to try to use something EVEN MORE lightweight than
Openbox. The benefit I found was configurability beyond my most
pie-in-the-sky hopes. After a solid month I went back to Openbox for
one and only one reason: The behavior normally associated with Alt+Tab
on other window managers, DEs, and Windows UIs.

Alt+Tab on Windows, Openbox, Gnome, IceWM, and most other user
interfaces works with a stack. The current foreground window is at
the top of the stack. You press the Alt key. The first time you
simultaneously press Tab, you see a representation of the window second
to the top of the stack. Release and press Tab again while still
holding Alt, you see the third to top of the stack. Etc. When you
finally release the Alt key, the window of the stack item you'd
Alt+Tabbed to comes to the top, has focus, and the former top focus
window becomes the second to the top of the stack.

I dislike Microsoft and Bill Gates, but one thing I have to give them
credit for is that in Win95, they sat down hundreds of users for
useability tests, listened to those users, and make the Win95 User
Interface a marvel of intuition and ease, not just for mouse fans, but
for keyboard fans too. 

I worked a solid month with ctwm's ring based window navigation,
performed every workaround I could think of, including assigning
separate next and previous on the ring hotkeys, worked day in and day
out with it for a solid month, that's hundreds or perhaps over 1000
uses of those keystrokes, and I just couldn't get used to it. 

I'm a guy who adapts to his machine or software. In my youth I built
bicycles out of parts from dumpsters, and if my bicycle constantly
steered to the left, within a couple days I didn't notice because I'd
compensated for it. I've driven cars with stiff clutches, easy
clutches, worn out loose clutches, brand new tight clutches, and no
clutches at all (automatic transmission), sputtering engines on the
border of stall, crisp engines with get-up-and-go, bouncy suspensions
and stiff suspensions, without a problem after a couple days. But some
things, like a bicycle, car or skateboard with oscillatory steering,
or, more on topic, ring based as opposed to stack based window
switching, I could never get used to.

Could you please add stack-based Alt+Tab behavior to ctwm? My guess is
it would require the following:

1) Detection of both key-down and key-up on mod keys such as Ctrl, Alt,
   Shift, and Windows. I'm pretty sure that's available from X.

2) A stack. That's trivial: I could code it myself, but connecting it
   to existing ctwm code would be difficult for me.

3) Whatever facility currently inserts windows into and deletes windows
   from the ring would also need to do the same thing with the stack. 

Implementation could be via at_plunge(), at_select(), at_add(), and
at_delete() where "at" stands for "Alt+Tab". Naturally, they could be
named anything. Here's pseudocode, keeping in mind there'd need to be
one stack for each workspace:




at_plunge()
        If not stacks_enabled
                return
        If at stack bottom
                Go to stack top
        else
                Go down one level on the stack

at_select()
        If not stacks_enabled
                return
        Remove current item from stack
        Suck down everything above current by 1 
        Push current item onto top of stack
        Move window for now-top stack item to foreground
        Move ring pointer to now-top in ring    
        
at_delete()
        If not stacks_enabled
                return
        Remove current item from stack
        Suck down everything above current by 1 
        // No need to adjust the ring, other things did that
        
at_add()
        If not stacks_enabled
                return
        Create new stack item for new window
        If new window intended to have focus
                Open new window, with focus
                Push the new stack item
        else
                Open new window below all else on workspace
                Insert new stack item at bottom of stack
        // No need to adjust the ring, other things did that

The beauty of this is it's a tight module easy to plug in without major
disruption to any other part of ctwm. It adds an alternative to the
window ring, but doesn't replace it. It has a small interface to the
existing ctwm:

* Every time you add a window to the ring, add it to the stack. The
  stack is completely separate from the ring.

* Every time you delete a window from the ring, delete it from the
  stack.

* Every time you move the ring pointer and display a new window, perform
  a corresponding at_select() on the stack

* Every time you do an at_select(), move the ring pointer to the
  selected window.

* Add at_keycombo more item to .ctwmrc, which also implies
  stacks_enabled = True (Default is False)

The preceding is a mighty thin interface. For the most part, the stacks
stand on their own, on the outside of the existing ctwm. Nobody would
be required to use the new stacks capability, by default it would be
disabled, and I could probably figure out a way to disable it during
compile, so even the few ctwm calls to things like at_select() become
no-ops if the stacks capability is disabled at compile time.

If there's some interest in this, I can write C code implementing the
preceding pseudocode, and then somebody with more ctwm knowledge can
simply "plug it in."

What do you think?

Thanks,
 
SteveT

Steve Litt 
Autumn 2020 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive

Reply via email to