Search This Blog

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...

Friday, 28 December 2012

Dropbox and the art of blagging.

In the last few months, I've found myself using Dropbox more and more. It is very useful for sharing files between my laptop and my work XenDesktop, as well as between the Windows (I know, I know) and Ubuntu partitions on my work laptop. I also use it to share information with a small team of people I work with closely on some charity projects, and it really has been an excellent help for that.

Recently, I've found myself using in a slightly different way, which has worked very well also. I've been accessing my Dropbox files from my Android devices, both from my phone and from my Nexus 7. This has been particularly useful for 2 different reasons. First, having extra online storage space meant I was happy enough getting the 16GB Nexus instead of the 32GB one. This is because a lot of the files I will not use regularly can quite happily live in a Dropbox folder and grabbed when required, rather than taking up space on my devices. I never fill my phone 16GB SD card more than 40% full, so I figured I'd be fine with 16GB of storage on the Nexus.
Secondly, I've been delighted by how some of the apps I use regularly on both the phone and the tablet can access the Dropbox folders directly, without having to store the files locally at all. DroidEdit, ezPDF Reader Pro and ES File Explorer all allow me to use items from Dropbox directly. I have to say that the API provided by Dropbox seems to work very well, and makes it easy for me to work the way I want to too.

So this is where the blagging part comes in. I can always do with more Dropbox storage and, short of paying for it monthly, the only way I have left of getting it is by getting others to sign up to Dropbox using one of my invites. This is of course somewhat symbiotic, as they also get more space if they sign up with my invite, but if any of you haven't yet signed up to Dropbox and would like to, getting an extra 500MB of storage in the bargain, please use the following invite link and get me some more space too.

http://db.tt/spKMpILz

Thanks muchly!

Tuesday, 25 December 2012

Nexus 7, Bluetooth devices and useful Apps

Ok, so anyone who knows me will know I'm a happy Android user, and the Nexus 7 has only cemented this position. All I want to do today is share some of the things I have done to make the Nexus more useful and work even better for me. I hope these notes may help you as well.

The first thing I would recommend is getting a Bluetooth keyboard and mouse, if you are likely to be doing much in the way of text entering (like blogging or coding for example). I got both, and they really make a difference when using the tablet as a content creating device. They also make the Citrix Receiver and my XenDesktop work really well when I'm on call and need to be able to check things quickly. It won't replace my laptop, but means I don't have to have it on all the time.
Pairing the tablet and the keyboard and mouse was painless, and to borrow a phrase from our fruit loving brethern, "it just works".

Now, I very rarely feel the need to buy apps for a mobile platform, whether it was Apple previously or Android now, the free versions usually are fine for me, but I have bought "Pro" versions of some Android apps, because they really are that good. As a result, I'd heartily recommend the following apps from the Play Store:


  • ezPDF Reader Pro - This is easily the best PDF reader I've used for pretty much any platform, and using it on the tablet is great for annotating PDFs, making notes in margins etc. It also has some support for epub ebooks, so definitely worth the few pounds I paid for it.
  • DroidEdit Pro - A very neat text editor with syntax highlighting for many different scripting languages as well as html etc. The reason I paid for the pro version was that it supported direct Dropbox access, which I find very useful.
  • External Keyboard Helper Pro - I'm using this to make sure that the Bluetooth keyboard is recognised as an en-gb keyboard rather than the default en-us that Android uses. It also allows custom keymaps to be added and to map keys to specific functions, which can be helpful.
  • Hacker's Keyboard - A soft keyboard which is much better than the Android stock ones. This app is free, but my soft keyboard of choice when I'm not using the BT keyboard.
The other really good thing about the Play Store is that when I bought each app, I was able to use it on all my Android devices, they were not tied to one device or another. This meant that I was able to pair the Bluetooth keyboard with my HTC Desire S work phone and use External Keyboard Helper to set it to en-gb and send text messages using the keyboard. I know, geeky and probably pointless, but it's nice to do it if you can, right?


Documentation, documentation, documentation....

I've been struggling with the lack of proper documentation for a LSI RAID controller I am using in a server at work. While most of the RAID configuration is done through a wrapper script in the application running on the server, when this goes wrong, I'm supposed to know how to fix this using the underlying MegaCLI. As a result, I've been hunting for specific information on the MegaCLI syntax....

Oh boy, what a task.

