2008-11-20 20:45:09 +01:00
|
|
|
-- Standard awesome library
|
2008-05-20 15:39:47 +02:00
|
|
|
require("awful")
|
2008-11-20 20:45:09 +01:00
|
|
|
-- Theme handling library
|
2008-08-05 22:21:22 +02:00
|
|
|
require("beautiful")
|
2008-11-20 20:45:09 +01:00
|
|
|
-- Notification library
|
|
|
|
require("naughty")
|
2008-08-05 22:21:22 +02:00
|
|
|
|
2008-06-11 23:13:15 +02:00
|
|
|
-- {{{ Variable definitions
|
2008-11-10 08:58:20 +01:00
|
|
|
-- Themes define colours, icons, and wallpapers
|
|
|
|
-- The default is a dark theme
|
2008-11-10 11:57:20 +01:00
|
|
|
theme_path = "@AWESOME_THEMES_PATH@/default/theme"
|
2008-11-10 08:58:20 +01:00
|
|
|
-- Uncommment this for a lighter theme
|
|
|
|
-- theme_path = "@AWESOME_THEMES_PATH@/sky/theme"
|
2008-08-06 15:15:13 +02:00
|
|
|
|
2008-11-13 11:53:41 +01:00
|
|
|
-- Actually load theme
|
|
|
|
beautiful.init(theme_path)
|
|
|
|
|
2008-10-22 22:51:01 +02:00
|
|
|
-- This is used later as the default terminal and editor to run.
|
2008-05-20 15:39:47 +02:00
|
|
|
terminal = "xterm"
|
2008-10-23 10:26:13 +02:00
|
|
|
editor = os.getenv("EDITOR") or "nano"
|
|
|
|
editor_cmd = terminal .. " -e " .. editor
|
2008-06-11 23:13:15 +02:00
|
|
|
|
2008-05-20 15:39:47 +02:00
|
|
|
-- 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"
|
2008-06-11 23:13:15 +02:00
|
|
|
|
2008-05-24 13:55:49 +02:00
|
|
|
-- Table of layouts to cover with awful.layout.inc, order matters.
|
2008-06-11 23:13:15 +02:00
|
|
|
layouts =
|
|
|
|
{
|
2009-01-28 12:08:33 +01:00
|
|
|
awful.layout.suit.tile,
|
|
|
|
awful.layout.suit.tile.left,
|
|
|
|
awful.layout.suit.tile.bottom,
|
|
|
|
awful.layout.suit.tile.top,
|
2008-11-25 17:01:06 +01:00
|
|
|
awful.layout.suit.fair,
|
|
|
|
awful.layout.suit.fair.horizontal,
|
|
|
|
awful.layout.suit.max,
|
|
|
|
awful.layout.suit.max.fullscreen,
|
|
|
|
awful.layout.suit.magnifier,
|
|
|
|
awful.layout.suit.floating
|
2008-06-11 23:13:15 +02:00
|
|
|
}
|
|
|
|
|
2008-08-07 12:13:54 +02:00
|
|
|
-- Table of clients that should be set floating. The index may be either
|
|
|
|
-- the application class or instance. The instance is useful when running
|
|
|
|
-- a console app in a terminal like (Music on Console)
|
|
|
|
-- xterm -name mocp -e mocp
|
|
|
|
floatapps =
|
2008-06-25 13:49:27 +02:00
|
|
|
{
|
2008-08-07 12:13:54 +02:00
|
|
|
-- by class
|
|
|
|
["MPlayer"] = true,
|
|
|
|
["pinentry"] = true,
|
2008-08-12 10:54:21 +02:00
|
|
|
["gimp"] = true,
|
2008-08-07 12:13:54 +02:00
|
|
|
-- by instance
|
|
|
|
["mocp"] = true
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Applications to be moved to a pre-defined tag by class or instance.
|
2008-08-11 17:14:02 +02:00
|
|
|
-- Use the screen and tags indices.
|
2008-08-07 12:13:54 +02:00
|
|
|
apptags =
|
|
|
|
{
|
2008-08-07 14:06:34 +02:00
|
|
|
-- ["Firefox"] = { screen = 1, tag = 2 },
|
|
|
|
-- ["mocp"] = { screen = 2, tag = 4 },
|
2008-06-25 13:49:27 +02:00
|
|
|
}
|
|
|
|
|
2008-08-06 15:15:13 +02:00
|
|
|
-- Define if we want to use titlebar on all applications.
|
2008-08-08 16:50:55 +02:00
|
|
|
use_titlebar = false
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
2008-06-09 21:43:09 +02:00
|
|
|
-- {{{ Tags
|
2008-08-06 15:15:13 +02:00
|
|
|
-- Define tags table.
|
2008-06-09 21:43:09 +02:00
|
|
|
tags = {}
|
|
|
|
for s = 1, screen.count() do
|
2008-08-06 15:15:13 +02:00
|
|
|
-- Each screen has its own tag table.
|
2008-06-09 21:43:09 +02:00
|
|
|
tags[s] = {}
|
2008-08-06 15:15:13 +02:00
|
|
|
-- Create 9 tags per screen.
|
2008-06-09 21:43:09 +02:00
|
|
|
for tagnumber = 1, 9 do
|
2008-11-25 17:01:06 +01:00
|
|
|
tags[s][tagnumber] = tag(tagnumber)
|
2008-06-09 21:43:09 +02:00
|
|
|
-- Add tags to screen one by one
|
2008-07-24 17:06:52 +02:00
|
|
|
tags[s][tagnumber].screen = s
|
2009-01-11 15:59:47 +01:00
|
|
|
awful.layout.set(layouts[1], tags[s][tagnumber])
|
2008-06-09 21:43:09 +02:00
|
|
|
end
|
|
|
|
-- I'm sure you want to see at least one tag.
|
2008-07-01 11:38:40 +02:00
|
|
|
tags[s][1].selected = true
|
2008-05-20 15:39:47 +02:00
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
2008-09-24 12:13:21 +02:00
|
|
|
-- {{{ Wibox
|
2008-05-20 15:39:47 +02:00
|
|
|
-- Create a textbox widget
|
2008-11-06 14:04:01 +01:00
|
|
|
mytextbox = widget({ type = "textbox", align = "right" })
|
2008-05-20 15:39:47 +02:00
|
|
|
-- Set the default text in textbox
|
2009-04-28 16:21:50 +02:00
|
|
|
mytextbox.text = "<b><small> " .. awesome.release .. " </small></b>"
|
2008-05-20 15:39:47 +02:00
|
|
|
|
2008-10-22 14:30:33 +02:00
|
|
|
-- Create a laucher widget and a main menu
|
|
|
|
myawesomemenu = {
|
2008-11-06 14:05:56 +01:00
|
|
|
{ "manual", terminal .. " -e man awesome" },
|
|
|
|
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
|
|
|
|
{ "restart", awesome.restart },
|
|
|
|
{ "quit", awesome.quit }
|
2008-10-22 14:30:33 +02:00
|
|
|
}
|
|
|
|
|
2008-11-08 21:06:42 +01:00
|
|
|
mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
2008-11-07 15:27:35 +01:00
|
|
|
{ "open terminal", terminal }
|
|
|
|
}
|
|
|
|
})
|
2008-10-22 14:30:33 +02:00
|
|
|
|
2008-12-03 15:23:10 +01:00
|
|
|
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
|
2008-11-07 15:27:35 +01:00
|
|
|
menu = mymainmenu })
|
2008-05-20 15:39:47 +02:00
|
|
|
|
2008-06-14 18:12:16 +02:00
|
|
|
-- Create a systray
|
2008-11-06 14:04:01 +01:00
|
|
|
mysystray = widget({ type = "systray", align = "right" })
|
2008-06-14 18:12:16 +02:00
|
|
|
|
2008-09-24 12:13:21 +02:00
|
|
|
-- Create a wibox for each screen and add it
|
|
|
|
mywibox = {}
|
2008-10-13 11:28:36 +02:00
|
|
|
mypromptbox = {}
|
2008-10-19 19:14:55 +02:00
|
|
|
mylayoutbox = {}
|
|
|
|
mytaglist = {}
|
2009-04-17 11:13:22 +02:00
|
|
|
mytaglist.buttons = awful.util.table.join(
|
|
|
|
awful.button({ }, 1, awful.tag.viewonly),
|
|
|
|
awful.button({ modkey }, 1, awful.client.movetotag),
|
|
|
|
awful.button({ }, 3, function (tag) tag.selected = not tag.selected end),
|
|
|
|
awful.button({ modkey }, 3, awful.client.toggletag),
|
|
|
|
awful.button({ }, 4, awful.tag.viewnext),
|
|
|
|
awful.button({ }, 5, awful.tag.viewprev)
|
|
|
|
)
|
2008-10-19 19:14:55 +02:00
|
|
|
mytasklist = {}
|
2009-04-17 11:13:22 +02:00
|
|
|
mytasklist.buttons = awful.util.table.join(
|
|
|
|
awful.button({ }, 1, function (c)
|
|
|
|
if not c:isvisible() then
|
|
|
|
awful.tag.viewonly(c:tags()[1])
|
|
|
|
end
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
|
|
|
end),
|
|
|
|
awful.button({ }, 3, function ()
|
|
|
|
if instance then
|
|
|
|
instance:hide()
|
|
|
|
instance = nil
|
|
|
|
else
|
|
|
|
instance = awful.menu.clients({ width=250 })
|
|
|
|
end
|
|
|
|
end),
|
|
|
|
awful.button({ }, 4, function ()
|
|
|
|
awful.client.focus.byidx(1)
|
|
|
|
if client.focus then client.focus:raise() end
|
|
|
|
end),
|
|
|
|
awful.button({ }, 5, function ()
|
|
|
|
awful.client.focus.byidx(-1)
|
|
|
|
if client.focus then client.focus:raise() end
|
|
|
|
end))
|
2008-10-19 19:14:55 +02:00
|
|
|
|
2008-05-27 16:07:17 +02:00
|
|
|
for s = 1, screen.count() do
|
2008-10-19 19:14:55 +02:00
|
|
|
-- Create a promptbox for each screen
|
2009-04-27 22:08:33 +02:00
|
|
|
mypromptbox[s] = awful.widget.prompt({ align = "left" })
|
2008-10-19 19:14:55 +02:00
|
|
|
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
|
|
|
|
-- We need one layoutbox per screen.
|
2008-11-06 14:04:01 +01:00
|
|
|
mylayoutbox[s] = widget({ type = "imagebox", align = "right" })
|
2009-04-17 11:13:22 +02:00
|
|
|
mylayoutbox[s]:buttons(awful.util.table.join(
|
|
|
|
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)))
|
2008-10-19 19:14:55 +02:00
|
|
|
-- Create a taglist widget
|
|
|
|
mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, mytaglist.buttons)
|
|
|
|
|
|
|
|
-- Create a tasklist widget
|
|
|
|
mytasklist[s] = awful.widget.tasklist.new(function(c)
|
|
|
|
return awful.widget.tasklist.label.currenttags(c, s)
|
|
|
|
end, mytasklist.buttons)
|
|
|
|
|
|
|
|
-- Create the wibox
|
2008-10-26 16:37:44 +01:00
|
|
|
mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal })
|
2008-09-24 12:13:21 +02:00
|
|
|
-- Add widgets to the wibox - order matters
|
2008-11-06 14:06:37 +01:00
|
|
|
mywibox[s].widgets = { mylauncher,
|
|
|
|
mytaglist[s],
|
2008-10-19 19:14:55 +02:00
|
|
|
mytasklist[s],
|
|
|
|
mypromptbox[s],
|
|
|
|
mytextbox,
|
|
|
|
mylayoutbox[s],
|
|
|
|
s == 1 and mysystray or nil }
|
2008-09-24 12:13:21 +02:00
|
|
|
mywibox[s].screen = s
|
2008-05-20 15:39:47 +02:00
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Mouse bindings
|
2009-04-17 11:13:22 +02:00
|
|
|
root.buttons(awful.util.table.join(
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.button({ }, 3, function () mymainmenu:toggle() end),
|
|
|
|
awful.button({ }, 4, awful.tag.viewnext),
|
|
|
|
awful.button({ }, 5, awful.tag.viewprev)
|
2009-04-17 11:13:22 +02:00
|
|
|
))
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Key bindings
|
2009-04-17 11:13:22 +02:00
|
|
|
globalkeys = awful.util.table.join(
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
|
|
|
|
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
|
|
|
|
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.key({ modkey, }, "j",
|
2009-02-24 17:42:21 +01:00
|
|
|
function ()
|
|
|
|
awful.client.focus.byidx( 1)
|
|
|
|
if client.focus then client.focus:raise() end
|
|
|
|
end),
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.key({ modkey, }, "k",
|
2009-02-24 17:42:21 +01:00
|
|
|
function ()
|
|
|
|
awful.client.focus.byidx(-1)
|
|
|
|
if client.focus then client.focus:raise() end
|
|
|
|
end),
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.key({ modkey, }, "w", function () mymainmenu:show(true) end),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
|
|
|
-- Layout manipulation
|
2009-04-14 17:53:22 +02:00
|
|
|
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( 1) end),
|
|
|
|
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end),
|
|
|
|
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
|
|
|
|
awful.key({ modkey, }, "Tab",
|
2009-02-24 17:42:21 +01:00
|
|
|
function ()
|
|
|
|
awful.client.focus.history.previous()
|
|
|
|
if client.focus then
|
|
|
|
client.focus:raise()
|
|
|
|
end
|
|
|
|
end),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
|
|
|
-- Standard program
|
2009-04-14 17:53:22 +02:00
|
|
|
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),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
|
|
|
-- Prompt
|
2009-04-27 22:08:33 +02:00
|
|
|
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
|
2009-04-14 17:53:22 +02:00
|
|
|
|
2009-04-17 18:19:37 +02:00
|
|
|
awful.key({ modkey }, "x",
|
2009-04-14 17:53:22 +02:00
|
|
|
function ()
|
|
|
|
awful.prompt.run({ prompt = "Run Lua code: " },
|
2009-04-27 22:08:33 +02:00
|
|
|
mypromptbox[mouse.screen].widget,
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.util.eval, nil,
|
|
|
|
awful.util.getdir("cache") .. "/history_eval")
|
2009-04-17 11:13:22 +02:00
|
|
|
end)
|
|
|
|
)
|
2009-02-20 15:02:22 +01:00
|
|
|
|
|
|
|
-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
|
2009-04-17 11:13:22 +02:00
|
|
|
clientkeys = awful.util.table.join(
|
2009-04-14 17:53:22 +02:00
|
|
|
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", awful.client.togglemarked),
|
|
|
|
awful.key({ modkey,}, "m",
|
2009-02-20 15:02:22 +01:00
|
|
|
function (c)
|
|
|
|
c.maximized_horizontal = not c.maximized_horizontal
|
|
|
|
c.maximized_vertical = not c.maximized_vertical
|
2009-04-17 11:13:22 +02:00
|
|
|
end)
|
|
|
|
)
|
2009-02-20 15:02:22 +01:00
|
|
|
|
2008-05-20 15:39:47 +02:00
|
|
|
-- Compute the maximum number of digit we need, limited to 9
|
2008-06-09 21:43:09 +02:00
|
|
|
keynumber = 0
|
|
|
|
for s = 1, screen.count() do
|
|
|
|
keynumber = math.min(9, math.max(#tags[s], keynumber));
|
|
|
|
end
|
|
|
|
|
2008-05-20 15:39:47 +02:00
|
|
|
for i = 1, keynumber do
|
2009-04-17 11:13:22 +02:00
|
|
|
table.foreach(awful.key({ modkey }, i,
|
|
|
|
function ()
|
2009-04-14 17:53:22 +02:00
|
|
|
local screen = mouse.screen
|
|
|
|
if tags[screen][i] then
|
2009-04-17 11:13:22 +02:00
|
|
|
awful.tag.viewonly(tags[screen][i])
|
2009-04-14 17:53:22 +02:00
|
|
|
end
|
2009-04-17 11:13:22 +02:00
|
|
|
end), function(_, k) table.insert(globalkeys, k) end)
|
|
|
|
table.foreach(awful.key({ modkey, "Control" }, i,
|
|
|
|
function ()
|
|
|
|
local screen = mouse.screen
|
|
|
|
if tags[screen][i] then
|
|
|
|
tags[screen][i].selected = not tags[screen][i].selected
|
|
|
|
end
|
|
|
|
end), function(_, k) table.insert(globalkeys, k) end)
|
|
|
|
table.foreach(awful.key({ modkey, "Shift" }, i,
|
|
|
|
function ()
|
|
|
|
if client.focus and tags[client.focus.screen][i] then
|
|
|
|
awful.client.movetotag(tags[client.focus.screen][i])
|
|
|
|
end
|
|
|
|
end), function(_, k) table.insert(globalkeys, k) end)
|
|
|
|
table.foreach(awful.key({ modkey, "Control", "Shift" }, i,
|
|
|
|
function ()
|
|
|
|
if client.focus and tags[client.focus.screen][i] then
|
|
|
|
awful.client.toggletag(tags[client.focus.screen][i])
|
|
|
|
end
|
|
|
|
end), function(_, k) table.insert(globalkeys, k) end)
|
|
|
|
table.foreach(awful.key({ modkey, "Shift" }, "F" .. i,
|
|
|
|
function ()
|
|
|
|
local screen = mouse.screen
|
|
|
|
if tags[screen][i] then
|
|
|
|
for k, c in pairs(awful.client.getmarked()) do
|
|
|
|
awful.client.movetotag(tags[screen][i], c)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end), function(_, k) table.insert(globalkeys, k) end)
|
2008-05-20 15:39:47 +02:00
|
|
|
end
|
|
|
|
|
2009-01-05 16:59:20 +01:00
|
|
|
-- Set keys
|
|
|
|
root.keys(globalkeys)
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Hooks
|
|
|
|
-- Hook function to execute when focusing a client.
|
2008-08-25 15:35:17 +02:00
|
|
|
awful.hooks.focus.register(function (c)
|
2008-06-11 10:35:54 +02:00
|
|
|
if not awful.client.ismarked(c) then
|
2008-08-05 22:21:22 +02:00
|
|
|
c.border_color = beautiful.border_focus
|
2008-06-11 10:35:54 +02:00
|
|
|
end
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-05-20 15:39:47 +02:00
|
|
|
|
|
|
|
-- Hook function to execute when unfocusing a client.
|
2008-08-25 15:35:17 +02:00
|
|
|
awful.hooks.unfocus.register(function (c)
|
2008-06-11 10:35:54 +02:00
|
|
|
if not awful.client.ismarked(c) then
|
2008-08-05 22:21:22 +02:00
|
|
|
c.border_color = beautiful.border_normal
|
2008-06-11 10:35:54 +02:00
|
|
|
end
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-06-11 10:35:54 +02:00
|
|
|
|
|
|
|
-- Hook function to execute when marking a client
|
2008-08-25 15:35:17 +02:00
|
|
|
awful.hooks.marked.register(function (c)
|
2008-08-05 22:21:22 +02:00
|
|
|
c.border_color = beautiful.border_marked
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-06-11 10:35:54 +02:00
|
|
|
|
2008-10-26 08:41:05 +01:00
|
|
|
-- Hook function to execute when unmarking a client.
|
2008-08-25 15:35:17 +02:00
|
|
|
awful.hooks.unmarked.register(function (c)
|
2008-08-05 22:21:22 +02:00
|
|
|
c.border_color = beautiful.border_focus
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-05-20 15:39:47 +02:00
|
|
|
|
2008-10-26 08:41:05 +01:00
|
|
|
-- Hook function to execute when the mouse enters a client.
|
2008-09-22 17:54:48 +02:00
|
|
|
awful.hooks.mouse_enter.register(function (c)
|
2008-05-27 22:18:19 +02:00
|
|
|
-- Sloppy focus, but disabled for magnifier layout
|
2008-11-25 17:01:06 +01:00
|
|
|
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
2008-09-08 00:09:50 +02:00
|
|
|
and awful.client.focus.filter(c) then
|
2008-08-12 12:08:20 +02:00
|
|
|
client.focus = c
|
2008-05-27 22:18:19 +02:00
|
|
|
end
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-05-20 15:39:47 +02:00
|
|
|
|
|
|
|
-- Hook function to execute when a new client appears.
|
2008-12-29 12:23:37 +01:00
|
|
|
awful.hooks.manage.register(function (c, startup)
|
2008-12-29 17:24:19 +01:00
|
|
|
-- If we are not managing this application at startup,
|
|
|
|
-- move it to the screen where the mouse is.
|
|
|
|
-- We only do it for filtered windows (i.e. no dock, etc).
|
|
|
|
if not startup and awful.client.focus.filter(c) then
|
|
|
|
c.screen = mouse.screen
|
|
|
|
end
|
|
|
|
|
2008-07-31 17:52:34 +02:00
|
|
|
if use_titlebar then
|
|
|
|
-- Add a titlebar
|
2008-08-06 15:15:13 +02:00
|
|
|
awful.titlebar.add(c, { modkey = modkey })
|
2008-07-31 17:52:34 +02:00
|
|
|
end
|
2008-06-13 15:35:47 +02:00
|
|
|
-- Add mouse bindings
|
2009-04-17 11:13:22 +02:00
|
|
|
c:buttons(awful.util.table.join(
|
2009-04-14 17:53:22 +02:00
|
|
|
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)
|
2009-04-17 11:13:22 +02:00
|
|
|
))
|
2008-05-23 23:08:37 +02:00
|
|
|
-- New client may not receive focus
|
|
|
|
-- if they're not focusable, so set border anyway.
|
2008-08-05 22:21:22 +02:00
|
|
|
c.border_width = beautiful.border_width
|
|
|
|
c.border_color = beautiful.border_normal
|
2008-08-07 12:13:54 +02:00
|
|
|
|
|
|
|
-- Check if the application should be floating.
|
|
|
|
local cls = c.class
|
|
|
|
local inst = c.instance
|
|
|
|
if floatapps[cls] then
|
2009-01-06 12:35:33 +01:00
|
|
|
awful.client.floating.set(c, floatapps[cls])
|
2008-08-07 12:13:54 +02:00
|
|
|
elseif floatapps[inst] then
|
2009-01-06 12:35:33 +01:00
|
|
|
awful.client.floating.set(c, floatapps[inst])
|
2008-05-23 13:49:59 +02:00
|
|
|
end
|
2008-08-07 12:13:54 +02:00
|
|
|
|
|
|
|
-- Check application->screen/tag mappings.
|
|
|
|
local target
|
|
|
|
if apptags[cls] then
|
|
|
|
target = apptags[cls]
|
|
|
|
elseif apptags[inst] then
|
|
|
|
target = apptags[inst]
|
|
|
|
end
|
|
|
|
if target then
|
|
|
|
c.screen = target.screen
|
|
|
|
awful.client.movetotag(tags[target.screen][target.tag], c)
|
|
|
|
end
|
|
|
|
|
2008-11-21 15:40:05 +01:00
|
|
|
-- Do this after tag mapping, so you don't see it on the wrong tag for a split second.
|
|
|
|
client.focus = c
|
|
|
|
|
2009-01-05 16:59:20 +01:00
|
|
|
-- Set key bindings
|
|
|
|
c:keys(clientkeys)
|
|
|
|
|
2008-09-10 17:04:54 +02:00
|
|
|
-- Set the windows at the slave,
|
|
|
|
-- i.e. put it at the end of others instead of setting it master.
|
|
|
|
-- awful.client.setslave(c)
|
|
|
|
|
2008-09-03 20:22:33 +02:00
|
|
|
-- Honor size hints: if you want to drop the gaps between windows, set this to false.
|
2008-12-09 11:38:29 +01:00
|
|
|
-- c.size_hints_honor = false
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-05-20 15:39:47 +02:00
|
|
|
|
2008-10-26 08:41:05 +01:00
|
|
|
-- Hook function to execute when arranging the screen.
|
2008-06-09 21:43:09 +02:00
|
|
|
-- (tag switch, new client, etc)
|
2008-08-25 15:35:17 +02:00
|
|
|
awful.hooks.arrange.register(function (screen)
|
2008-11-25 17:01:06 +01:00
|
|
|
local layout = awful.layout.getname(awful.layout.get(screen))
|
|
|
|
if layout and beautiful["layout_" ..layout] then
|
2008-11-09 15:57:00 +01:00
|
|
|
mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
|
2008-09-11 15:57:06 +02:00
|
|
|
else
|
|
|
|
mylayoutbox[screen].image = nil
|
2008-08-11 18:20:00 +02:00
|
|
|
end
|
2008-07-30 15:37:05 +02:00
|
|
|
|
2008-09-08 00:09:50 +02:00
|
|
|
-- Give focus to the latest client in history if no window has focus
|
|
|
|
-- or if the current window is a desktop or a dock one.
|
2008-08-12 12:08:20 +02:00
|
|
|
if not client.focus then
|
2008-07-31 22:33:18 +02:00
|
|
|
local c = awful.client.focus.history.get(screen, 0)
|
2008-08-12 12:08:20 +02:00
|
|
|
if c then client.focus = c end
|
2008-07-31 15:51:28 +02:00
|
|
|
end
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-05-23 17:21:39 +02:00
|
|
|
|
2009-02-23 13:43:13 +01:00
|
|
|
-- Hook called every minute
|
|
|
|
awful.hooks.timer.register(60, function ()
|
|
|
|
mytextbox.text = os.date(" %a %b %d, %H:%M ")
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|