awful.rules: Rename switchtotag to switch_to_tags.

First of all, it select many tags, so there is an "s". Also, Awesome
standardised naming to snake case in v4.0, but this was missed.
This commit is contained in:
Emmanuel Lepage Vallee 2018-10-01 16:18:08 -04:00
parent 927e7b2796
commit 0ac99a5dc5
4 changed files with 17 additions and 11 deletions

View File

@ -134,7 +134,7 @@ function ewmh.activate(c, context, hints) -- luacheck: no unused args
end end
-- The rules use `switchtotag`. For consistency and code re-use, support it, -- 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 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) atag.viewmore(c:tags(), c.screen, (not hints.switch_to_tags) and 0 or nil)
end end

View File

@ -15,7 +15,7 @@
-- * honor_workarea -- * honor_workarea
-- * tag -- * tag
-- * new_tag -- * new_tag
-- * switchtotag -- * switch_to_tags (also called switchtotag)
-- * focus -- * focus
-- * titlebars_enabled -- * titlebars_enabled
-- * callback -- * 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: to that tag you can add:
{ rule = { class = "Emacs" }, { 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, 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 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 -- @tfield table awful.rules.delayed_properties
-- By default, the table has the following functions: -- By default, the table has the following functions:
-- --
-- * switchtotag -- * switch_to_tags
rules.delayed_properties = {} rules.delayed_properties = {}
local force_ignore = { local force_ignore = {
@ -511,11 +511,17 @@ function rules.high_priority_properties.tag(c, value, props)
end end
end end
function rules.delayed_properties.switchtotag(c, value) function rules.delayed_properties.switch_to_tags(c, value)
if not value then return end if not value then return end
atag.viewmore(c:tags(), c.screen) atag.viewmore(c:tags(), c.screen)
end 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) function rules.extra_properties.geometry(c, _, props)
local cur_geo = c:geometry() local cur_geo = c:geometry()

View File

@ -292,11 +292,11 @@ assert(not awful.rules.add_rule_source("invalid_source", function()
end, {"awful.rules"}, {"awful.spawn"})) end, {"awful.rules"}, {"awful.spawn"}))
gears.debug.print_warning = temp gears.debug.print_warning = temp
-- Test tag and switchtotag -- Test tag and switch_to_tags
test_rule { test_rule {
properties = { properties = {
tag = "9", tag = "9",
switchtotag = true switch_to_tags = true
}, },
test = function(class) test = function(class)
local c = get_client_by_class(class) local c = get_client_by_class(class)
@ -311,8 +311,8 @@ test_rule {
} }
test_rule { test_rule {
properties = { properties = {
tag = "8", tag = "8",
switchtotag = false switch_to_tags = false
}, },
test = function(class) test = function(class)
local c = get_client_by_class(class) local c = get_client_by_class(class)

View File

@ -72,7 +72,7 @@ local steps = {
awful.screen.focused().tags[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, switch_to_tags = true }})
awful.spawn("xterm") awful.spawn("xterm")