Try Googling MegaRaid or MegaCLI, and you'll be amazed at the number of results. The problem is that they are mostly blog posts ranging from simply mentioning the documentation deficiencies, through complaining about the lack of documentation, to venting spleen at the lack of documentation. Many document specific commands which they needed and which they worked out by trial and error, and some have reasonably comprehensive reference guides or cheat sheets.

My problem is that I think this should be unnecessary. Coming from a Linux/Unix perspective, where man pages are only a few keystrokes away, it seems odd that there is not something like this available for what is an Enterprise grade Storage Controller. I did finally find a 32MB PDF which is a software guide, and this PDF has a reasonable chapter on the CLI tool, but for a tool designed to be used from the command line, some command line help might really be useful.

I've decided that, rather than create another blog post complaining, I would start work on a post which lists those of the commands which I've used and try to explain the syntax somewhat, so that maybe my work can be of some use to someone else. If you're interested, keep your eyes open for a post on this in the near future.

Friday, 21 December 2012

What a Year!

Well, it's almost the end of the year,and what a year it's been. I started it working for Bytemobile, now I'm a Citrite, I started it running Windows exclusively at work and finished it running Ubuntu exclusively and using a Xen Desktop for the only 2 Windows applications I have to use. I will post on that later, but it's worked very well.

All in all though, it's been a busy year, with ups and downs like everybody else, but I feel it's been a good one, with many challenges at home and at work and lots of lessons learned.

I've got more experience on Solaris, including hacks and tips to keep my labs running despite the lowly hardware it lives on. I've had to seriously improve my scripting using Bash, and start learning Python. I've expanded my exposure to RHEL, building on my experience with Debian and Ubuntu, and I've got to work with some nice IBM hardware.

So, what is in store for next year?

Well, I'm hoping to be sponsored for, and gain, some industry standard certification, like LPI or RHCE. I also want to take on more responsibility for training and knowledge transfer in my areas of specialist expertise like our T2100 Caching Server. I would also like to take the next steps which would allow me to move along my career path.

Anyway, it's been a good year, here's hoping the next one is even better.

Saturday, 8 December 2012

All hail the Nexus 7

Hi all! I just wanted to share my experiences of getting a Nexus 7 and setting it up. This post is largely prompted by some posts on The Register forums on the subject of a comparison and review of tablets for Christmas. There were a lot of comments saying how much easier it is to set up multiple Apple devices compared to Android devices. As I don't have any Apple devices, I'm not claiming this is a comparison, it's just my experiences of setting up multiple Android devices.

I have had Android phones for quite a long time, but I have only just got a Nexus 7 16GB tablet. I have had 2 Googlemail accounts and an Exchange account set up on my phones, along with a number of apps and linked Dropbox and similar accounts.

When I powered up the Nexus 7 for the first time, it asked me for my main Googlemail account details. When I entered the info, everything synced to the Nexus immediately, including things like WiFi networks I'd joined on my phone. I was amazed that the tablet connected to the WiFi network at work.

When it comes to the apps I had installed on my phone (HTC Desire S), they all installed on the tablet with a single tap. The really good thing is that even the paid for apps just installed too, without any mention of the app being limited to a specific number of devices. They also scaled very well on to the tablet, with only the Norton VIP app, required for work, looking like it was blown up. All the other apps make full use of the extra screen real estate. There have been many comments about how the Android tablet apps are sorely lacking, but in my experience, I've had no problems and I'm very happy with how the apps look on the tablet.

All in all, the setting up process was very simple and although I have no experience with the Apple ecosystem, I can't see how it would be any simpler than my experience setting up my new Nexus 7.

Friday, 7 December 2012

Oh wow.....

Oh dear, was my last post really back in April?

Ok, I know no-one reads this drivel, but still, it is a very long time since I had time and/or inclination to commit my mental ramblings to, well if not actual paper, you get the drift...

So, what has happened? I got my Raspberry Pi and love it, I've been swallowed up by the megacorp that is Citrix, although I still do exactly the same job, I've got older and greyer sorry, balder, and I now have a Nexus 7. There, you're all caught up!

I do plan to post more regularly again, for no better reason than that it keeps me from shouting at random people walking by my desk. For example, I may post about my experiences with the Nexus 7, which I only got this week, or I may complain about the lack of sleep I'll be suffering from next week as I do a week on US timezone shifts or some other such mutterings as may spring to mind, but in any event, know this:

Gonzo is back and he's more opinionated than ever!