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