return to active tag on restart

This commit is contained in:
Adam 2024-01-03 00:53:26 -05:00
parent 509a3c54f0
commit 36b86a40f8

View file

@ -93,3 +93,44 @@ client.connect_signal(
c.border_color = Beautiful.border_normal
end
)
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
)