Updated Awesome Config (rc.lua)

A few words:

This rc.lua is the on that I use for my current desktop configuration.  Some options might not work for you (especially if you don't have Vicious installed).  Make sure that before you rely on this config in your setup that you first browse through it and make sure that your installed apps match.  The syntax is pretty simple, so if my IM app ("Pidgin") doesn't match yours, just change the name in quotes to the executable binary for your IM App.  My config assumes that you have moved the default themes into your ~/.config/awesome directory, if you have not done this, then edit accordingly.  Realistically, this should be used as more of a guide to doing some simple customizations to your existing configs and not as a "guaranteed to work replacement".

If you have any questions regarding my config or how to modify your own with some added widgets, menus, keybinding defaults, etc then hit me up on my Google+ Profile.

The Config:


-- Standard awesome library
-- Theme handling library
-- Notification library
-- Vicious Widgets

-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers

-- This is used later as the default terminal and editor to run.
terminal = "terminator"
editor = os.getenv("EDITOR") or "vim"
editor_cmd = terminal .. " -e " .. editor

-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"

-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
-- }}}

-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({ 'Terms', 'Net', 'Work', 'Dev', 'Coms', 'Down', 'Vids', 'Music', 'Misc' }, s, layouts[1])
-- }}}

-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu = {
   { "manual", terminal .. " -e man awesome" },
   { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
   { "restart", awesome.restart },
   { "quit", awesome.quit }
mydevmenu = {
   { "Spyder", "spyder"},
   { "Gedit", "gedit" },
   { "Bluefish", "bluefish" },
   { "CodeBlocks", "codeblocks"},
   { "VIM", terminal .. " -e vim" } 
mycustommenu = {
   { "Irc", terminal .. " -e screen weechat-curses" },
   { "IM", "pidgin" },
   { "Email", terminal .. " -e screen alpine" },
   { "Chrome", "chromium" },
   { "uzbl Browser", "uzbl-browser" },
   { "Image Viewer", "viewnior" }, 
   { "Music", terminal .. " -e screen cmus" },
   { "PCmanFM", "pcmanfm" },
   { "MC", terminal .. " -e screen mc" },
   { "rtorrent", terminal .. " -e screen rtorrent" },
   { "Monitor", terminal .. " -e htop" },
   { "Pulse Volume", "pavucontrol" }
mymainmenu = awful.menu({ items = { { "Dev", mydevmenu, beautiful.awesome_icon },
                   { "common", mycustommenu, beautiful.awesome_icon },
                                    { "awesome", myawesomemenu, beautiful.awesome_icon },
                                    { "open terminal", terminal }

mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
                                     menu = mymainmenu })
-- }}}

-- {{{ Wibox
-- Start Vicious Widgets Config
-- Gmail Widget
-- Initilize widget
gmailwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(gmailwidget, vicious.widgets.gmail, "Gmail: ${count}", 200)

-- Naughty Notifications on new email (WIP)
-- End Naughty Notifications on new email

-- CPU Graph
-- Initialize widget
cpuwidget = awful.widget.graph()
-- Graph properties
cpuwidget:set_gradient_colors({ "#FF5656", "#88A175", "#AECF96" })
-- Register widget
vicious.register(cpuwidget, vicious.widgets.cpu, "$1", 2)

-- CPU Text Widget
-- Initialize widget
cputextwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(cputextwidget, vicious.widgets.cpu, "CPU: $1%", 4)

-- RAM Graph
-- Initialize widget
memwidget = awful.widget.graph()
-- Graph properties
memwidget:set_gradient_colors({ "#FF5656", "#88A175", "#AECF96" })
-- Register widget
vicious.register(memwidget, vicious.widgets.mem, "$1", 3)

-- Mem Text Widget
memtextwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(memtextwidget, vicious.widgets.mem, "RAM: $1%", 5)
-- End Vicious Widgets Config

-- Separators (thanks anrxc)
sepline = widget({ type = "textbox" })
sepline.text = "|"
sepspace = widget({ type= "textbox" })
sepspace.text = " "

-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" })

-- Create a systray
mysystray = widget({ type = "systray" })

-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
                    awful.button({ }, 1, awful.tag.viewonly),
                    awful.button({ modkey }, 1, awful.client.movetotag),
                    awful.button({ }, 3, awful.tag.viewtoggle),
                    awful.button({ modkey }, 3, awful.client.toggletag),
                    awful.button({ }, 4, awful.tag.viewnext),
                    awful.button({ }, 5, awful.tag.viewprev)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
                     awful.button({ }, 1, function (c)
                                              if c == client.focus then
                                                  c.minimized = true
                                                  if not c:isvisible() then
                                                  -- This will also un-minimize
                                                  -- the client, if needed
                                                  client.focus = c
                     awful.button({ }, 3, function ()
                                              if instance then
                                                  instance = nil
                                                  instance = awful.menu.clients({ width=250 })
                     awful.button({ }, 4, function ()
                                              if client.focus then client.focus:raise() end
                     awful.button({ }, 5, function ()
                                              if client.focus then client.focus:raise() end

for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
                           awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
                           awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)

    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(function(c)
                                              return awful.widget.tasklist.label.currenttags(c, s)
                                          end, mytasklist.buttons)

    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", height = "18", screen = s })
    -- Add widgets to the wibox - order matters
    mywibox[s].widgets = {
            layout = awful.widget.layout.horizontal.leftright
        mylayoutbox[s], sepspace,
        mytextclock, sepspace, 
        s == 1 and mysystray or nil,
        sepline, sepspace, memwidget.widget, sepspace, memtextwidget,
        sepspace, sepline, sepspace, cpuwidget.widget, sepspace, cputextwidget,
        sepspace, sepline, sepspace, gmailwidget, sepspace,
        sepline, sepspace, 
        layout = awful.widget.layout.horizontal.rightleft
-- }}}

-- {{{ Mouse bindings
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
-- }}}

-- {{{ Key bindings
globalkeys = awful.util.table.join(
    awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
    awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
    awful.key({ modkey,           }, "Escape", awful.tag.history.restore),

    awful.key({ modkey,           }, "j",
        function ()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
    awful.key({ modkey,           }, "k",
        function ()
            if client.focus then client.focus:raise() end
    awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),

    -- Layout manipulation
    awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
    awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey,           }, "Tab",
        function ()
            if client.focus then

    -- Standard program
    awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift"   }, "q", awesome.quit),

    awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
    awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
    awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
    awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
    awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
    awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
    awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
    awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),

    awful.key({ modkey, "Control" }, "n", awful.client.restore),

    -- Prompt
    awful.key({ modkey },            "r",     function () mypromptbox[mouse.screen]:run() end),

    awful.key({ modkey }, "x",
              function ()
                  awful.prompt.run({ prompt = "Run Lua code: " },
                  awful.util.eval, nil,
                  awful.util.getdir("cache") .. "/history_eval")

clientkeys = awful.util.table.join(
    awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
    awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
    awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
    awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
    awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
    awful.key({ modkey,           }, "n",
        function (c)
            -- The client currently has the input focus, so it cannot be
            -- minimized, since minimized clients can't have the focus.
            c.minimized = true
    awful.key({ modkey,           }, "m",
        function (c)
            c.maximized_horizontal = not c.maximized_horizontal
            c.maximized_vertical   = not c.maximized_vertical

-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
   keynumber = math.min(9, math.max(#tags[s], keynumber));

-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do
    globalkeys = awful.util.table.join(globalkeys,
        awful.key({ modkey }, "#" .. i + 9,
                  function ()
                        local screen = mouse.screen
                        if tags[screen][i] then
        awful.key({ modkey, "Control" }, "#" .. i + 9,
                  function ()
                      local screen = mouse.screen
                      if tags[screen][i] then
        awful.key({ modkey, "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus and tags[client.focus.screen][i] then
        awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus and tags[client.focus.screen][i] then

clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))

-- Set keys
-- }}}

-- {{{ Rules
awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = beautiful.border_width,
                     border_color = beautiful.border_normal,
                     focus = true,
                     keys = clientkeys,
                     buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
      properties = { floating = true } },
    { rule = { class = "pinentry" },
      properties = { floating = true } },
    { rule = { class = "gimp" },
      properties = { floating = true } },
    -- Set Firefox to always map on tags number 2 of screen 1.
    -- { rule = { class = "Firefox" },
    --   properties = { tag = tags[1][2] } },
-- }}}

-- {{{ Signals
-- Signal function to execute when a new client appears.
client.add_signal("manage", function (c, startup)
    -- Add a titlebar
    -- awful.titlebar.add(c, { modkey = modkey })

    -- Enable sloppy focus
    c:add_signal("mouse::enter", function(c)
        if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
            and awful.client.focus.filter(c) then
            client.focus = c

    if not startup then
        -- Set the windows at the slave,
        -- i.e. put it at the end of others instead of setting it master.

        -- Put windows in a smart way, only if they does not set an initial position.
        if not c.size_hints.user_position and not c.size_hints.program_position then

client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)

-- { Autostart some things
os.execute("xscreensaver -nosplash &") --screensaver daemon
os.execute("volwheel &") -- volwheel system tray applet
os.execute("dropbox &") -- dropbox service
os.execute("nm-applet &") -- NetworkManager applet
-- }
-- }}}


Phew! That's a lot of text.  Hopefully this is helpful to you.  I'll get to work on re-writing my Awesome How To as soon as I find some time in my schedule.  Until then, this should get you started if you're clever :)




Don't Forget To Remember What Counts...

The Way Things Are:

It is very easy to lose yourself in today's day and age on the internet.  While most of us in the "geek" and "tech savvy" communities would like to think of just how cool we are and informed, often referring to the many different channels that we keep track of on YouTube and feeds via RSS.  We would like to think that we know how the world works based on various internet memes and Wikipedia knowledge, but the truth is that we miss a lot more of what goes on beyond the bezels of our monitors than we like to admit.

But Wait! I'm Up To Date!:

I'm sure you are.  As many of my frequent readers are aware, I have a Google Plus profile where I post almost hourly on some days.  Maybe not, but I have been referred to by one person in my circles (who is also a distant but dear friend of several years) as #theantitwitter.  I'd like to think of myself as pretty well informed.  Besides, on Google Plus I have circles for news provided by the likes of Mike Elgan, Robert Scoble, and Carter Gibson.  Between just those three alone I've got plenty of content to gorge myself on almost as fast as I can read it.  However, even I have found myself easily forgetting that which is just a tad bit more important than what Amazon is doing with its Kindle.

You're Losing Me...:

I'm getting to the point, hold your horses!  Maybe it's because a lot of the people that I have placed in my circles are from across the pond, maybe it's because almost all of the people in my circles are a little too frail to have been in the military, or maybe still they just don't care, but today is a little more important than the fact that the day matches the month and matches the year.  Today, in the United States of America, it is Veterans Day.

Why This Matters:

Today is important for a few reasons.  For me, it's more important than for others. You see, I am a veteran of the U.S. Army.  I ended my eight year career as a Non-Commissioned Officer (NCO) in the Infantry in September of 2009.  I served in three deployments spanning almost six years of active service in Iraq, the other two years were spent in other "fun" parts of the world.

But that's not why the day is so important to me, it's only the reason why I recognize its importance.  When I was seventeen years old, I tricked my mother into signing permission for me to enlist.  She thought that I was joining the Army Band (I've been playing the guitar for over twenty years and played both guitar and clarinet in high school).  My recruiter and I knew exactly what I was doing.  Every generation of males on both sides of my family (with the exception of my mother's father) had at least one that served in the military.  My father was an Infantryman before misconduct led him to being reassigned as a mechanic and ultimately a dishonorable discharge.  My grandfather (paternal) served in the Navy as a gunner (which type he would never tell me), my maternal grandfather served in the naval reserves in Argentina, and his father fought in WWI for the Serbs (back when Yugoslavia existed).  

None of my uncles served and none of my brothers served either.  I have two daughters who, thankfully, will not cause me a heart attack by serving in the Armed Forces.  I am the last willing (I enlisted by choice) soldier in my family on both sides.  After me, the fight that passed down from the founding of the Knight's Templar, to which I can trace my ancestors, will have been filtered out of our blood so to speak.  

During my tours in Iraq I saw many things that no media outlet would ever put on national (or global) television.  I took part in operations that made me question what the Army was actually doing overseas, that made me question my humanity, and even tested the limits of my sanity.  I saw bodies in ways that no Hollywood movie could ever portray, and there is no actor that could ever play the part of any one of my fellow Soldiers, Airmen(persons), Sailors, or Marines.  None.  

I saw around me kids, old men, and everything in between.  Each joined for various reasons, like myself, and almost each served with honor (no family is without its "black sheep").  Some joined for "the college money", others because they had no job skills (of so they thought), and other because they thought that it was the right thing to do given the circumstances (a few months after I enlisted in May of 2001, 9/11 happened).  The common thread that held our dysfunctional military family together was "Duty".  Each of us had a reason that we were prepared to fight and die for.

Oh So Many...

I learned many lessons while in the military, some of which I've recognized since my Honorable Discharge in 2009 as propaganda, but they still serve as valuable reminders even today.  I was honored by my former Battalion Commander with an Army Ring.  He said that it was "because I survived".  This man had known me from the time that I was eighteen years old.  He saw me enter Iraq as "gung-ho", he saw me turn into one of the "most successful marksmen that he's ever seen", and he saw me snapped and broken.  He retired after I was discharged, but not before giving me this ring that I keep on my right hand and guard as closely as I guard my wedding band on the opposite hand.  He had it engraved on the inside of the white gold band, underneath the Infantry Blue gem with the inlaid Crossed Rifles to say "Live For Freedom".  When I asked him what he meant by "because I survived", I thought at the time "of course I survived, God has a sick sense of humor and the Army didn't authorize me to die..." (I was one cocky shooter about two pints away from a cliché).

I will never forget what he said next, "Your spirit of fighting for freedom is intact, you're not so broken as to have become apathetic to the causes of freedom.  I've watched you grow up from a snot nosed kid (in Army terms, a Private) into the NCO (Sergeant) that I wish I could have been before accepting my commission.  When you came to me you had all the fire of a dedicated killer.  Now, you leave me with all the fire of an intelligent young man.  You might have more metal in your body than when we started, but that inch of your mind and spirit that remains has survived.  When you came to me, you said that you were "willing to die for freedom", now, you're ready to live for it.  Never forget."

Of all of the lessons that man taught me, that was the most important.


Remember your veterans today, no matter what country you are from and no matter which side won or lost.  Remember that a few men (and women) stood up for what they thought was right.  I used to only remember my U.S. brethren who served, now I remember even those who's deaths I was responsible for.  Why? Because like me, they stood up for something that they believed in.  Sure, I didn't agree with them at the time and part of me still doesn't, but I can understand that drive.  I can understand what separates a civilian from a Soldier, Airman(person), Sailor, and Marine.  I can understand why someone chooses to stand between the enemy and their homeland.  Regardless of who's side you're on, who you believe is "right", or which god (or lack thereof) you're fighting for, every person that has donned the armor and weapons of their generation has fought for something.

Today, remember those that were, those who are, and those who will be your veterans.  They contain within themselves a fight, thirst, hunger, and willingness that is not found in most people.  At their hearts, every last one of them is willing to "Live For Freedom" until the objective is complete, even if they don't know it yet.

Honor your veterans in whichever way that you choose, not because you feel indebted to them, but because anyone willing to fight, die, and live for what they believe in is worth remembering.