2008-11-20 20:45:09 +01:00
|
|
|
-- Standard awesome library
|
2012-07-29 16:47:04 +02:00
|
|
|
local gears = require("gears")
|
2012-06-12 20:13:09 +02:00
|
|
|
local awful = require("awful")
|
|
|
|
awful.rules = require("awful.rules")
|
2009-08-19 11:21:56 +02:00
|
|
|
require("awful.autofocus")
|
2010-10-06 14:32:41 +02:00
|
|
|
-- Widget and layout library
|
2012-06-12 14:14:57 +02:00
|
|
|
local wibox = require("wibox")
|
2008-11-20 20:45:09 +01:00
|
|
|
-- Theme handling library
|
2012-06-12 03:24:22 +02:00
|
|
|
local beautiful = require("beautiful")
|
2008-11-20 20:45:09 +01:00
|
|
|
-- Notification library
|
2012-06-12 03:48:41 +02:00
|
|
|
local naughty = require("naughty")
|
2012-06-12 10:36:28 +02:00
|
|
|
local menubar = require("menubar")
|
2008-08-05 22:21:22 +02:00
|
|
|
|
2011-10-23 15:59:15 +02:00
|
|
|
-- {{{ 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
|
2011-10-23 17:36:56 +02:00
|
|
|
|
|
|
|
-- 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
|
2011-10-23 15:59:15 +02:00
|
|
|
-- }}}
|
|
|
|
|
2008-06-11 23:13:15 +02:00
|
|
|
-- {{{ Variable definitions
|
2009-09-28 13:42:34 +02:00
|
|
|
-- Themes define colours, icons, and wallpapers
|
|
|
|
beautiful.init("@AWESOME_THEMES_PATH@/default/theme.lua")
|
|
|
|
|
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.
|
2012-06-14 02:45:17 +02:00
|
|
|
local layouts =
|
2008-06-11 23:13:15 +02:00
|
|
|
{
|
2009-12-21 09:18:51 +01:00
|
|
|
awful.layout.suit.floating,
|
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,
|
2009-07-12 20:27:41 +02:00
|
|
|
awful.layout.suit.spiral,
|
|
|
|
awful.layout.suit.spiral.dwindle,
|
2008-11-25 17:01:06 +01:00
|
|
|
awful.layout.suit.max,
|
|
|
|
awful.layout.suit.max.fullscreen,
|
2009-12-21 09:18:51 +01:00
|
|
|
awful.layout.suit.magnifier
|
2008-06-11 23:13:15 +02:00
|
|
|
}
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
2012-07-29 16:47:04 +02:00
|
|
|
-- {{{ Wallpaper
|
|
|
|
if beautiful.wallpaper then
|
|
|
|
for s = 1, screen.count() do
|
|
|
|
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
2008-06-09 21:43:09 +02:00
|
|
|
-- {{{ Tags
|
2009-08-21 15:50:10 +02:00
|
|
|
-- Define a tag table which hold all screen tags.
|
2012-06-16 13:23:00 +02:00
|
|
|
tags = {}
|
2008-06-09 21:43:09 +02:00
|
|
|
for s = 1, screen.count() do
|
2008-08-06 15:15:13 +02:00
|
|
|
-- Each screen has its own tag table.
|
2009-12-21 09:18:51 +01:00
|
|
|
tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1])
|
2008-05-20 15:39:47 +02:00
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
2009-08-31 11:52:49 +02:00
|
|
|
-- {{{ Menu
|
2009-09-08 10:23:18 +02:00
|
|
|
-- Create a laucher widget and a main menu
|
|
|
|
myawesomemenu = {
|
|
|
|
{ "manual", terminal .. " -e man awesome" },
|
2011-09-17 17:24:44 +02:00
|
|
|
{ "edit config", editor_cmd .. " " .. awesome.conffile },
|
2009-09-08 10:23:18 +02:00
|
|
|
{ "restart", awesome.restart },
|
|
|
|
{ "quit", awesome.quit }
|
|
|
|
}
|
|
|
|
|
2009-08-31 11:52:49 +02:00
|
|
|
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
|
|
|
{ "open terminal", terminal }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2010-09-29 13:26:09 +02:00
|
|
|
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
2009-08-31 11:52:49 +02:00
|
|
|
menu = mymainmenu })
|
2012-03-08 20:24:21 +01:00
|
|
|
|
|
|
|
-- Menubar configuration
|
|
|
|
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
2009-08-31 11:52:49 +02:00
|
|
|
-- }}}
|
|
|
|
|
2008-09-24 12:13:21 +02:00
|
|
|
-- {{{ Wibox
|
2009-06-30 12:20:45 +02:00
|
|
|
-- Create a textclock widget
|
2010-10-06 14:32:41 +02:00
|
|
|
mytextclock = awful.widget.textclock()
|
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),
|
2009-08-27 17:20:14 +02:00
|
|
|
awful.button({ }, 3, awful.tag.viewtoggle),
|
2009-04-17 11:13:22 +02:00
|
|
|
awful.button({ modkey }, 3, awful.client.toggletag),
|
2012-10-25 18:39:19 +02:00
|
|
|
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
|
|
|
|
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
|
2009-04-17 11:13:22 +02:00
|
|
|
)
|
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)
|
2011-04-24 17:24:43 +02:00
|
|
|
if c == client.focus then
|
|
|
|
c.minimized = true
|
|
|
|
else
|
2012-07-09 21:26:00 +02:00
|
|
|
-- Without this, the following
|
|
|
|
-- :isvisible() makes no sense
|
|
|
|
c.minimized = false
|
2011-04-24 17:24:43 +02:00
|
|
|
if not c:isvisible() then
|
|
|
|
awful.tag.viewonly(c:tags()[1])
|
|
|
|
end
|
|
|
|
-- This will also un-minimize
|
|
|
|
-- the client, if needed
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
2009-04-17 11:13:22 +02:00
|
|
|
end
|
|
|
|
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-10-24 15:06:54 +02:00
|
|
|
mypromptbox[s] = awful.widget.prompt()
|
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.
|
2009-03-10 19:31:28 +01:00
|
|
|
mylayoutbox[s] = awful.widget.layoutbox(s)
|
2009-08-14 16:46:35 +02:00
|
|
|
mylayoutbox[s]:buttons(awful.util.table.join(
|
2009-04-17 11:13:22 +02:00
|
|
|
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),
|
2009-08-14 16:46:35 +02:00
|
|
|
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
|
2008-10-19 19:14:55 +02:00
|
|
|
-- Create a taglist widget
|
2009-10-24 15:06:54 +02:00
|
|
|
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
|
2008-10-19 19:14:55 +02:00
|
|
|
|
|
|
|
-- Create a tasklist widget
|
2009-10-24 15:06:54 +02:00
|
|
|
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
2008-10-19 19:14:55 +02:00
|
|
|
|
|
|
|
-- Create the wibox
|
2009-05-05 17:32:53 +02:00
|
|
|
mywibox[s] = awful.wibox({ position = "top", screen = s })
|
2009-10-24 15:06:54 +02:00
|
|
|
|
2010-10-06 14:32:41 +02:00
|
|
|
-- Widgets that are aligned to the left
|
|
|
|
local left_layout = wibox.layout.fixed.horizontal()
|
|
|
|
left_layout:add(mylauncher)
|
|
|
|
left_layout:add(mytaglist[s])
|
|
|
|
left_layout:add(mypromptbox[s])
|
|
|
|
|
|
|
|
-- Widgets that are aligned to the right
|
|
|
|
local right_layout = wibox.layout.fixed.horizontal()
|
2010-10-07 11:54:45 +02:00
|
|
|
if s == 1 then right_layout:add(wibox.widget.systray()) end
|
2010-10-06 14:32:41 +02:00
|
|
|
right_layout:add(mytextclock)
|
|
|
|
right_layout:add(mylayoutbox[s])
|
|
|
|
|
|
|
|
-- Now bring it all together (with the tasklist in the middle)
|
|
|
|
local layout = wibox.layout.align.horizontal()
|
|
|
|
layout:set_left(left_layout)
|
|
|
|
layout:set_middle(mytasklist[s])
|
|
|
|
layout:set_right(right_layout)
|
|
|
|
|
|
|
|
mywibox[s]:set_widget(layout)
|
2008-05-20 15:39:47 +02:00
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Mouse bindings
|
2009-08-14 16:46:35 +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),
|
2009-08-14 16:46:35 +02:00
|
|
|
awful.button({ }, 5, awful.tag.viewprev)
|
|
|
|
))
|
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),
|
2012-03-01 20:12:56 +01:00
|
|
|
awful.key({ modkey, }, "w", function () mymainmenu:show() end),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
|
|
|
-- Layout manipulation
|
2009-08-21 16:05:02 +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_relative( 1) end),
|
|
|
|
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
|
2009-04-14 17:53:22 +02:00
|
|
|
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
|
|
|
|
2011-02-19 22:25:12 +01:00
|
|
|
awful.key({ modkey, "Control" }, "n", awful.client.restore),
|
|
|
|
|
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")
|
2012-03-08 20:24:21 +01:00
|
|
|
end),
|
|
|
|
-- Menubar
|
|
|
|
awful.key({ modkey }, "p", function() menubar.show() end)
|
2009-04-17 11:13:22 +02:00
|
|
|
)
|
2009-02-20 15:02:22 +01:00
|
|
|
|
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 ),
|
2010-03-04 03:46:45 +01:00
|
|
|
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
|
2011-04-28 20:14:11 +02:00
|
|
|
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),
|
2009-08-25 14:56:17 +02:00
|
|
|
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
|
|
|
|
2009-09-18 11:41:55 +02:00
|
|
|
-- 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.
|
2013-03-22 05:59:05 +01:00
|
|
|
for i = 1, 9 do
|
2009-05-09 20:31:26 +02:00
|
|
|
globalkeys = awful.util.table.join(globalkeys,
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
2009-04-14 17:53:22 +02:00
|
|
|
local screen = mouse.screen
|
2013-03-22 05:59:05 +01:00
|
|
|
local tag = awful.tag.gettags(screen)[i]
|
|
|
|
if tag then
|
|
|
|
awful.tag.viewonly(tag)
|
2009-04-14 17:53:22 +02:00
|
|
|
end
|
2009-05-09 20:31:26 +02:00
|
|
|
end),
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
|
|
|
local screen = mouse.screen
|
2013-03-22 05:59:05 +01:00
|
|
|
local tag = awful.tag.gettags(screen)[i]
|
|
|
|
if tag then
|
|
|
|
awful.tag.viewtoggle(tag)
|
2009-04-17 11:13:22 +02:00
|
|
|
end
|
2009-05-09 20:31:26 +02:00
|
|
|
end),
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
2013-03-22 05:59:05 +01:00
|
|
|
local tag = awful.tag.gettags(client.focus.screen)[i]
|
|
|
|
if client.focus and tag then
|
|
|
|
awful.client.movetotag(tag)
|
|
|
|
end
|
2009-05-09 20:31:26 +02:00
|
|
|
end),
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
2013-03-22 05:59:05 +01:00
|
|
|
local tag = awful.tag.gettags(client.focus.screen)[i]
|
|
|
|
if client.focus and tag then
|
|
|
|
awful.client.toggletag(tag)
|
2009-04-17 11:13:22 +02:00
|
|
|
end
|
2009-08-17 17:37:38 +02:00
|
|
|
end))
|
2008-05-20 15:39:47 +02:00
|
|
|
end
|
|
|
|
|
2009-08-24 16:27:35 +02:00
|
|
|
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))
|
|
|
|
|
2009-01-05 16:59:20 +01:00
|
|
|
-- Set keys
|
2009-08-14 16:46:35 +02:00
|
|
|
root.keys(globalkeys)
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
2009-08-24 16:27:35 +02:00
|
|
|
-- {{{ Rules
|
|
|
|
awful.rules.rules = {
|
|
|
|
-- All clients will match this rule.
|
|
|
|
{ rule = { },
|
|
|
|
properties = { border_width = beautiful.border_width,
|
|
|
|
border_color = beautiful.border_normal,
|
2012-07-06 17:30:35 +02:00
|
|
|
focus = awful.client.focus.filter,
|
2009-08-24 16:27:35 +02:00
|
|
|
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.
|
2009-08-25 11:09:12 +02:00
|
|
|
-- { rule = { class = "Firefox" },
|
2009-08-24 16:27:35 +02:00
|
|
|
-- properties = { tag = tags[1][2] } },
|
|
|
|
}
|
|
|
|
-- }}}
|
|
|
|
|
2009-08-19 15:49:15 +02:00
|
|
|
-- {{{ Signals
|
|
|
|
-- Signal function to execute when a new client appears.
|
2009-10-09 20:39:55 +02:00
|
|
|
client.connect_signal("manage", function (c, startup)
|
2009-08-19 15:49:15 +02:00
|
|
|
-- Enable sloppy focus
|
2009-10-09 20:39:55 +02:00
|
|
|
c:connect_signal("mouse::enter", function(c)
|
2009-08-19 15:49:15 +02:00
|
|
|
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
|
|
|
and awful.client.focus.filter(c) then
|
|
|
|
client.focus = c
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2009-09-18 11:35:59 +02:00
|
|
|
if not startup then
|
|
|
|
-- Set the windows at the slave,
|
|
|
|
-- i.e. put it at the end of others instead of setting it master.
|
|
|
|
-- awful.client.setslave(c)
|
|
|
|
|
2009-09-23 10:07:02 +02:00
|
|
|
-- 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
|
|
|
|
awful.placement.no_overlap(c)
|
|
|
|
awful.placement.no_offscreen(c)
|
|
|
|
end
|
2009-09-18 11:35:59 +02:00
|
|
|
end
|
2012-10-23 20:32:59 +02:00
|
|
|
|
|
|
|
local titlebars_enabled = false
|
|
|
|
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
|
2013-03-14 20:14:43 +01:00
|
|
|
-- buttons for the titlebar
|
|
|
|
local buttons = awful.util.table.join(
|
|
|
|
awful.button({ }, 1, function()
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
|
|
|
awful.mouse.client.move(c)
|
|
|
|
end),
|
|
|
|
awful.button({ }, 3, function()
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
|
|
|
awful.mouse.client.resize(c)
|
|
|
|
end)
|
|
|
|
)
|
|
|
|
|
2012-10-23 20:32:59 +02:00
|
|
|
-- Widgets that are aligned to the left
|
|
|
|
local left_layout = wibox.layout.fixed.horizontal()
|
|
|
|
left_layout:add(awful.titlebar.widget.iconwidget(c))
|
2013-03-14 20:14:43 +01:00
|
|
|
left_layout:buttons(buttons)
|
2012-10-23 20:32:59 +02:00
|
|
|
|
|
|
|
-- Widgets that are aligned to the right
|
|
|
|
local right_layout = wibox.layout.fixed.horizontal()
|
|
|
|
right_layout:add(awful.titlebar.widget.floatingbutton(c))
|
|
|
|
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
|
|
|
|
right_layout:add(awful.titlebar.widget.stickybutton(c))
|
|
|
|
right_layout:add(awful.titlebar.widget.ontopbutton(c))
|
|
|
|
right_layout:add(awful.titlebar.widget.closebutton(c))
|
|
|
|
|
|
|
|
-- The title goes in the middle
|
2013-03-14 20:14:43 +01:00
|
|
|
local middle_layout = wibox.layout.flex.horizontal()
|
2012-10-23 20:32:59 +02:00
|
|
|
local title = awful.titlebar.widget.titlewidget(c)
|
2013-03-14 20:14:43 +01:00
|
|
|
title:set_align("center")
|
|
|
|
middle_layout:add(title)
|
|
|
|
middle_layout:buttons(buttons)
|
2012-10-23 20:32:59 +02:00
|
|
|
|
|
|
|
-- Now bring it all together
|
|
|
|
local layout = wibox.layout.align.horizontal()
|
|
|
|
layout:set_left(left_layout)
|
|
|
|
layout:set_right(right_layout)
|
2013-03-14 20:14:43 +01:00
|
|
|
layout:set_middle(middle_layout)
|
2012-10-23 20:32:59 +02:00
|
|
|
|
|
|
|
awful.titlebar(c):set_widget(layout)
|
|
|
|
end
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2009-08-21 16:08:38 +02:00
|
|
|
|
2009-10-09 20:39:55 +02:00
|
|
|
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
|
|
|
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|