dots/.config/awesome/misc/setup.lua

66 lines
1.6 KiB
Lua

local naughty = require "naughty"
local beautiful = require "beautiful"
-- local notif_overlay = require "ui.notifs"
local wicked = require "ui.wicked"
local awful = require "awful"
local rubato = require "lib.rubato"
local vars = require "misc.vars"
-- naughty.connect_signal("request::display", function(n)
-- notif_overlay:notify(n)
-- end)
naughty.connect_signal("request::display", function(n)
naughty.layout.box {
notification = n,
placement = function(d)
return awful.placement.right(d, {
margins = beautiful.useless_gap * 2
})
end
}
-- wicked:.notify(n)
end)
naughty.connect_signal("request::display_error", function(message, startup)
naughty.notification {
urgency = "critical",
title = "Oops, an error happened"..(startup and " during startup!" or "!"),
message = message
}
end)
-- Taken from https://www.reddit.com/r/awesomewm/comments/syjolb/comment/hy0xy35/
awesome.connect_signal('exit', function(reason_restart)
if not reason_restart then return end
local file = io.open('/tmp/awesomewm-last-selected-tags', 'w+')
for s in screen do
file:write(s.selected_tag.index, '\n')
end
file:close()
end)
awesome.connect_signal('startup', function()
local file = io.open('/tmp/awesomewm-last-selected-tags', 'r')
if not file then return end
local selected_tags = {}
for line in file:lines() do
table.insert(selected_tags, tonumber(line))
end
for s in screen do
local i = selected_tags[s.index]
local t = s.tags[i]
t:view_only()
end
file:close()
end)