cwm, minimalistic window manager

Window managers, icon programs, widgets, etc.
Post Reply
Message
Author
User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

cwm, minimalistic window manager

#1 Post by Iguleder »

Here's cwm, one of the best lightweight window managers around. It's a window manager for those who like doing stuff with the keyboard - you can do anything with cwm, using just two or three keyboard strokes.

It also gives windows nothing but a 1px border, so it's ideal for small screens.

There are many old Linux packages for it, but none of them are recent, so I ported it on my own. This is the latest version, from OpenBSD's CVS.

The package was built on Puppy 5.3. Since libbsd is missing in Slackware, I also built a tiny package and attached it.

More information: here, see the screenshot :)
Dependencies: libbsd, attached too.
Documentation: here and here, except one change - Shift is replaced with Super (the Windows key). The reason for this is conflicts with other key bindings.

Here's my build script:

Code: Select all

#!/bin/sh

PKG_NAME="cwm"
PKG_VER="cvs$(date +%d%m%Y)"
PKG_REV="1"
PKG_DESC="Minimalistic window manager"
PKG_CAT="BuildingBlock"
PKG_DEPS="+libbsd"

download() {
	[ -f $PKG_NAME-$PKG_VER.tar.xz ] && return 0

	# download the sources
	mkdir $PKG_NAME-$PKG_VER
	[ $? -ne 0 ] && return 1

	# determine the list of source files
	wget -O index.html http://www.openbsd.org/cgi-bin/cvsweb/xenocara/app/cwm
	[ $? -ne 0 ] && return 1
	files="$(cat index.html | grep href=\"./ | cut -f 10 -d \=  | cut -f 2 -d \> | cut -f 1 -d \<)"
	[ $? -ne 0 ] && return 1
	rm -f index.html
	[ $? -ne 0 ] && return 1

	# download the source files
	for i in $files
	do
		wget -O $PKG_NAME-$PKG_VER/$i "http://www.openbsd.org/cgi-bin/cvsweb/xenocara/app/cwm/$i?rev=HEAD;content-type=text%2Fplain"
		[ $? -ne 0 ] && return 1
	done

	# create a sources tarball
	tar -c $PKG_NAME-$PKG_VER | xz -9 > $PKG_NAME-$PKG_VER.tar.xz
	[ $? -ne 0 ] && return 1

	# clean up
	rm -rf $PKG_NAME-$PKG_VER
	[ $? -ne 0 ] && return 1

	return 0
}

build() {
	# extract the sources
	tar -xJvf $PKG_NAME-$PKG_VER.tar.xz
	[ $? -ne 0 ] && return 1

	cd $PKG_NAME-$PKG_VER

	# patch the package to link against libbsd instead of having the BSD C
	# library functions compiled in statically
	echo -n '--- cwm-cvs01122011-orig/calmwm.h	2011-12-01 11:46:46.034898678 +0200
+++ cwm-cvs01122011/calmwm.h	2011-12-01 11:47:41.445205948 +0200
@@ -31,6 +31,15 @@
 #include <X11/extensions/Xrandr.h>
 #include <X11/keysym.h>

+/* BSD C library functions, through libbsd */
+#include <bsd/stdio.h> /* fgetln() */
+#include <bsd/stdlib.h> /* strtonum() */
+#include <bsd/string.h> /* strlcat(), strlcpy() */
+
+/* two missing BSD C library definitions */
+#define TAILQ_END(head) NULL
+#define __dead
+
 #undef MIN
 #undef MAX
 #define MIN(x, y) ((x) < (y) ? (x) : (y))
' | patch calmwm.h
  	[ $? -ne 0 ] && return 1

	# add a missing header to xevents.c and kbfunc.c
	sed -i s/'#include <unistd.h>'/'&\n#include <signal.h>'/ xevents.c kbfunc.c
  	[ $? -ne 0 ] && return 1

	# replace the Shift key with Super, so key bindings of GTK+ or Qt do not
	# conflict with cwm
	sed -i s/'ShiftMask'/'Mod4Mask'/ conf.c
  	[ $? -ne 0 ] && return 1

	# build the package
	bison.yacc parse.y
	[ $? -ne 0 ] && return 1
	cc $CFLAGS $(pkg-config --libs libbsd xft xinerama xrandr xcb xft x11 xau xdmcp fontconfig xext) -lexpat -lfreetype -lz -o cwm *.c
	[ $? -ne 0 ] && return 1

	return 0
}

