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:
parent
330aa49912
commit
c6fafe06c0
|
@ -88,10 +88,6 @@ local function client_menu_toggle_fn()
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Define a tag table which hold all screen tags.
|
|
||||||
-- This table is filled later
|
|
||||||
tags = {}
|
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
-- Create a launcher widget and a main menu
|
-- Create a launcher widget and a main menu
|
||||||
myawesomemenu = {
|
myawesomemenu = {
|
||||||
|
@ -176,7 +172,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Each screen has its own tag table.
|
-- 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
|
-- Create a promptbox for each screen
|
||||||
mypromptbox[s] = awful.widget.prompt()
|
mypromptbox[s] = awful.widget.prompt()
|
||||||
|
|
|
@ -47,8 +47,8 @@ end
|
||||||
|
|
||||||
-- Test movetotag
|
-- Test movetotag
|
||||||
|
|
||||||
local t = tags[mouse.screen][1]
|
local t = mouse.screen.tags[1]
|
||||||
local t2 = tags[mouse.screen][2]
|
local t2 = mouse.screen.tags[2]
|
||||||
|
|
||||||
c:tags{t}
|
c:tags{t}
|
||||||
assert(c:tags()[1] == t)
|
assert(c:tags()[1] == t)
|
||||||
|
|
|
@ -3,11 +3,8 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local runner = require("_runner")
|
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.
|
-- 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.
|
-- Setup signal handler which should be called.
|
||||||
|
@ -32,7 +29,7 @@ local steps = {
|
||||||
if count == 1 then -- Setup.
|
if count == 1 then -- Setup.
|
||||||
urgent_cb_done = false
|
urgent_cb_done = false
|
||||||
-- Select first tag.
|
-- 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" },
|
runner.add_to_default_rules({ rule = { class = "XTerm" },
|
||||||
properties = { tag = "2", focus = true } })
|
properties = { tag = "2", focus = true } })
|
||||||
|
@ -40,8 +37,8 @@ local steps = {
|
||||||
awful.spawn("xterm")
|
awful.spawn("xterm")
|
||||||
end
|
end
|
||||||
if urgent_cb_done then
|
if urgent_cb_done then
|
||||||
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == true)
|
assert(awful.tag.getproperty(awful.screen.focused().tags[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_count") == 1)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -55,13 +52,13 @@ local steps = {
|
||||||
root.fake_input("key_release", "2")
|
root.fake_input("key_release", "2")
|
||||||
root.fake_input("key_release", "Super_L")
|
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)
|
assert(#client.get() == 1)
|
||||||
local c = client.get()[1]
|
local c = client.get()[1]
|
||||||
assert(not c.urgent, "Client is not urgent anymore.")
|
assert(not c.urgent, "Client is not urgent anymore.")
|
||||||
assert(c == client.focus, "Client is focused.")
|
assert(c == client.focus, "Client is focused.")
|
||||||
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == false)
|
assert(awful.tag.getproperty(awful.screen.focused().tags[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_count") == 0)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -72,17 +69,17 @@ local steps = {
|
||||||
urgent_cb_done = false
|
urgent_cb_done = false
|
||||||
|
|
||||||
-- Select first tag.
|
-- 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" },
|
runner.add_to_default_rules({ rule = { class = "XTerm" },
|
||||||
properties = { tag = "2", focus = true, switchtotag = true }})
|
properties = { tag = "2", focus = true, switchtotag = true }})
|
||||||
|
|
||||||
awful.spawn("xterm")
|
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(not urgent_cb_done)
|
||||||
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == false)
|
assert(awful.tag.getproperty(awful.screen.focused().tags[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_count") == 0)
|
||||||
assert(awful.screen.focused().selected_tags[2] == nil)
|
assert(awful.screen.focused().selected_tags[2] == nil)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -103,8 +100,8 @@ local steps = {
|
||||||
end
|
end
|
||||||
if manage_cb_done then
|
if manage_cb_done then
|
||||||
assert(client.get()[1].urgent == false)
|
assert(client.get()[1].urgent == false)
|
||||||
assert(awful.tag.getproperty(tags[awful.screen.focused()][2], "urgent") == false)
|
assert(awful.tag.getproperty(awful.screen.focused().tags[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_count") == 0)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue