Fix code using awful.util.cycle
This gets rid of lots of deprecation warnings. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
6f803cf3b3
commit
ad113fa3aa
|
@ -12,6 +12,7 @@ local spawn = require("awful.spawn")
|
|||
local set_shape = require("awful.client.shape").update.all
|
||||
local object = require("gears.object")
|
||||
local grect = require("gears.geometry").rectangle
|
||||
local gmath = require("gears.math")
|
||||
local pairs = pairs
|
||||
local type = type
|
||||
local ipairs = ipairs
|
||||
|
@ -178,7 +179,7 @@ function client.next(i, sel, stacked)
|
|||
for idx, c in ipairs(cls) do
|
||||
if c == sel then
|
||||
-- Cycle
|
||||
return cls[util.cycle(#cls, idx + i)]
|
||||
return cls[gmath.cycle(#cls, idx + i)]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1090,7 +1091,7 @@ end
|
|||
function client.run_or_raise(cmd, matcher, merge)
|
||||
local clients = capi.client.get()
|
||||
local findex = util.table.hasitem(clients, capi.client.focus) or 1
|
||||
local start = util.cycle(#clients, findex + 1)
|
||||
local start = gmath.cycle(#clients, findex + 1)
|
||||
|
||||
local c = client.iterate(matcher, start)()
|
||||
if c then
|
||||
|
|
|
@ -21,6 +21,7 @@ local tag = require("awful.tag")
|
|||
local client = require("awful.client")
|
||||
local ascreen = require("awful.screen")
|
||||
local timer = require("gears.timer")
|
||||
local gmath = require("gears.math")
|
||||
|
||||
local function get_screen(s)
|
||||
return s and capi.screen[s]
|
||||
|
@ -121,7 +122,7 @@ function layout.inc(i, s, layouts)
|
|||
end
|
||||
end
|
||||
if curindex then
|
||||
local newindex = util.cycle(#layouts, curindex + i)
|
||||
local newindex = gmath.cycle(#layouts, curindex + i)
|
||||
layout.set(layouts[newindex], t)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
---------------------------------------------------------------------------
|
||||
|
||||
local capi = {screen = screen, mouse = mouse}
|
||||
local util = require("awful.util")
|
||||
local gmath = require("gears.math")
|
||||
local tag = require("awful.tag")
|
||||
local resize = require("awful.mouse.resize")
|
||||
|
||||
|
@ -38,11 +38,11 @@ function module.drag_to_tag(c)
|
|||
if dir then
|
||||
|
||||
if dir == "right" then
|
||||
local newtag = tags[util.cycle(#tags, idx + 1)]
|
||||
local newtag = tags[gmath.cycle(#tags, idx + 1)]
|
||||
c:move_to_tag(newtag)
|
||||
tag.viewnext()
|
||||
elseif dir == "left" then
|
||||
local newtag = tags[util.cycle(#tags, idx - 1)]
|
||||
local newtag = tags[gmath.cycle(#tags, idx - 1)]
|
||||
c:move_to_tag(newtag)
|
||||
tag.viewprev()
|
||||
end
|
||||
|
|
|
@ -15,6 +15,7 @@ local capi =
|
|||
awesome = awesome,
|
||||
}
|
||||
local util = require("awful.util")
|
||||
local gmath = require("gears.math")
|
||||
local object = require("gears.object")
|
||||
local grect = require("gears.geometry").rectangle
|
||||
|
||||
|
@ -169,7 +170,7 @@ end
|
|||
-- @tparam int offset Value to add to the current focused screen index. 1 to
|
||||
-- focus the next one, -1 to focus the previous one.
|
||||
function screen.focus_relative(offset)
|
||||
return screen.focus(util.cycle(capi.screen.count(),
|
||||
return screen.focus(gmath.cycle(capi.screen.count(),
|
||||
screen.focused().index + offset))
|
||||
end
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
local util = require("awful.util")
|
||||
local ascreen = require("awful.screen")
|
||||
local beautiful = require("beautiful")
|
||||
local gmath = require("gears.math")
|
||||
local object = require("gears.object")
|
||||
local timer = require("gears.timer")
|
||||
local pairs = pairs
|
||||
|
@ -1198,7 +1199,7 @@ function tag.viewidx(i, screen)
|
|||
tag.viewnone(screen)
|
||||
for k, t in ipairs(showntags) do
|
||||
if t == sel then
|
||||
showntags[util.cycle(#showntags, k + i)].selected = true
|
||||
showntags[gmath.cycle(#showntags, k + i)].selected = true
|
||||
end
|
||||
end
|
||||
screen:emit_signal("tag::history::update")
|
||||
|
|
|
@ -512,7 +512,7 @@ function util.table.iterate(t, filter, start)
|
|||
return function ()
|
||||
while count < length do
|
||||
local item = t[index]
|
||||
index = util.cycle(#t, index + 1)
|
||||
index = gmath.cycle(#t, index + 1)
|
||||
count = count + 1
|
||||
if filter(item) then return item end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue