Search This Blog

Showing posts with label xmonad. Show all posts
Showing posts with label xmonad. Show all posts

Thursday, 10 January 2013

A Tale of 2 Disks

I'm sorry if you were waiting for part 2 of the LVM saga, it will come, but in the meantime, I've something else to talk about.

I had a normal 500GB hard drive in my work laptop and I was reasonably happy with the performance, with Ubuntu 12.04 booting to an xmonad Window Manager, it took about 55-60 seconds from power button to login window.

However, some of my work colleagues have put SSDs into their computers, both desktop and laptop, and that gave me the idea to try that too.

Because I do a lot of work on my XenDesktop at work, and I also extensively use ShareFile and Dropbox, the size of the SSD was less important to me than the reviews it received. I store a lot of the non sensitive stuff I use on some form of cloud service, so a smaller, faster disk was fine by me.

I got a 128GB Crucial M4 SSD and installed Ubuntu 12.04 on it, again using xmonad as my WM. And boy, does it make a difference! Boot from power on to login screen now takes 19 seconds. Copying some large files from my backups to the new system was way faster than I'd dared hope, in fact copying about 6GB of files, assorted between large and small files, took around 3 minutes. I can tell you that I was very happy.

In general use I find things are faster too, opening 500MB+ files in Wireshark is so much quicker, file transfers from anywhere are so much quicker and generally the whole system feels more responsive.

So, if you've been thinking about SSDs, stop it! Get yourself one and see what a difference it really makes. With prices down so low now, there is no real reason to not use one for the OS of a computer. Even if the data is stored elsewhere, having the OS and some programmes you use a lot on an SSD really does make a difference. Just remember to enable the TRIM feature....

Friday, 4 January 2013

Going Minimalist with xmonad

You may have read in my ramblings how I am one of these people who actually likes Unity on Ubuntu and find it lets me get more stuff done. Well, I still think that, but in the last few days I've been tempted into looking elsewhere for some thing different...

One of the guys I work with runs Arch Linux and uses xmonad as his window manager. No, I'm not going down the painful path of Arch, but I have decided to take a look at xmonad as an alternative WM on my (Ubuntu running) work laptop. (Thanks Michal....)

Talk about a learning curve! It is very different to Unity in that it is minimalist, has no eye candy and uses the keyboard much more than the mouse. But what a fast and responsive way of working it has proved to be!

Installation was a breeze

sudo apt-get install xmonad

and following the 2 links here and here made the initial config reasonably easy. Here are my xmonad.hs and .xmobarrc config files:

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
myWorkspaces = ["1:terminal","2:web","3:XenDesktop","4:four","5:five","6:six","7:seven","8:eight","9:nine"]
main = do
    xmproc <- spawnPipe "/usr/bin/xmobar /home/stefan/.xmobarrc"
    xmonad $ defaultConfig
        { manageHook = manageDocks <+> manageHook defaultConfig
        , workspaces = myWorkspaces
        , layoutHook = avoidStruts  $  layoutHook defaultConfig
        , logHook = dynamicLogWithPP xmobarPP
                        { ppOutput = hPutStrLn xmproc
                        , ppTitle = xmobarColor "green" "" . shorten 50
                        }
        }


.xmobarrc

Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = TopW L 90
       , lowerOnStart = True
       , commands = [ Run Network "wlan0" ["-t","Wireless: Rx<rx>|Tx<tx>","-S","True"] 10
                    , Run MultiCpu ["-t","Cpu: <autototal>","-L","30","-H","60","-h","#FFB6B0","-l","#CEFFAC","-n","#FFFFCC","-w","3"] 10
                    , Run Memory ["-t","Mem: <usedratio>%"] 10
                    , Run Swap [] 10
                    , Run Date "%a %b %_d %l:%M" "date" 10
                    , Run StdinReader
   , Run Network "eth0" ["-t","Wired: Rx<rx>|Tx<tx>","-S","True"] 10
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%StdinReader% }{ %multicpu% | %memory% * %swap% | %eth0% | %wlan0% | <fc=#ee9a00>%date%</fc> "
       }


These 2 files will provide a reasonable starting point for anyone wanting to try this out.



I have 2 specific comments though:

Firstly, I'd forgotten how much I love tinkering with Linux. Using it every day to put in a full day's work is good, especially compared to the Windows alternative, but it's really nice to tinker with a new setup and alter it to do exactly what you want. In my case it involved writing a small script to start trayer, a small tray utility to display applets like those in the system tray, and some applets which I use a lot like the Network Manager and Bluetooth applets.

#!/bin/bash

# Script to start trayer and required applets
trayer --edge top --align right --SetDockType true --SetPartialStrut true  --expand true --width 10 --transparent true --tint 0x191970 --height 13 &
sleep 3
nm-applet --sm-disable &
sleep 3
bluetooth-applet &
sleep 3
dropbox start
exit 0


This script is called from a small wrapper script which sets my display options to my work configuration, with an external monitor to the right of my laptop.

#!/bin/bash

xrandr --output LVDS1 --mode 1600x900 --output VGA1 --mode 1680x1050 --right-of LVDS1
/home/stefan/.tray.sh
exit 0


I also had to tweak some other settings to get xmobar to display the data I wanted to see in the status bar. Ok, this is all done automatically in a full desktop WM like Unity, but I enjoyed tinkering, tweaking and ending up with a desktop that works for me.

Secondly, it is amazing just how much my work is streamlined using a tiling window manager and using keystrokes to flick between desktops, monitors and open windows. It is difficult to imagine the difference made by not moving my hands from keyboard to the mouse and back as much. I still use the mouse in browser windows etc. but for the majority of my work I can get away with only using my keyboard.

I guess in short, it has once again been brought home to me how versatile Linux is, and how easy it is to customise to your own requirements. If you don't like one Desktop Environment, use another, just be comfortable with whatever you use.

I'll be using Unity and xmonad interchangeably from now on...