minor enhancement

This commit is contained in:
Xinhao Yuan 2019-07-13 19:01:55 -04:00
parent 6ea5f035ed
commit 8595530cd8
2 changed files with 7 additions and 2 deletions

View File

@ -36,7 +36,7 @@ This is used for having different actual layout dependent on tags.
`machi.default_editor` can be used, or see below on creating editors.
You can create multiple layouts with different names and share the same editor.
The default layout, `machi.default_layout`, uses `"default+" .. tag.name` as name, thus allows the actual layout to be tag-name-dependent.
The default layout, `machi.default_layout`, uses the screen geometry and the tag name for name, thus allows the actual layout to be tag- and screen-dependent.
To differentiate tags with the same name, you may need a more advanced naming function.
## Editor

View File

@ -4,7 +4,12 @@ local switcher = require(... .. ".switcher")
local default_editor = editor.create()
local default_layout = layout.create(
function (tag)
return "default+" .. tag.name
if tag.machi_name_cache == nil then
tag.machi_name_cache =
tostring(tag.screen.geometry.width) .. "x" .. tostring(tag.screen.geometry.height) .. "+" ..
tostring(tag.screen.geometry.x) .. "+" .. tostring(tag.screen.geometry.y) .. '+' .. tag.name
end
return tag.machi_name_cache
end,
default_editor)
local gcolor = require("gears.color")