-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrc.lua
129 lines (101 loc) · 4.54 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
-- █████╗ ██╗ ██╗███████╗███████╗ ██████╗ ███╗ ███╗███████╗
-- ██╔══██╗██║ ██║██╔════╝██╔════╝██╔═══██╗████╗ ████║██╔════╝
-- ███████║██║ █╗ ██║█████╗ ███████╗██║ ██║██╔████╔██║█████╗
-- ██╔══██║██║███╗██║██╔══╝ ╚════██║██║ ██║██║╚██╔╝██║██╔══╝
-- ██║ ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗
-- ╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
-- ===================================================================
-- Initialization
-- ===================================================================
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
-- Import theme
local xresources = require("beautiful.xresources")
local beautiful = require("beautiful")
local dpi = xresources.apply_dpi
beautiful.init(gears.filesystem.get_configuration_dir() .. "theme.lua")
-- Import Keybinds
local keys = require("keys")
root.keys(keys.globalkeys)
root.buttons(keys.desktopbuttons)
-- Import rules
local create_rules = require("rules").create
awful.rules.rules = create_rules(keys.clientkeys, keys.clientbuttons)
-- Notification library
require("components.notifications")
-- Import Tag Settings
local tags = require("tags")
-- Import components
require("components.wallpaper")
require("components.exit-screen")
require("components.volume-adjust")
-- Autostart specified apps
local apps = require("apps")
apps.autostart()
-- ===================================================================
-- Set Up Screen & Connect Signals
-- ===================================================================
-- Define tag layouts
awful.layout.layouts = {
awful.layout.suit.tile,
awful.layout.suit.floating,
awful.layout.suit.max,
}
-- Set up each screen
local top_panel = require("components.top-panel")
awful.screen.connect_for_each_screen(function (s)
for i, tag in pairs(tags) do
awful.tag.add(i, {
icon = tag.icon,
icon_only = true,
layout = awful.layout.suit.tile,
screen = s,
selected = i == 1
})
end
-- Add the top panel to the screen
top_panel.create(s)
--decrease useless gap size near the borders of the screen
s.padding = {
left = dpi(-3),
right = dpi(-3),
top = dpi(-9),
bottom = dpi(-3)
}
end)
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the window as a slave (put it at the end of others instead of setting it as master)
if not awesome.startup then
awful.client.setslave(c)
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)
-- Autofocus a new client when previously focused one is closed
require("awful.autofocus")
-- Focus clients under mouse
-- client.connect_signal("mouse::enter", function(c)
-- c:emit_signal("request::activate", "mouse_enter", {raise = false})
-- end)
--Remove borders when window is maximized
screen.connect_signal("arrange", function (s)
local max = s.selected_tag.layout.name == "max"
local only_one = #s.tiled_clients == 1 -- use tiled_clients so that other floating windows don't affect the count
-- but iterate over clients instead of tiled_clients as tiled_clients doesn't include maximized windows
for _, c in pairs(s.clients) do
if (max or only_one) and not c.floating or c.maximized then
c.border_width = 0
else
c.border_width = beautiful.border_width
end
end
end)
-- ===================================================================
-- Garbage collection (allows for lower memory consumption)
-- ===================================================================
collectgarbage("setpause", 110)
collectgarbage("setstepmul", 1000)