package() {
	# install the package
	install -D -m755 cwm $INSTALL_DIR/usr/bin/cwm
	[ $? -ne 0 ] && return 1
	install -D -m644 cwm.1 $INSTALL_DIR/usr/share/man/man1/cwm.1
	[ $? -ne 0 ] && return 1
	install -D -m644 cwmrc.5 $INSTALL_DIR/usr/share/man/man5/cwmrc.5
	[ $? -ne 0 ] && return 1

	# install the license
	install -D -m644 LICENSE $INSTALL_DIR/$LEGAL_DIR/$PKG_NAME/LICENSE
	[ $? -ne 0 ] && return 1

	# add the post-install script
	echo -n "#!/bin/sh

echo \"Setting cwm as the default window manager\"
echo cwm > ./etc/windowmanager" > $INSTALL_DIR/pinstall.sh
	[ $? -ne 0 ] && return 1
	chmod 755 $INSTALL_DIR/pinstall.sh
	[ $? -ne 0 ] && return 1

	return 0
}
Attachments
libbsd-0.3.0.tar.gz
sources
(100.01 KiB) Downloaded 728 times
libbsd_DOC-0.3.0.pet
(24.25 KiB) Downloaded 720 times
libbsd_DEV-0.3.0.pet
(16.73 KiB) Downloaded 718 times
libbsd-0.3.0.pet
(18.24 KiB) Downloaded 804 times
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
harii4
Posts: 448
Joined: Fri 30 Jan 2009, 04:08
Location: La Porte City, IA , U.S.A.
Contact:

#2 Post by harii4 »

Here's cwm, one of the best lightweight window managers around.
Development of cwm started from patches to evilwm - ahhh it started with greatness :twisted:

I'll have to look for an older one - i don't think it'll work with Txz-pup.
3.01 Fat Free / Fire Hydrant featherweight/ TXZ_pup / 431JP2012
----------------------------------------------------------------------------------------
Peace and Justice are two sides of the same coin.

User avatar
harii4
Posts: 448
Joined: Fri 30 Jan 2009, 04:08
Location: La Porte City, IA , U.S.A.
Contact:

#3 Post by harii4 »

How about an DotPet for older puppys? :?
3.01 Fat Free / Fire Hydrant featherweight/ TXZ_pup / 431JP2012
----------------------------------------------------------------------------------------
Peace and Justice are two sides of the same coin.

User avatar
harii4
Posts: 448
Joined: Fri 30 Jan 2009, 04:08
Location: La Porte City, IA , U.S.A.
Contact:

#4 Post by harii4 »

http://people.debian.org/~roktas/debian ... ain/c/cwm/
an .deb (deb2pet) cwm that works in puppy 4 and txz-pup.
you still need libbsd.pet too.
3.01 Fat Free / Fire Hydrant featherweight/ TXZ_pup / 431JP2012
----------------------------------------------------------------------------------------
Peace and Justice are two sides of the same coin.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#5 Post by rufwoof »

Reviving a old thread - just to add a reference http://murga-linux.com/puppy/viewtopic. ... 59#1017159 ... to using cwm in EasyOS

The appeal for me is it removes Puppy bloat and temptation to tweak the look of a desktop, which after all is just a program launcher. And the periodic annoyance of a desktop being corrupted (loss of icons or tray launchers etc.).

Simple/light single file configuration, for example here's my /root/.cwmrc

Code: Select all

# .cwmrc
# 
gap									2 0 0 0
ignore								xclock
ignore								xload
color inactiveborder         Black
color activeborder			"#494949" 
color groupborder			"#01a252"
color urgencyborder		"#3d9751"
color selfont						"#0034A9"
color font							"#FFFFFF"
color menufg					"#49F6F6"
color menubg					"#333333"
fontname						"DejaVu Sans:size=14:antialias=true"
bind-key CM-comma		"amixer set Master 5%-"
bind-key CM-period         "amixer set Master 5%+"
command " sakura "        "sakura"
command " Audacious "	"audacious"
command " Office "			"soffice"
command " mtpaint "		"mtpaint"
command " firefox "		"/shared-folder/firefox64/ff"

command " " "nul"
command " Pup Advert Blocker " "pup-advert-blocker"
command " Firewall "	"firewall_ng"

command "  " "nul"
command " EXIT " "pkill cwm"
My preference is to boot to cli (qfix=nox (pfix under puppy)), load up tmux and have a tput based menu on one tmux window (that contains shutdown, reboot, mounts ..etc admin commands), and another tmux window that I launch X from, using xwin for a full root type jwm/rox desktop (for admin purposes), or in EasyOS I've created a ewin script that launches X within a Xephyr/pflask (container i.e. chroot with capabilities dropped etc.). Whilst it still runs as root within that container, root is very heavily restricted, as good as a restricted userid, so your browser etc. can run securely within that. For that ewin X session I use cwm.

