Skip to main content

xmonad settings

One thing that I did like about using gnome was that for most things, it was very discoverable. You click a few menus, try this and that. But with something like xmonad, it's much more configurable for sure but you certainly have to know your way around. So after seaching the internet, I've finally had a setup which I pretty much like. Here it is for future reference. For ~/.xmnonad/xmonad.hs:

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

myManageHook = composeAll
[ className =? "Gimp" --> doFloat
]

main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig
{ terminal = "urxvt"
, modMask = mod4Mask
, borderWidth = 3
, manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP $ xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
} `additionalKeys`
[ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock")
, ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
, ((0, xK_Print), spawn "scrot")
]

That will, amongs other things, make sure that gimp does not tile but stay float, it will start up xmobar, set my default terminal to urxvt, use the win key for meta (better than using alt since alt is used by most programs), logHook to create an output to be used by xmobar, make sure xmobar stay visible eventhough the screen is full of other programs, set win+shift+z will lock the screen with xscreensaver.

Okay, next is setting for xmobar. This is my ~/.xmobarrc:

Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = TopW L 90
, lowerOnStart = True
, commands = [ Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %cpu% | %memory% | %wlan0% | %eth0% * <fc=#ee9a00>%date%</fc> @ %hostname%"
}

Ok. This will create the xmobar on the top 90% of the screen. Another 10% we want to reserve for trayer for our programs that require a system tray (eg Pidgin) if we use any. It display a few useful info, but I think on of the most useful ones is the date, and also the output from xmonad which would show what workspace you are currently on (very very useful) and also the title of the window you're currently viewing (not so useful but still nice to have).
Next is I want my urxvt to look nice. So here is the settings for my ~/.Xresources:

URxvt*background: #242424
URxvt*cutchars: BACKSLASH '"'&()*,;<=>?@[]{|}
URxvt*colorUL: #86a2be
URxvt*foreground: #ffffff
URxvt*geometry: 80x25
URxvt.cursorColor: #86a2be
URxvt*internalBorder: 0
URxvt*jumpScroll: true
URxvt*loginShell: true
URxvt*perl-ext-common: default,matcher,searchable-scrollback
URxvt*pointerBlank: true
URxvt*saveLines: 4000
URxvt*secondaryScroll: true
URxvt*scrollBar: false
URxvt*scrollTtyKeypress: true
URxvt*scrollWithBuffer: true
URxvt*termName: rxvt-unicode
URxvt*underlineColor: #86a2be
URxvt*urlLauncher: /usr/bin/firefox
URxvt*color0: #242424
URxvt*color1: #bf7979
URxvt*color2: #97b26b
URxvt*color3: #cdcda1
URxvt*color4: #86a2be
URxvt*color5: #d9b798
URxvt*color6: #a1b5cd
URxvt*color7: #ffffff
URxvt*color8: #cdb5cd
URxvt*color9: #f4a45f
URxvt*color10: #c5f779
URxvt*color11: #ffffaf
URxvt*color12: #98afd9
URxvt*color13: #d7d998
URxvt*color14: #a1b5cd
URxvt*color15: #dedede
URxvt*font: xft:Terminus:pixelsize=15

I found this in a Ubuntu forum. I changed the font to Terminus with size 15 though. Much nicer on the eyes not to have to squint so much trying to read a small font. Then finally to put it all together, I have this in ~/.xinitrc:

xsetroot -cursor_name left_ptr
if xrandr -q | grep -q "VGA1 connected"; then
xrandr --output VGA1 --mode 1024x768 --left-of LVDS1 --output LVDS1 --mode 1366x768
fi
trayer --edge top --align right --transparent true --width 10 --tint 0x191970 --height 12 --expand true --widthtype request --heighttype request --SetDockType true --SetPartialStrut true &
xscreensaver -no-splash &
xrdb -merge ~/.Xresources
exec ck-launch-session xmonad

Amongst other things it detect whether I have an external monitor connected and automatically make xrandr extend to that if there is one. It sets up trayer (using the 10% we preserved earlier). It starts up xscreensaver. It actually load the .Xresources (normally this would be done by the gdm, but since I'm not using the gdm so this is how you load it and finally it launches xmonad. Phew.. That's basically it. As long as this blog post hold up, I can reformat my machine and recover the settings which I pretty much like for xmobar and gang.

Disclaimer: None of these settings are my original. Some of them I've got from xmonad and xmobar faq's and tutorials, others I've got from other various pages on the net.

Comments

Popular posts from this blog

Food first post

My blogs' name is High-Tech Rojak but I don't recall ever talking about food. So here's a first. Just recently I got some free time and finally got to cook the pasta I've bought for ages. So here's an account of how it went down.. :) Okay. That's the thing I cooked. I have no idea what it's called. At first I was thinking of buying the ribbon ones, then my wife looked at the colorful spiral ones and said "why not get these? they're more colorful" and so we got them (yes, we know nothing about pasta.. :) So I boiled it, actually put some salt and oil into the water so that they won't stick, drained it and tadaaaaa, you'd get the above. I remember once I tried to cook macaroni and I didn't drain it after boiling it, it filled up the whole pot. LOL... Learned my lesson. Next up the sauce. Like I said we don't know anything about pasta so here's the ingredients we prepared. Yes ladies and gentleman. Instant pasta sauce all bottl

Documentation is a must... after this.

I've been thinking quite a bit about documentation and the 'cost' it involves. And when I say documentation, I mean documentation in general about anything. One obvious case with the industry I'm involved in is user documentation (a.k.a The Manual). Creating great features in software takes time and effort but if it is not documented then the user won't even know about it and finally it never gets used. But then while documenting it you just wish that you're working on the next cool thing rather than have to write this up. So finally you end up not doing the documentation or doing it rather badly. Same thing with this blog writing. I have been doing some pretty interesting things with my phone (rooting it and using cynogenmod and all), some pretty significant life changes (my grandmother passed away) and a lot of other things which I should probably like to remember better or reflect more on it but not documented (here or anywhere permanent) and it would probabl

The Future Of Gaming

I love playing computer games. It's what originally drove me to learn computer programming, I wanted to create my own games. Until now I still have very little success with that, but... I have learnt to program web applications quite well and earning my pay using those skills. And I love open source software. Ever since I started programming professionally, my main work OS has always been Linux (various distributions and all and currently on Arch Linux). I always install dual-boot because... hardware problems (some projectors and printers just couldn't be detected by Linux when I started out, that's mostly not a problem now) and mainly to play games (sure there was some open source games available, but apart from "Battle for Wesnoth" and "FreeCiv" I don't actually recall any games I've played extensively enough to be remembered). But recently the gaming scene in LinuxLand has improved tremendously, partly thanks to the Windows 8 app store like