:: [DNG] ctwm
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Steve Litt
Ημερομηνία:  
Προς: dng
Καινούρια Θέματα: [DNG] No more GOSFUI
Αντικείμενο: [DNG] ctwm
Hi all,

Dave Turner mentioned ctwm in the "devuan ascii - how much of systemd is
still in there? UPDATE" thread, and because I've failed at every
attempt to use twm, I tried ctwm.

The package manager installs it like a breeze, but in the tradition of
Debian packages, it doesn't work out of the box. First problem: The
Debian package forgets to install /usr/share/xsessions/ctwm.desktop, so
pressing F1 on the slim login screen doesn't find it. You can't get to
ctwmrc using normal methods. Oops.

So create the following /usr/share/xsessions/ctwm.desktop :

==================================================
## /etc/dm/Sessions/ctwm.desktop ##

[Desktop Entry]
Name=ctwm
Comment=ctwm
Exec=/usr/bin/ctwm
TryExec=/usr/bin/ctwm
Terminal=True
Type=Application
==================================================

Don't ask me what all that gibberish means: I just copied it from
lxde.desktop and changed the obvious.

Now slim sees and delivers ctwm, so you have a fully functional ctwm,
which is one of the most configurable WMDEs around (I have a temporary
moritorium on the word GOSFUI).

Things look up: You can F1 through slim to get to ctwm, but The menus
from clicking the desktop don't work. You navigate to the "Debian"
selection, release the left mouse button, and nothing happens. Not to
worry, this is a ctwm-ism: When navigating to a an item, you must move
the mouse pointer to the right in order to sub-navigate. That little
tidbit should be in the README, but now you know. You have a great and
functional WMDE.

Now that you can navigate the menu system, you notice that dragging all
the way right on the "Exit" choice gives you the choice of "No, restart
ctwm" or "Yes, really quit". Choosing the former updates your running
ctwm to the current ~/.ctwmrc, thereby removing the necessity to go
all the way back to slim's mandatory F1 every time you try a new
config element. From now on I'll use the phrase "restart twm" for the
procedure consisting of "leftclick desktop, navigate to Exit, drag right
to the little square, choose "No, restart ctwm".

So now you can use the menus. But, oops, you have no way to change your
ctwm configuration, because you have no ~/.ctwmrc file. You'll soon fix
that:

cp /etc/X11/ctwm/system.ctwmrc ~/.ctwmrc

Restart ctwm, and cool, you have a perfectly running ctwm.

If you only use a mouse...

Trouble is, as it ships from the factory, ctwm is extremely keyboarder
hostile. Try it and see: No matter what you do with your keyboard, you
need to grab your mouse to fix the focus. Given that most lightweight
WMDE users are keyboardists, this is a problem.

Or not.

Edit ~/.ctwmrc after copying it elsewhere, and add the following lines
below the list of simple settings like "NoGrabServer" or "GrabServer",
"DecorateTransients", the font assignments, etc, add the following
lines:

==================================================
UsePPosition "on"       # Help kbd instantiated windows get focus
RandomPlacement "on"    # Help kbd instantiated windows get focus
AutoFocusToTransients   # Help kbd instantiated windows get focus
SaveWorkspaceFocus      # Obviously workspace focus should be retained
WindowRing              # Enable Alt+Tab type window circulation
WarpRingOnScreen        # Enable Alt+Tab type window circulation
==================================================


Now go below all the Button assignments as well as any hotkey
assignments, and add the following:

==================================================
# HOTKEY DMENU Ctrl+Shift+;
"semicolon" = s | c : all : f.exec "/home/myuid/bin/dmenu_litt.sh"

# HOTKEY defops MENU, HIGHEST LEVEL CTWM MENU
"comma" = s | c : all : f.menu "defops"

# HOTKEY LIST OF ALL MENUS ON ALL WORKSPACES
"period" = s | c : all : f.menu "TwmAllWindows"

# NOTE! ALT+TAB CANNOT BE MADE TO WORK.
# USE Ctrl+Shift+h and Ctrl+Shift+l instead.
"h" = s | c : all : f.warpring "prev" # HOTKEY REV THIS WKSPC WINS
"l" = s | c : all : f.warpring "next" # HOTKEY FWD THIS WKSPC WINS

"u" = s | c : all : f.menu "TwmWindows" # HOTKEY THIS WKSPACE WIN LIST
==================================================

In the preceding, dmenu_litt.sh is simply a shellscript that calls
dmenu_run in a way that menus vertically instead of horizontally, and
displays a readable size font in good contrast colors. See the dmenu
man page for the proper arguments to dmenu_run, which simply passes
command line arguments to dmenu.

Restart ctwm and you have a dmenu-enabled, Shift+Ctrl+h and
Shift+Ctrl+l cycling productivity machine.

There are other things you can do to make it more keyboarder friendly.
Find the name of the context for being in a menu, and in that context
alone, hotkey vim keys j,k,h and l to go down one choice, up one
choice, plunge into a submenu, and return from submenu, respectively. I
didn't find a way to do it, but I bet I could.

Bigger kudos if you can find a way to make Alt+Tab work the same as in
Fvwm or LXDE, although my Shift+Ctrl+h (and l) render that a luxury
rather than a necessity. If you really want to use ctwm as your daily
driver, be sure to install easy hotkeys to navigate between workspaces.
You also need a comfortable hotkey to close the current window: Note
that twm, at least as it comes from the factory, has no "close" widget
on the titlebar, and Alt+F4 does nothing (but Alt+F4 is a horribly
inconvenient hotkey for close window: I prefer Alt+0). I'm pretty sure
that if one spends some time with ctwm, one can make it into a
perfectly crafted productivity machine. DaveT, thanks for cluing me in
to ctwm!

I don't know how resource-conserving ctwm is compared to twm, Openbox
and its other competitors, but I believe ctwm can be crafted into a
demu-equipped, keyboarder high productivity machine just like Openbox
and all the others, while still respecting your machine's resources and
not spending them profligately.

SteveT