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