diff --git a/lib/awful/ewmh.lua b/lib/awful/ewmh.lua index db6f9e12..139e8e1a 100644 --- a/lib/awful/ewmh.lua +++ b/lib/awful/ewmh.lua @@ -134,7 +134,7 @@ function ewmh.activate(c, context, hints) -- luacheck: no unused args end -- The rules use `switchtotag`. For consistency and code re-use, support it, - -- but keep undocumented. + -- but keep undocumented. --TODO v5 remove switchtotag if hints.switchtotag or hints.switch_to_tag or hints.switch_to_tags then atag.viewmore(c:tags(), c.screen, (not hints.switch_to_tags) and 0 or nil) end diff --git a/lib/awful/rules.lua b/lib/awful/rules.lua index ae09a291..39fd724f 100644 --- a/lib/awful/rules.lua +++ b/lib/awful/rules.lua @@ -15,7 +15,7 @@ -- * honor_workarea -- * tag -- * new_tag --- * switchtotag +-- * switch_to_tags (also called switchtotag) -- * focus -- * titlebars_enabled -- * callback @@ -83,7 +83,7 @@ If you want to put Emacs on a specific tag at startup, and immediately switch to that tag you can add: { rule = { class = "Emacs" }, - properties = { tag = mytagobject, switchtotag = true } } + properties = { tag = mytagobject, switch_to_tags = true } } If you want to apply a custom callback to execute when a rule matched, for example to pause playing music from mpd when you start dosbox, you @@ -477,7 +477,7 @@ rules.high_priority_properties = {} -- @tfield table awful.rules.delayed_properties -- By default, the table has the following functions: -- --- * switchtotag +-- * switch_to_tags rules.delayed_properties = {} local force_ignore = { @@ -511,11 +511,17 @@ function rules.high_priority_properties.tag(c, value, props) end end -function rules.delayed_properties.switchtotag(c, value) +function rules.delayed_properties.switch_to_tags(c, value) if not value then return end atag.viewmore(c:tags(), c.screen) end +function rules.delayed_properties.switchtotag(c, value) + gdebug.deprecate("Use switch_to_tags instead of switchtotag", {deprecated_in=5}) + + rules.delayed_properties.switch_to_tags(c, value) +end + function rules.extra_properties.geometry(c, _, props) local cur_geo = c:geometry() diff --git a/tests/test-awful-rules.lua b/tests/test-awful-rules.lua index d99fccdb..db89234d 100644 --- a/tests/test-awful-rules.lua +++ b/tests/test-awful-rules.lua @@ -292,11 +292,11 @@ assert(not awful.rules.add_rule_source("invalid_source", function() end, {"awful.rules"}, {"awful.spawn"})) gears.debug.print_warning = temp --- Test tag and switchtotag +-- Test tag and switch_to_tags test_rule { properties = { - tag = "9", - switchtotag = true + tag = "9", + switch_to_tags = true }, test = function(class) local c = get_client_by_class(class) @@ -311,8 +311,8 @@ test_rule { } test_rule { properties = { - tag = "8", - switchtotag = false + tag = "8", + switch_to_tags = false }, test = function(class) local c = get_client_by_class(class) diff --git a/tests/test-urgent.lua b/tests/test-urgent.lua index c1908730..f0558097 100644 --- a/tests/test-urgent.lua +++ b/tests/test-urgent.lua @@ -72,7 +72,7 @@ local steps = { awful.screen.focused().tags[1]:view_only() runner.add_to_default_rules({ rule = { class = "XTerm" }, - properties = { tag = "2", focus = true, switchtotag = true }}) + properties = { tag = "2", focus = true, switch_to_tags = true }}) awful.spawn("xterm")