-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc.lua
233 lines (191 loc) · 6.6 KB
/
rc.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
awful = require("awful")
gears = require("gears")
wibox = require("wibox")
beautiful = require("beautiful")
naughty = require("naughty")
menubar = require("menubar")
require("awful.autofocus")
-- {{{ 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
-- 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
-- Themes define colours, icons, font and wallpapers.
config = awful.util.getdir("config")
cache = awful.util.getdir("cache")
beautiful.init(config .. "/themes/custom/theme.lua")
Win = "Mod4"
Alt = "Mod1"
Ctr = "Control"
Shi = "Shift"
-- This is used later as the default terminal and editor to run.
terminal = "uterm"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Custom libs
require("helpers")
mainmenu = require "menu"
clock = require "clock"
volume = require "volume"
music = require "music"
dropdown = require "dropdown"
clipboard = require "clipboard"
conky = require "conky"
battery = require "battery"
wifi = require "wifi"
system = require "system"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier
}
naughty.config.presets.normal.font = "Monospace 8"
naughty.config.presets.normal.border_color = beautiful.fg_focus
--naughty.config.presets.normal.screen = 1
naughty.config.presets.normal.position = "top_right"
--naughty.config.presets.low.screen = 1
--naughty.config.presets.critical.screen = 1
blank1 = wibox.widget.textbox(" ")
blank2 = wibox.widget.textbox(" ")
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- Main panel configuration
local layout_buttons = gears.table.join(
awful.button({ }, 1, function () mainmenu:toggle() end),
awful.button({ }, 2, function () awful.layout.set(awful.layout.suit.floating) end),
awful.button({ }, 3, function () awful.layout.set(awful.layout.suit.tile) end),
awful.button({ }, 4, function () awful.layout.inc(1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end))
local taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ Win }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ Win }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end))
local tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c) -- focus window
-- Without this, the following
-- :isvisible() makes no sense
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
-- This will also un-minimize
-- the client, if needed
client.focus = c
c:raise()
end),
awful.button({ }, 2, function (c) c:kill() end),
awful.button({ }, 3, function (c) c.minimized = not c.minimized end),
awful.button({ }, 4, function () -- change focused client
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function () -- change focused client
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
local systray = wibox.widget.systray(true)
NUM_TAGS = 6
awful.screen.connect_for_each_screen(function(s)
awful.tag({ "1", "2", "3", "4", "5", "6" }, s, awful.layout.layouts[2])
s.promptbox = awful.widget.prompt()
s.layoutbox = awful.widget.layoutbox(s)
s.layoutbox:buttons(layout_buttons)
s.taglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
s.tasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
if s.index == 1 then
right_layout:add(systray)
end
right_layout:add(blank2)
if battery.present() then
right_layout:add(wifi.widget)
right_layout:add(blank2)
right_layout:add(battery.widget)
right_layout:add(blank2)
right_layout:add(system.widget)
right_layout:add(blank2)
end
right_layout:add(volume.widget)
right_layout:add(blank2)
if music.present() then
right_layout:add(music.widget)
right_layout:add(blank2)
end
right_layout:add(clock.widget)
right_layout:add(conky.widget)
-- Now bring it all together (with the tasklist in the middle)
s.main_panel = awful.wibar({ position = "top", screen = s})
s.main_panel:setup {
layout = wibox.layout.align.horizontal,
{
layout = wibox.layout.fixed.horizontal,
s.layoutbox,
blank1,
s.taglist,
s.promptbox,
},
s.tasklist,
right_layout,
}
end)
require("binds")
require("rules")
client.connect_signal("manage", function (c)
if awesome.startup and
not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
end)
client.connect_signal("focus",
function(c)
if c.type ~= "desktop" then
c.border_color = beautiful.border_focus
end
end)
client.connect_signal("unfocus",
function(c)
if c.type ~= "desktop" then
c.border_color = beautiful.border_normal
end
end)
-- vim:ts=4:sw=4