-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrc.lua
230 lines (210 loc) · 7.59 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
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
local wibox = require("wibox")
local naughty = require("naughty")
local menubar = require("menubar")
local beautiful = require("beautiful")
local freedesktop = require("freedesktop")
require("wibar")
require("errorhandling")
require("vars")
-- {{{ Variable definitions
beautiful.bg_normal = "#282a36"
beautiful.bg_focus = "#282a36"
beautiful.font = "Noto Sans Regular 10"
beautiful.notification_font = "Noto Sans Bold 14"
beautiful.useless_gap_width = 10
beautiful.notification_icon_size = 100
beautiful.notification_opacity = 10
beautiful.notification_shape = gears.shape.rounded_rect
beautiful.notification_bg = "#282a36"
beautiful.notification_font = "Source Code Pro 9"
awful.layout.layouts = {awful.layout.suit.floating, awful.layout.suit.tile}
myawesomemenu = {
{
"manual", terminal .. " -e man awesome",
menubar.utils.lookup_icon("system-help")
}, {
"edit config", gui_editor .. " " .. awesome.conffile,
menubar.utils.lookup_icon("accessories-text-editor")
}, {"restart", awesome.restart, menubar.utils.lookup_icon("system-restart")}
}
myexitmenu = {
{
"log out", function() awesome.quit() end,
menubar.utils.lookup_icon("system-log-out")
},
{
"suspend", "systemctl suspend",
menubar.utils.lookup_icon("system-suspend")
}, {
"hibernate", "systemctl hibernate",
menubar.utils.lookup_icon("system-suspend-hibernate")
},
{"reboot", "systemctl reboot", menubar.utils.lookup_icon("system-reboot")},
{"shutdown", "poweroff", menubar.utils.lookup_icon("system-shutdown")}
}
mymainmenu = freedesktop.menu.build({
icon_size = 32,
after = {
{"Awesome", myawesomemenu, "/usr/share/awesome/icons/awesome32.png"},
{"Exit", myexitmenu, menubar.utils.lookup_icon("system-shutdown")}
}
})
mylauncher = awful.widget.launcher({
image = beautiful.awesome_icon,
menu = mymainmenu
})
root.buttons(gears.table.join(awful.button({}, 1,
function() mymainmenu:hide() end),
awful.button({}, 3,
function() mymainmenu:toggle() end),
awful.button({}, 4, awful.tag.viewnext),
awful.button({}, 5, awful.tag.viewprev)))
-- {{{ Helper functions
local function client_menu_toggle_fn()
local instance = nil
return function()
if instance and instance.wibox.visible then
instance:hide()
instance = nil
else
instance = awful.menu.clients({theme = {width = 250}})
end
end
end
-- }}}
local globalkeys, clientkeys, clientbuttons = require("keybinds")()
root.keys(globalkeys)
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{
rule = {},
properties = {
border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
size_hints_honor = false, -- Remove gaps between terminals
screen = awful.screen.preferred,
callback = awful.client.setslave,
placement = awful.placement.no_overlap +
awful.placement.no_offscreen
}
}, -- Floating clients.
{
rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq" -- Includes session name in class.
},
class = {
"Arandr", "Gpick", "Kruler", "MessageWin", -- kalarm.
"Sxiv", "Wpa_gui", "pinentry", "veromix", "xtightvncviewer"
},
name = {
"Event Tester" -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"pop-up" -- e.g. Google Chrome's (detached) Developer Tools.
}
},
properties = {floating = true}
}, -- Add titlebars to normal clients and dialogs
{
rule_any = {type = {"normal", "dialog"}},
properties = {titlebars_enabled = false}
}
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function(c)
c.shape = function(cr, w, h) gears.shape.rounded_rect(cr, w, h, 8) end
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)
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar
local buttons = gears.table.join(awful.button({}, 1, function()
client.focus = c
c:raise()
awful.mouse.client.move(c)
end), awful.button({}, 3, function()
client.focus = c
c:raise()
awful.mouse.client.resize(c)
end))
awful.titlebar(c):setup{
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton(c),
awful.titlebar.widget.stickybutton(c),
-- awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.closebutton(c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier and
awful.client.focus.filter(c) then client.focus = c end
end)
client.connect_signal("focus",
function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus",
function(c) c.border_color = beautiful.border_normal end)
-- Disable borders on lone windows
-- Handle border sizes of clients.
for s = 1, screen.count() do
screen[s]:connect_signal("arrange", function()
local clients = awful.client.visible(s)
local layout = awful.layout.getname(awful.layout.get(s))
for _, c in pairs(clients) do
-- No borders with only one humanly visible client
if c.maximized then
-- NOTE: also handled in focus, but that does not cover maximizing from a
-- tiled state (when the client had focus).
c.border_width = 0
elseif c.floating or layout == "floating" then
c.border_width = beautiful.border_width
elseif layout == "max" or layout == "fullscreen" then
c.border_width = 0
else
local tiled = awful.client.tiled(c.screen)
if #tiled == 1 then -- and c == tiled[1] then
tiled[1].border_width = 0
else
c.border_width = beautiful.border_width
end
end
end
end)
end
-- }}}
awful.spawn.with_shell("~/.config/awesome/autorun.sh")