From 8595530cd89a9c76d7fbd98b563fe1d93283df53 Mon Sep 17 00:00:00 2001 From: Xinhao Yuan Date: Sat, 13 Jul 2019 19:01:55 -0400 Subject: [PATCH] minor enhancement --- README.md | 2 +- init.lua | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb37995..bd90355 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/init.lua b/init.lua index e24a493..0f8b38b 100644 --- a/init.lua +++ b/init.lua @@ -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")