1 -- Standard awesome library
2 gears = require("gears")
3 awful = require("awful")
4 awful.rules = require("awful.rules")
5 require("awful.autofocus")
6 -- Theme handling library
7 beautiful = require("beautiful")
8 -- Notification library
9 naughty = require("naughty")
10 menubar = require("menubar")
13 -- Check if awesome encountered an error during startup and fell back to
14 -- another config (This code will only ever execute for the fallback config)
15 if awesome.startup_errors then
16 naughty.notify({ preset = naughty.config.presets.critical,
17 title = "Oops, there were errors during startup!",
18 text = awesome.startup_errors })
21 -- Handle runtime errors after startup
23 local in_error = false
24 awesome.connect_signal("debug::error", function (err)
25 -- Make sure we don't go into an endless error loop
26 if in_error then return end
29 naughty.notify({ preset = naughty.config.presets.critical,
30 title = "Oops, an error happened!",
37 -- {{{ Variable definitions
38 -- Themes define colours, icons, and wallpapers
39 beautiful.init(awful.util.getdir("config").."/themes/mlp/theme.lua")
41 -- This is used later as the default terminal and editor to run.
43 editor = os.getenv("EDITOR") or "vim"
44 editor_cmd = terminal .. " -e " .. editor
51 if beautiful.wallpaper then
52 for s = 1, screen.count() do
53 gears.wallpaper.maximized(beautiful.wallpaper, s, true)
74 -- Signal function to execute when a new client appears.
75 client.connect_signal("manage", function (c, startup)
76 -- Enable sloppy focus
77 c:connect_signal("mouse::enter", function(c)
78 if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
79 and awful.client.focus.filter(c) then
85 -- Set the windows at the slave,
86 -- i.e. put it at the end of others instead of setting it master.
87 -- awful.client.setslave(c)
89 -- Put windows in a smart way, only if they does not set an initial position.
90 if not c.size_hints.user_position and not c.size_hints.program_position then
91 awful.placement.no_overlap(c)
92 awful.placement.no_offscreen(c)
97 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
98 client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
102 root.keys(globalkeys)
104 -- Autostart applications