diff --git a/docs/config.ld b/docs/config.ld index 3a264f90c..120ba85c4 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -133,6 +133,7 @@ file = { -- documentation '../lib/awful/autofocus.lua', '../lib/awful/dbus.lua', + '../lib/awful/_compat.lua', '../lib/awful/init.lua', '../lib/awful/remote.lua', '../lib/awful/screen/dpi.lua', diff --git a/lib/awful/_compat.lua b/lib/awful/_compat.lua new file mode 100644 index 000000000..07016b14b --- /dev/null +++ b/lib/awful/_compat.lua @@ -0,0 +1,27 @@ +-- This file contains all global backward compatibility workarounds for the +-- Core API changes. +local gtimer = require("gears.timer") +local util = require("awful.util" ) +local spawn = require("awful.spawn") +local gdebug = require("gears.debug") + +function timer(...) -- luacheck: ignore + gdebug.deprecate("gears.timer", {deprecated_in=4}) + return gtimer(...) +end + +util.spawn = function(...) + gdebug.deprecate("awful.spawn", {deprecated_in=4}) + return spawn.spawn(...) +end + +util.spawn_with_shell = function(...) + gdebug.deprecate("awful.spawn.with_shell", {deprecated_in=4}) + return spawn.with_shell(...) +end + +util.pread = function() + gdebug.deprecate("Use io.popen() directly or look at awful.spawn.easy_async() " + .. "for an asynchronous alternative", {deprecated_in=4}) + return "" +end diff --git a/lib/awful/init.lua b/lib/awful/init.lua index da63275c4..cf5764273 100644 --- a/lib/awful/init.lua +++ b/lib/awful/init.lua @@ -6,34 +6,7 @@ -- @module awful --------------------------------------------------------------------------- --- TODO: This is a hack for backwards-compatibility with 3.5, remove! -local util = require("awful.util") -local gtimer = require("gears.timer") -local gdebug = require("gears.debug") -function timer(...) -- luacheck: ignore - gdebug.deprecate("gears.timer", {deprecated_in=4}) - return gtimer(...) -end - ---TODO: This is a hack for backwards-compatibility with 3.5, remove! --- Set awful.util.spawn* and awful.util.pread. -local spawn = require("awful.spawn") - -util.spawn = function(...) - gdebug.deprecate("awful.spawn", {deprecated_in=4}) - return spawn.spawn(...) -end - -util.spawn_with_shell = function(...) - gdebug.deprecate("awful.spawn.with_shell", {deprecated_in=4}) - return spawn.with_shell(...) -end - -util.pread = function() - gdebug.deprecate("Use awful.spawn.easy_async() " - .. "for an asynchronous alternative", {deprecated_in=4}) - return "" -end +require("awful._compat") return { @@ -60,7 +33,7 @@ return titlebar = require("awful.titlebar"); rules = require("awful.rules"); popup = require("awful.popup"); - spawn = spawn; + spawn = require("awful.spawn"); } -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80