-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.yue
More file actions
329 lines (289 loc) · 7.24 KB
/
init.yue
File metadata and controls
329 lines (289 loc) · 7.24 KB
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
pcall(require, "luarocks.loader")
import "gears"
import "awful"
require "awful.autofocus"
import "wibox"
import "beautiful"
import "naughty"
import "ruled"
import "menubar"
import "awful.hotkeys_popup"
require "awful.hotkeys_popup.keys"
import "yue"
import "lgi"
import cairo, GLib, Gio from lgi
const Gtk = lgi.require("Gtk", "3.0")
const Gdk = lgi.require("Gdk", "3.0")
import awesome, client, screen from _G
import "modules"
import lookup_icon, scale from modules.lib.theme
naughty.connect_signal("request::display_error", (message, startup) ->
naughty.notification {
timeout: 0
urgency: "critical"
title: "<b>Oops, an error happened during " .. (if startup then "startup!" else "runtime!</b>")
message: yue.traceback(message, 1)
}
)
const autostart = {
if os.getenv("IS_XEPHYR") == "true"
{ "printf", "%s\\n", "Skipped running picom since you're using Xephyr" }
else
{ "picom", "--config", (gears.filesystem.get_configuration_dir() .. "config/picom/picom.conf") }
}
for app in *autostart
(stdout, stderr, reason, exit_code) <- awful.spawn.easy_async { "pgrep", "-f", "-U", os.getenv("USER"), app[1] }
if exit_code == 0
return
awful.spawn(app)
-- TODO: Offload this into a separate config.json file, which supports hot reload
const config = {
terminal: "konsole"
editor: "code-oss"
modkey: "Mod4"
theme: "dracula"
}
try
const theme = yue.dofile(gears.filesystem.get_configuration_dir() .. "themes/#{config.theme}/theme.yue")
beautiful.init(theme)
catch err
naughty.notification {
urgency: "critical"
title: "Could not load theme.yue"
message: tostring(err)
}
const edit_config = () ->
awful.spawn { config.editor, gears.filesystem.get_configuration_dir() }
menubar.utils.terminal = config.terminal
const main_menu = modules.core.menu(config)
const launcher_button = awful.widget.launcher {
image: beautiful.awesome_icon
menu: main_menu
}
tag.connect_signal("request::default_layouts", () ->
const s = awful.layout.suit
awful.layout.append_default_layouts {
s.tile
s.floating
--[[
s.floating
s.tile
s.tile.left
s.tile.bottom
s.tile.top
s.fair
s.fair.horizontal
s.spiral
s.spiral.dwindle
s.max
s.max.fullscreen
s.magnifier
s.corner.nw
--]]
}
)
screen.connect_signal("request::wallpaper", (s) ->
awful.wallpaper {
screen: s,
widget: {
{
{
image: beautiful.wallpaper
upscale: true
downscale: true
widget: wibox.widget.imagebox
}
valign: "center"
halign: "center"
tiled: false
widget: wibox.container.tile
}
bg: beautiful.bg_normal
widget: wibox.container.background
}
}
)
const keyboard_layout = awful.widget.keyboardlayout()
const clock = wibox.widget.textclock()
screen.connect_signal("request::desktop_decoration", (s) ->
awful.tag([ tostring(i) for i = 1, 9 ], s, awful.layout.layouts[1])
s.prompt_box = awful.widget.prompt()
s.layoutbox = awful.widget.layoutbox {
screen: s
buttons: {
awful.button({}, 1, (() -> awful.layout.inc( 1)))
awful.button({}, 3, (() -> awful.layout.inc(-1)))
awful.button({}, 4, (() -> awful.layout.inc(-1)))
awful.button({}, 5, (() -> awful.layout.inc( 1)))
}
}
s.taglist = awful.widget.taglist {
screen: s
filter: awful.widget.taglist.filter.all
widget_template: {
{
{
{
id: "text_role"
widget: wibox.widget.textbox
}
layout: wibox.layout.fixed.horizontal
}
left: scale(12)
right: scale(12)
widget: wibox.container.margin
}
id: "background_role"
widget: wibox.container.background
}
buttons: {
awful.button({}, 1, ((t) -> t::view_only()))
awful.button({ config.modkey }, 1, ((t) -> if c = client.focus then c::move_to_tag(t)))
awful.button({}, 3, (() -> awful.tag.viewtoggle()))
awful.button({ config.modkey }, 3, ((t) -> if c = client.focus then c::toggle_tag(t)))
awful.button({}, 4, ((t) -> awful.tag.viewprev(t.screen)))
awful.button({}, 5, ((t) -> awful.tag.viewnext(t.screen)))
}
}
s.tasklist = awful.widget.tasklist {
screen: s,
filter: awful.widget.tasklist.filter.currenttags,
buttons: {
awful.button({}, 1, ((c) -> c::activate { context: "tasklist", action: "toggle_minimization" })),
awful.button({}, 3, (() -> awful.menu.client_list { theme: { width: 250 } })),
awful.button({}, 4, (() -> awful.client.focus.byidx(-1))),
awful.button({}, 5, (() -> awful.client.focus.byidx( 1))),
}
}
s.panel = awful.wibar {
position: "top",
screen: s,
widget: {
{
launcher_button
s.taglist
s.prompt_box
layout: wibox.layout.fixed.horizontal
}
{
widget: s.tasklist
}
{
keyboard_layout
wibox.widget.systray()
clock
s.layoutbox
layout: wibox.layout.fixed.horizontal
}
layout: wibox.layout.align.horizontal
}
}
)
modules.core.input_bindings(config, main_menu)
ruled.client.connect_signal("request::rules", () ->
ruled.client.append_rule {
id: "global"
rule: {}
properties: {
focus: awful.client.focus.filter
raise: true
screen: awful.screen.preferred
placement: awful.placement.no_overlap + awful.placement.no_offscreen
}
}
ruled.client.append_rule {
id: "floating"
rule_any: {
instance: {
"copyq"
"pinentry"
}
class: {
"Arandr"
"Blueman-manager"
"Gpick"
"Kruler"
"Sxiv"
"Tor Browser"
"Wpa_gui"
"veromix"
"xtightvncviewer"
}
name: {
"Event Tester" -- xev.
}
role: {
"AlarmWindow" -- Thunderbird's calendar.
"ConfigManager" -- Thunderbird's about:config.
"pop-up" -- e.g. Google Chrome's (detached) Developer Tools.
}
},
properties: {
floating: true
}
}
ruled.client.append_rule {
id: "titlebars"
rule_any: {
type: {
"normal"
"dialog"
}
}
properties: {
titlebars_enabled: true
}
}
)
client.connect_signal("request::titlebars", (c) ->
if c.requests_no_titlebar
return
-- buttons for the titlebar
const buttons = {
awful.button({}, 1, () -> c::activate { context: "titlebar", action: "mouse_move" })
awful.button({}, 3, () -> c::activate { context: "titlebar", action: "mouse_resize" })
}
const top = awful.titlebar(c, position: "top")
top.widget = {
{
{
widget: awful.titlebar.widget.iconwidget(c)
buttons: buttons
}
awful.titlebar.widget.floatingbutton(c)
awful.titlebar.widget.stickybutton(c)
awful.titlebar.widget.ontopbutton(c)
layout: wibox.layout.fixed.horizontal
}
{
{
halign: "center",
widget: awful.titlebar.widget.titlewidget(c)
}
buttons: buttons,
layout: wibox.layout.flex.horizontal
}
{
awful.titlebar.widget.minimizebutton(c)
awful.titlebar.widget.maximizedbutton(c)
awful.titlebar.widget.closebutton(c)
layout: wibox.layout.fixed.horizontal()
}
layout: wibox.layout.align.horizontal
}
)
ruled.notification.connect_signal("request::rules", () ->
ruled.notification.append_rule {
rule: {}
properties: {
screen: awful.screen.preferred
implicit_timeout: 5
}
}
)
naughty.connect_signal("request::display", (n) ->
naughty.layout.box { notification: n }
)
client.connect_signal("mouse::enter", (c) ->
c::activate { context: "mouse_enter", raise: false }
)