Default config: Remove tags table

Tags are accessible as s.tags on a screen object. Yup, that's harder to find
than a variable that is defined in the default config, but such is life.

Now that awful.rules supports specifying tags by name, I guess that the number
one reason for needing the tags table is gone.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-17 15:49:06 +02:00 committed by Uli Schlachter
parent 330aa49912
commit c6fafe06c0
3 changed files with 16 additions and 23 deletions

View File

@ -88,10 +88,6 @@ local function client_menu_toggle_fn()
end
-- }}}
-- Define a tag table which hold all screen tags.
-- This table is filled later
tags = {}
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
@ -176,7 +172,7 @@ awful.screen.connect_for_each_screen(function(s)
end
-- Each screen has its own tag table.
tags[s] = awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()

View File

@ -47,8 +47,8 @@ end
-- Test movetotag
local t = tags[mouse.screen][1]
local t2 = tags[mouse.screen][2]
local t = mouse.screen.tags[1]
local t2 = mouse.screen.tags[2]
c:tags{t}
assert(c:tags()[1] == t)

View File

@ -3,11 +3,8 @@
local awful = require("awful")
local runner = require("_runner")
-- This uses the global "tags" array set in the default config
-- luacheck: globals tags
-- Some basic assertion that the tag is not marked "urgent" already.
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == nil)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == nil)
-- Setup signal handler which should be called.
@ -32,7 +29,7 @@ local steps = {
if count == 1 then -- Setup.
urgent_cb_done = false
-- Select first tag.
tags[awful.screen.focused()][1]:view_only()
awful.screen.focused().tags[1]:view_only()
runner.add_to_default_rules({ rule = { class = "XTerm" },
properties = { tag = "2", focus = true } })
@ -40,8 +37,8 @@ local steps = {
awful.spawn("xterm")
end
if urgent_cb_done then
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == true)
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent_count") == 1)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == true)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 1)
return true
end
end,
@ -55,13 +52,13 @@ local steps = {
root.fake_input("key_release", "2")
root.fake_input("key_release", "Super_L")
elseif awful.screen.focused().selected_tags[1] == tags[awful.screen.focused()][2] then
elseif awful.screen.focused().selected_tags[1] == awful.screen.focused().tags[2] then
assert(#client.get() == 1)
local c = client.get()[1]
assert(not c.urgent, "Client is not urgent anymore.")
assert(c == client.focus, "Client is focused.")
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == false)
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent_count") == 0)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0)
return true
end
end,
@ -72,17 +69,17 @@ local steps = {
urgent_cb_done = false
-- Select first tag.
tags[awful.screen.focused()][1]:view_only()
awful.screen.focused().tags[1]:view_only()
runner.add_to_default_rules({ rule = { class = "XTerm" },
properties = { tag = "2", focus = true, switchtotag = true }})
awful.spawn("xterm")
elseif awful.screen.focused().selected_tags[1] == tags[awful.screen.focused()][2] then
elseif awful.screen.focused().selected_tags[1] == awful.screen.focused().tags[2] then
assert(not urgent_cb_done)
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == false)
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent_count") == 0)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0)
assert(awful.screen.focused().selected_tags[2] == nil)
return true
end
@ -103,8 +100,8 @@ local steps = {
end
if manage_cb_done then
assert(client.get()[1].urgent == false)
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == false)
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent_count") == 0)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0)
return true
end
end,