From c6fafe06c023452c822d69a4428f3d5c4007c89f Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 17 Apr 2016 15:49:06 +0200 Subject: [PATCH] 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 --- awesomerc.lua | 6 +----- tests/test-awful-client.lua | 4 ++-- tests/test-urgent.lua | 29 +++++++++++++---------------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/awesomerc.lua b/awesomerc.lua index f391d078..41d8fcb3 100755 --- a/awesomerc.lua +++ b/awesomerc.lua @@ -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() diff --git a/tests/test-awful-client.lua b/tests/test-awful-client.lua index b1897d44..ea72f031 100644 --- a/tests/test-awful-client.lua +++ b/tests/test-awful-client.lua @@ -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) diff --git a/tests/test-urgent.lua b/tests/test-urgent.lua index d763dda9..089eb9b2 100644 --- a/tests/test-urgent.lua +++ b/tests/test-urgent.lua @@ -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,