Skip to content

Instantly share code, notes, and snippets.

@alexesDev
Created January 7, 2013 02:58
Show Gist options
  • Select an option

  • Save alexesDev/4471955 to your computer and use it in GitHub Desktop.

Select an option

Save alexesDev/4471955 to your computer and use it in GitHub Desktop.
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = err })
in_error = false
end)
end
-- }}}
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/usr/share/awesome/themes/default/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "urxvt"
editor = "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.
local layouts =
{
awful.layout.suit.max.fullscreen,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.top
}
-- }}}
tags = {}
tags[1] = awful.tag({ 1, 2, 3, 4 }, 2, layouts[1])
tags[2] = awful.tag({ 1 }, 1, awful.layout.suit.max.fullscreen)
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
awful.key({ "Mod1" }, "x", function () awful.screen.focus_relative( 1) end),
awful.key({ "Mod1" }, "c", function () awful.screen.focus_relative(-1) end),
awful.key({ "Mod1" }, "a", function() awful.tag.viewonly(tags[1][1]) end),
awful.key({ "Mod1" }, "s", function() awful.tag.viewonly(tags[1][2]) end),
awful.key({ "Mod1" }, "d", function() awful.tag.viewonly(tags[1][3]) end),
awful.key({ "Mod1" }, "f", function() awful.tag.viewonly(tags[1][4]) end),
awful.key({ "Mod1" }, "e", function () awful.util.spawn("urxvt") end),
awful.key({ "Mod1" }, "w", function () awful.util.spawn("chromium") 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" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit)
)
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ "Mod1" }, "q", function (c) c:kill() end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
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
end),
awful.key({ modkey, }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
)
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
root.keys(globalkeys)
-- }}}
awful.rules.rules = {
{ rule = { },
properties = {
focus = awful.client.focus.filter,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "Chromium" }, properties = {tag = tags[2][1]} },
{ rule = { class = "Pidgin" }, properties = {tag = tags[1][4]} }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment