dwm tips on Fedora
I've been testing out Fedora 15's Gnome 3 and Ubuntu's Unity, and didn't like either of them. They both take up too much precious screen space just to show a fancy UI, and requiring hardware acceleration is a pain for low end netbooks and virtual machines.
So I decided to move to an alternative window manager. DWM (dynamic window manager, http://dwm.suckless.org/) is an extremely lightweight tiling window manager written in C which saves screen space and works pretty well as long as you don't need to connect to wireless networks.
I've been pretty happy with it. The main drawback is that connecting to wireless networks is a pain in the ass as there are no proper GUI tools to do this. Check out these tips to get started with dwm
0. Installing dwm on Fedora, keyboard shortcuts
To install DWM, run yum install dwm. You can then choose to use dwm or Gnome or Kde in the login screen. The default keyboard shortcuts are listed at man dwm or at http://man.suckless.org/dwm/1/dwm.1. Customizing dwm
Customizing dwm can be done by making changes to config.h and recompiling the window manager. Fedora has a really nice package called dwm-user, which automates this process! Here is the package description: dwm-start is a helper script for running and reconfiguring dwm if neccessarry. It's the preferred way of starting dwm in Fedora. Running dwm-start starts Fedora build by default. If you wish to customize your configuration, put the dwm config header file to $HOME/.dwm/config.h and adjust it according to your needs. Every time the user configuration file has changed, dwm-start will rebuild the user dwm binary prior to its execution. All you need to do is:bash
sudo yum install dwm-user
bash
mkdir ~/.dwm
bash
cp /usr/src/dwm-user-5.8.2-6.fc14/config.def.h ~/.dwm/config.h
E.g. install via yum, then make a ~/.dwm folder, then copy the config.h file and edit it. When you restart, you can choose dwm-user as your window manager which uses you custom version of dwm. For example, I remapped Meta (Cmd/Windows key) + h and meta + l to meta + pg up / pg down and meta + shift + q to meta + shift + end since I'm currently running Fedora on an OSX host.
You will probably make changes to the keyboard shortcuts. To find the keymap:
bash
sudo updatedb
bash
locate keysymdef.h
Keysymdef.h lists the names of the keys in X11.
2. Tip: Guake is just as awesome on dwm
By default, dwm launches xterm. I prefer to use guake, since that allows me to get the tabbed terminal window on any workspace when I need them. Just launch guake& to run it in the background. UPDATE: I moved to F15 (deciding simply to ignore Gnome 3) and noticed that guake has problems starting. To fix those:bash
sudo yum install xfce4-notifyd
Basically you need a notify daemon to allow Guake to print that pretty message "Guake is running", and xfce4-notifyd provides an alternative notifications daemon.
3. Launch netbeans and other Java programs with font smoothing and GTK look and feel
You need to specify a couple of extra switches to get the GTK look and feel in Java programs, for example: /home/username/netbeans-7.0/bin/netbeans -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel4. Launch nautilus without the desktop
nautilus --no-desktop
5. Use dwm with a dual screen setup
If dwm starts with mirroring output to your secondary screen, then you need to run xrandr to get the names your screens. E.g. VBOX0 and VBOX1. Then configure the screen layout:bash
xrandr --output VBOX1 --auto --right-of VBOX0
dwm will now let you have your own workspaces for each screen.
6. Change your desktop background
Use feh to change your desktop background:bash
feh --bg-tile /path/to/background/image
7. xterm config
For a usable xterm, create the following ~/.Xresources and runbash
<code>xrdb -merge .Xresources</code>
bash
xterm*faceName: monospace:pixelsize=14
xterm*saveLines: 9999
xterm*scrollBar: false
xterm*background: #000000
xterm*foreground: #dfdfdf
xterm*color0: #000000
xterm*color1: #9e1828
xterm*color2: #aece92
xterm*color3: #968a38
xterm*color4: #414171
xterm*color5: #963c59
xterm*color6: #418179
xterm*color7: #bebebe
xterm*color8: #666666
xterm*color9: #cf6171
xterm*color10: #c5f779
xterm*color11: #fff796
xterm*color12: #4186be
xterm*color13: #cf9ebe
xterm*color14: #71bebe
xterm*color15: #ffffff
8. Add a clock using xsetroot
You can do something like this in a bash script to show the time in dwm on the top right corner.bash
<pre>while true; do
xsetroot -name "$( date +"%F %R" )"
sleep 1m # Update time every minute
done
9. Connect to wifi
This is rather painful. The instructions here were collected from the mailing list, and I did get them to work, but I'm too lazy to write a full tutorial on this right now. Basically, you need to scan, then do different things depending on whether the wifi uses WEP or WPA for authentication. Start by running:bash
iwlist scan
9.1 WEP wifi
> > #wep connect to a wep wifi
> > #! /bin/sh
> >
> > key="grep <span class="hljs-variable">$1</span> /home/pmarin/wep | cut -d' ' -f2
"
> > sudo ifconfig wlan0 up
> > sudo iwconfig wlan0 essid $1
> > sudo iwconfig wlan0 key s:$key
> > sudo dhclient wlan0
> > #end
> > The wep is a plain file with to columms
> >
> > essid key
9.2 WPA wifi
> >
> > #wpa connect to a wpa wifi
> > #! /bin/sh
> >
> > sudo ifconfig wlan0 up
> > sudo iwconfig wlan0 essid $1
> > sudo wpa_supplicant -iwlan0 -c/home/pmarin/wpa -B
> > sudo dhclient wlan0
> > #end
> >
> > the wpa file is similar than /etc/wpa_supplicant.conf
To create the wpa file:
wpa_passphrase your_ssid_of_network your_network_password
Create the file:
ctrl_interface=/var/run/wpa_supplicant
#ap_scan=2
network={
ssid="your_ssid"
scan_ssid=1
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk=your_psk_from_wpa_passphrase
}
sudo wpa_supplicant -Bw -Dwext -i eth0 -c/etc/wpa_supplicant.conf
9.3 Wifi troubleshooting:
1) CHECK THAT YOU DON'T have the NetworkManager service or wpa_supplicant running already!!!You can run wpa_supplicant with -dd flag for a detailed debug output.1) If you don't manage to connect to the AccessPoint, try to uncomment line 2 in /etc/wpa_supplicant.conf.
2) If that doesn't help, try change its value to 0 or 1.
3) If you get troubles while authenticating, try removing "RSN" and/or"CCMP" strings from /etc/wpa_supplicant.conf.
Sources for Wifi stuff:
http://ubuntuforums.org/showthread.php?t=263136
http://www.mail-archive.com/[email protected]/msg06800.html
Comments
vimarsh: One tip for the wifi set-up: i found it easier to set up the initial config using nm-connection-editor and then start nm-applet in the dwm launcher script. It will autoconnect to your preferred wifi configuration. (Of course you need NetworkManager daemon running)
Sample launcher:
""" #
start new dwm session
#
nm-applet --sm-disable& exec /usr/local/bin/dwm """
Mikito Takada: Thanks for the tip!
Matt Freeman: In my .xsession I have 'nm-applet &' (or perhaps you can spawn it from the dwm config), if this is setup correctly then it will auto connect to wifi network previous configured (i.e. the one you setup whilst in gnome). Alternatively if you have a tray program such as trayer or tint2 etc.. you can work with the network manager just as you would in Gnome.
Hardcore Arch users tell me that wicd is better alternative without zero gnome attachments though. - not verified
Mikito Takada: Thank you, I gave wicd a try and it seems like a really nice solution for going Gnome-free...
sudo yum install wicd wicd-gtk wicd-curses sudo service NetworkManager stop # Bad password errors if both are running... sudo service wicd start wicd-client -n
Anton: Hi! Big thanks for tips! Always wanted to try tiling managers and with releases of unity and gnome 3, the time to do it have come. now i am messing around lxde based fedora + dwm, and your article is really good point to start.