Added keys with the same name as the tag name.
Makes it easier to move tag numbers around without having to change the rules.
This commit is contained in:
parent
57b0bab65c
commit
725137c62c
|
@ -106,7 +106,9 @@
|
|||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="http://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||
A list of all created tags.
|
||||
A list of all created tags. Tags are assigned numeric values
|
||||
corresponding to the input list, and all tags with non-numerical names are
|
||||
also assigned to a key with the same name.
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -119,7 +121,8 @@
|
|||
<span class="comment">-- "www" is the second tag on screen 1 with the floating layout.
|
||||
</span> { name = <span class="string">"www"</span> },
|
||||
<span class="comment">-- Third tag is named "3" on screen 1 with the floating layout.
|
||||
</span> {})</pre>
|
||||
</span> {})
|
||||
-- tags[<span class="number">2</span>] <span class="keyword">and</span> tags[<span class="string">"www"</span>] both refer to the same tag.</pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
|
@ -213,7 +216,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2016-01-03 19:41:48 </i>
|
||||
<i style="float:right;">Last updated 2016-01-09 21:09:20 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
11
init.lua
11
init.lua
|
@ -49,7 +49,9 @@ local sharedtags = {
|
|||
-- defaults to the first layout. The `screen` value sets the starting screen
|
||||
-- for the tag and defaults to the first screen. The tags will be sorted in this
|
||||
-- order in the default taglist.
|
||||
-- @treturn table A list of all created tags.
|
||||
-- @treturn table A list of all created tags. Tags are assigned numeric values
|
||||
-- corresponding to the input list, and all tags with non-numerical names are
|
||||
-- also assigned to a key with the same name.
|
||||
-- @usage local tags = sharedtags(
|
||||
-- -- "main" is the first tag starting on screen 2 with the tile layout.
|
||||
-- { name = "main", layout = awful.layout.suit.tile, screen = 2 },
|
||||
|
@ -57,6 +59,7 @@ local sharedtags = {
|
|||
-- { name = "www" },
|
||||
-- -- Third tag is named "3" on screen 1 with the floating layout.
|
||||
-- {})
|
||||
-- -- tags[2] and tags["www"] both refer to the same tag.
|
||||
function sharedtags.new(def)
|
||||
local tags = {}
|
||||
|
||||
|
@ -67,6 +70,11 @@ function sharedtags.new(def)
|
|||
sharedtagindex = i
|
||||
})
|
||||
|
||||
-- Create an alias between the index and the name.
|
||||
if t.name and type(t.name) ~= "number" then
|
||||
tags[t.name] = tags[i]
|
||||
end
|
||||
|
||||
-- If no tag is selected for this screen, then select this one.
|
||||
if not awful.tag.selected(awful.tag.getscreen(tags[i])) then
|
||||
awful.tag.viewonly(tags[i]) -- Updates the history as well.
|
||||
|
@ -108,7 +116,6 @@ function sharedtags.movetag(tag, screen)
|
|||
local newtag = awful.tag.find_fallback(oldscreen)
|
||||
if newtag then
|
||||
awful.tag.viewonly(newtag)
|
||||
else
|
||||
end
|
||||
end
|
||||
else
|
||||
|
|
|
@ -90,7 +90,7 @@ https://github.com/Drauthius/awesome-sharedtags
|
|||
+ -- Set Firefox to always map on tag number 2.
|
||||
-- { rule = { class = "Firefox" },
|
||||
- -- properties = { tag = tags[1][2] } },
|
||||
+ -- properties = { tag = tags[2] } },
|
||||
+ -- properties = { tag = tags[2] } }, -- tag = tags["www"] works as well
|
||||
}
|
||||
-- }}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue