1-- awesome_mode: api-level=4:screen=on
2-- If LuaRocks is installed, make sure that packages installed through it are
3-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
4pcall(require, "luarocks.loader")
5
6--- Error handling.
7-- Notification library.
8local naughty = require("naughty")
9
10local function log_memory(label)
11 local mem = collectgarbage("count") -- KB
12 naughty.notification({
13 title = "AWM Memory",
14 text = string.format("%s: %.1f MB", label, mem / 1024),
15 timeout = 3,
16 })
17 print(string.format("[MEM] %s: %.1f MB", label, mem / 1024))
18end
19
20-- Check if awesome encountered an error during startup and fell back to
21-- another config (This code will only ever execute for the fallback config).
22naughty.connect_signal("request::display_error", function(message, startup)
23 naughty.notification({
24 urgency = "critical",
25 title = "Oops, an error happened" .. (startup and " during startup!" or "!"),
26 message = message,
27 })
28end)
29
30-- Allow Awesome to automatically focus a client upon changing tags or loading.
31require("awful.autofocus")
32-- Enable hotkeys help widget for VIM and other apps when client with a matching
33-- name is opened:
34require("awful.hotkeys_popup.keys")
35require("module.better-resize")
36-- Load the theme. In other words, defines the variables within the `beautiful`
37-- table.
38require("theme")
39
40-- Treat all signals. Bear in mind this implies creating all tags, attaching
41-- their layouts, setting client behavior and loading UI.
42require("ui.lock")
43require("signal")
44
45-- Set all keybinds.
46require("binds")
47
48-- Load all client rules.
49require("config.rules")
50
51require("awful").screen
52 .focused().tags[tonumber(require("module.helpers").tag.read_last()) and tonumber(require("module.helpers").tag.read_last()) or 1]
53 :view_only()
54
55local awful = require("awful")
56local wibox = require("wibox")
57local gears = require("gears")
58
59local w
60
61local button = awful.widget.button()
62button:buttons(gears.table.join(
63 button:buttons(),
64 awful.button({}, 1, nil, function()
65 awful.mouse.wibox.move(w)
66 end)
67))
68
69local tbl = {
70 x = mouse.coords().x,
71 y = mouse.coords().y,
72}
73
74local help = require("module.helpers")
75
76local ww = help.menu.create({ radius = 100 })
77local test_widget = wibox.widget({
78 widget = wibox.widget.textbox,
79 text = "Hello!",
80})
81ww:add_widget(test_widget)
82ww:add_widget(test_widget)
83ww:add_widget(test_widget)
84ww:add_widget(test_widget)
85
86w = awful.popup({
87 widget = {
88 {
89 widget = wibox.container.background,
90 bg = "#ffffff",
91 forced_height = 100,
92 forced_width = 45,
93 buttons = {
94 awful.button({}, 1, function()
95 awful.mouse.wibox.move(w)
96 end),
97 awful.button({}, 3, function()
98 local c = mouse.coords()
99 ww:toggle(c.x, c.y)
100 end),
101 },
102 },
103 layout = wibox.layout.fixed.vertical,
104 },
105 shape = gears.shape.rounded_rect,
106 visible = true,
107 x = 250,
108 y = 100,
109})
110
111require("gears").timer({
112 timeout = 5,
113 autostart = true,
114 call_now = true,
115 callback = function()
116 collectgarbage("collect")
117 end,
118})