HOW TO: get some interesting window manager code

Forum rules
Share your brain ;)
pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

HOW TO: get some interesting window manager code

Unread post by pidsley » Mon Jul 29, 2013 12:15 am

Most of you probably already know how to do this, and I posted the links to the WM code in the GangBang topic, but because I am always looking for excuses to learn more bash, I wrote a script to make it easy to download source code for some of the window managers that must be built from source.

The script displays a dialog and lets you choose one or more window managers to download, along with the option to install some of the libraries and tools you need to build the WMs. Put the script at the base of your code directory (on my machine this is ~/code, duh) and run it. It will install and download what you select, if it's working properly. If it's not, figure out what's wrong with it and tell me so I can fix it.

Code: Select all

#!/bin/bash

grn="\e[32m"  # green
rst="\e[0m"    # reset color

alist=( tools cwm sithwm alopex monsterwm musca snapwm euclid-wm echinus wmfs karmen )

let num=${#alist[*]}-1     # number of items in the array (minus one to account for zero index)
tmpfile=`mktemp`            # make a temp file for dialog return value

# make a list in menu format, with a number first, then the name, all off
for i in `seq 0 $num`; do
    blist[i]=`echo $i ${alist[i]} off`
done

# display the list in a dialog, save the return value (the index numbers) in the tmpfile
dialog --no-tags --checklist 'choose one or more' 50 50 10 ${blist[*]} 2>$tmpfile

function get-wm {
    for wm in "$@"
    do
        case $wm in
            0 ) 
                echo -e $grn'\ninstall tools'$rst
                sudo apt-get install git libx11-dev libxft-dev libxinerama-dev libxrandr-dev libimlib2-dev bison
                ;;
            1 )
                echo -e $grn'\ngit clone cwm'$rst
                git clone git://github.com/chneukirchen/cwm.git
                ;;
            2 )
                echo -e $grn'\nwget sithwm'$rst
                wget -c http://sithwm.darkside.no/sn/sithwm-1.2.3.tgz
                tar xzvf sithwm-1.2.3.tgz
                ;;
            3 )
                echo -e $grn'\ngit clone alopex'$rst
                git clone git://github.com/TrilbyWhite/alopex.git
                ;;
            4 )
                echo -e $grn'\ngit clone monsterwm'$rst
                git clone git://github.com/c00kiemon5ter/monsterwm
                ;;
            5 )
                echo -e $grn'\nwget musca'$rst
                wget -c http://aerosuidae.net/musca-0.9.24.tgz
                tar xzvf musca-0.9.24.tgz
                ;;
            6 )
                echo -e $grn'\ngit clone snapwm'$rst
                git clone git://github.com/moetunes/snapwm-stable
                ;;
            7 )
                echo -e $grn'\nwget euclid-wm'$rst
                wget -c http://euclid-wm.googlecode.com/files/euclid-wm-0.3.1.tar.gz
                tar xzvf euclid-wm-0.3.1.tar.gz
                ;;
            8 )
                echo -e $grn'\nwget echinus' $rst
                wget -c http://plhk.ru/static/echinus/echinus-0.4.9.tar.gz
                tar xzvf echinus-0.4.9.tar.gz
                ;;
            9 )
                echo -e $grn'\ngit clone wmfs'$rst
                git clone git://github.com/xorg62/wmfs.git
                ;;
            10 )
                echo -e $grn'\nwget karmen'$rst
                wget -c http://downloads.sourceforge.net/karmen/karmen-0.15.tar.gz
                tar xzvf karmen-0.15.tar.gz
                ;;
        esac
    done    
}

get-wm `cat $tmpfile`
rm $tmpfile

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: HOW TO: get some interesting window manager code

Unread post by DebianJoe » Mon Jul 29, 2013 5:25 am

Very cool. Thanks for sharing.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOW TO: get some interesting window manager code

Unread post by machinebacon » Mon Jul 29, 2013 8:16 am

Thanks for the share. Will be put into Beard ;)
..gnutella..

Post Reply