The main/default tab in my browser shows the date/time in its title and contains all my bookmarks (manually maintained). I clear out cache etc. (ctrl-shift-delete) often, typically after logging out of one web site so that other web sites can't steal those userid/passwords (via cross scripting) and if there is a browser flaw that opens up remote execution, they're very restricted in what that can do (xephyr/container). EasyOS snapshots/rollbacks are quick/easy also, so resetting a container back to pristine/clean is comforting. I run a portable firefox quantum, so that auto updates also.

Firefox within cwm has no title bar, no tray ...etc. so more screen real estate, makes other window managers such as jwm look very letter-box looking. Typically in cwm I maximise all windows and just alt-tab between those (or left mouse in the top of screen 2 pixel region for the open windows list menu). As per the above config file I leave a 2 pixel top of screen so when a window is maximised (ctrl-alt-M) I can still left/middle/right mouse click that region (desktop) to show the cwm applications/groups/windows menus (attached full screen (first) image shows my right mouse in top of screen applications menu).

Second (somewhat flared) image is a picture taken using my phone of the console (tty1 i.e. ctrl-alt-F1). I've recently reverted to using 640x480 again for that, after having tried 800x600 for a while i.e. video=640x480 kernel boot parameter (in grub4dos menu.lst)
Attachments
s.jpg
(34.75 KiB) Downloaded 583 times
c.jpg
(24.13 KiB) Downloaded 561 times
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

Hi, rufwoof.

Yikes.

I usually like alternative WMs, but this one is going too much on
the "empty" side.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#7 Post by rufwoof »

Hi musher0

I have ctrl-alt-F1 showing a real root tmux session, with multiple windows within that, one showing a tput based admin window (shutdown, reboot, mount things etc.) another that I used to launch X, and I've just added a third with some system monitoring things being displayed (top and a cpu usage chart) - just posted about that here

ctrl-alt-F3 is set to DISPLAY:1 ... on which I run a easy container (Xephyr/pflask) i.e. still root, but a capabilities etc dropped root, so very much like a very restricted userid. Within that I use cwm as the window manager.

ctrl-alt-F4 is standard EasyOS (real root), that uses jwm/rox ...etc.

So hardly bare :) Each of those have their own benefits/pitfalls. Primarily I run the Xephyr for browser/internet stuff - and my music (audacious), tmux for ssh, standard root/jwm/rox for local system admin and other non internet tasks.
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#8 Post by musher0 »

Hi, rufwoof.

Thanks for the info.

Isn't tmux ("term multiplexer") a WM for console? I thought it excluded using
anything else.

You have an Interesting screen setup, I must say.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#9 Post by rufwoof »

Empty can be good. Even some web pages without any advertising can leave relevant/desired content visible via a letterbox. Yes I know you can full screen flip, but a larger (more empty) screen real estate is better from the get-go.

What with the window title, menu, tray, and more commonly nowadays a cookies warning that may not be shot unless you open up javascript (temporarily allow noscript), let alone if you do a find in addition to that.
Attachments
letterbox.png
(73.36 KiB) Downloaded 500 times
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#10 Post by rufwoof »

musher0 wrote:Isn't tmux ("term multiplexer") a WM for console? I thought it excluded using anything else.
tmux runs on the console. Within that you can have multiple (full screen) windows (I've set it so F11 adds a window, F12 steps between them). You can split each window into panes, and zoom/unzoom those (between full screen/restored). F11 and F12 because of the attached i.e. when using mc or mc text editor it uses F1 to F10. The normal control key for tmux is ctrl-B, but I set mine to be the backtick as I find that easier. If I want to actually key in a backtick such as in a script to make something execute, then I just have to press the backtick twice to get it to actually print to the script. That's a relatively infrequent action for me, so not really a inconvenience.

A nice feature is two of you can ssh into the same userid and attach to the same tmux session and collaborate (both edit/update windows). You can also detach and leave things running, reattach again from another location/device later. But all cli (terminal).

You can run that in addition to a X window manager such as jwm. For multiple X window managers you can do like EasyOS, run a Xephyr ... which is like another X server. For instance open a xterm window and run

Code: Select all

Xephyr :3 &
and a small black window will appear - another X session.
Then in that xterm window run

Code: Select all

DISPLAY=:3 jwm
and you should see the jwm tray appear in that smaller window. Could be any other window manager, twm, cwm ... whatever. You can also set Xephyr to create a larger window, for instance without looking IIRC its -fullscreen Xephyr parameter that will create a fullscreen version.

EasyOS 1.0 is good, but still has quirks. Changing backgrounds in one jwm (container), desktop icon locations ...etc. can revert or be lost. Using jwm as the real root session and cwm as the containers window manager makes EasyOS that more stable IMO, simply because cwm is so ... in your words 'empty'.
Attachments
mce.png
(5.59 KiB) Downloaded 476 times
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

Post Reply