From 1adab3e040363e2855d9b11972f2a1e11ec9b071 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Tue, 19 Jun 2012 02:57:00 +0200 Subject: scratch: port scratch module to lua 5.2 --- scratch/drop.lua | 5 +++-- scratch/init.lua | 8 +++++--- scratch/pad.lua | 9 ++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/scratch/drop.lua b/scratch/drop.lua index 3f7e4cd..2c7e214 100644 --- a/scratch/drop.lua +++ b/scratch/drop.lua @@ -34,7 +34,8 @@ local capi = { } -- Scratchdrop: drop-down applications manager for the awesome window manager -module("scratch.drop") +local drop = {} -- module scratch.drop + local dropdown = {} @@ -126,4 +127,4 @@ function toggle(prog, vert, horiz, width, height, sticky, screen) end end -setmetatable(_M, { __call = function(_, ...) return toggle(...) end }) +return setmetatable(drop, { __call = function(_, ...) return toggle(...) end }) diff --git a/scratch/init.lua b/scratch/init.lua index eb037fc..f3b3e7e 100644 --- a/scratch/init.lua +++ b/scratch/init.lua @@ -6,7 +6,9 @@ -- * http://sam.zoy.org/wtfpl/COPYING --------------------------------------------------------------- -require("scratch.pad") -require("scratch.drop") +local scratch = {} -- module scratch -module("scratch") +scratch.pad = require("scratch.pad") +scratch.drop = require("scratch.drop") + +return scratch diff --git a/scratch/pad.lua b/scratch/pad.lua index a632f38..c6f06cd 100644 --- a/scratch/pad.lua +++ b/scratch/pad.lua @@ -33,7 +33,8 @@ local capi = { } -- Scratchpad: basic scratchpad manager for the awesome window manager -module("scratch.pad") +local pad = {} -- module scratch.pad + local scratchpad = {} @@ -48,7 +49,7 @@ end -- Scratch the focused client, or un-scratch and tile it. If another -- client is already scratched, replace it with the focused client. -function set(c, width, height, sticky, screen) +function pad.set(c, width, height, sticky, screen) width = width or 0.50 height = height or 0.50 sticky = sticky or false @@ -103,7 +104,7 @@ end -- Move the scratchpad to the current workspace, focus and raise it -- when it's hidden, or hide it when it's visible. -function toggle(screen) +function pad.toggle(screen) screen = screen or capi.mouse.screen -- Check if we have a client on storage, @@ -128,3 +129,5 @@ function toggle(screen) end end end + +return pad -- cgit v1.2.3