]> git.rmz.io Git - dotfiles.git/blob - awesome/rc.lua
awesome: some cleanup
[dotfiles.git] / awesome / rc.lua
1 -- Standard awesome library {{{1
2 gears = require("gears")
3 awful = require("awful")
4 awful.rules = require("awful.rules")
5 require("awful.autofocus")
6 beautiful = require("beautiful")
7 naughty = require("naughty")
8 menubar = require("menubar")
9
10 -- Error handling {{{1
11 -- Check if awesome encountered an error during startup and fell back to
12 -- another config (This code will only ever execute for the fallback config)
13 if awesome.startup_errors then
14 naughty.notify({ preset = naughty.config.presets.critical,
15 title = "Oops, there were errors during startup!",
16 text = awesome.startup_errors })
17 end
18
19 -- Handle runtime errors after startup
20 do
21 local in_error = false
22 awesome.connect_signal("debug::error", function (err)
23 -- Make sure we don't go into an endless error loop
24 if in_error then return end
25 in_error = true
26
27 naughty.notify({ preset = naughty.config.presets.critical,
28 title = "Oops, an error happened!",
29 text = err })
30 in_error = false
31 end)
32 end
33
34 -- Variable definitions {{{1
35 -- Themes define colours, icons, and wallpapers
36 beautiful.init(awful.util.getdir("config").."/themes/mlp/theme.lua")
37
38 -- This is used later as the default terminal and editor to run.
39 terminal = "urxvtc"
40 editor = os.getenv("EDITOR") or "vim"
41 editor_cmd = terminal .. " -e " .. editor
42
43 -- Wallpaper {{{1
44 if beautiful.wallpaper then
45 for s = 1, screen.count() do
46 gears.wallpaper.maximized(beautiful.wallpaper, s, true)
47 end
48 end
49
50 -- Require files {{{1
51 require("tags")
52 require("menu")
53 require("topbar")
54 require("bindings")
55 require("rules")
56 require("conky")
57 require("autostart")
58
59 -- Signals {{{1
60 -- Signal function to execute when a new client appears.
61 client.connect_signal("manage", function (c, startup)
62 -- Enable sloppy focus
63 c:connect_signal("mouse::enter", function(c)
64 if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
65 and awful.client.focus.filter(c) then
66 client.focus = c
67 end
68 end)
69
70 if not startup then
71 -- Set the windows at the slave,
72 -- i.e. put it at the end of others instead of setting it master.
73 awful.client.setslave(c)
74
75 -- Put windows in a smart way, only if they does not set an initial position.
76 if not c.size_hints.user_position and not c.size_hints.program_position then
77 awful.placement.no_overlap(c)
78 awful.placement.no_offscreen(c)
79 end
80 end
81 end)
82
83 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
84 client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
85
86 -- Set keys
87 root.keys(globalkeys)