summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-01-29 23:43:13 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-01-29 23:43:13 +0100
commitdd090013fda59ba0c77e88a618802bec9ecb4960 (patch)
tree4671c9e99e4408905799e30b7d77ab5fe58a5534
parent5b4be976ab72351435e385101722c05ec2ffd76b (diff)
downloadawesome-configs-dd090013fda59ba0c77e88a618802bec9ecb4960.tar.xz
scratch: combined teardrop and scratchpad
First step in integrating teardrop and scratchpad. With time the operations common to both modules should be made available to both, removing all duplication. Modules are split, even though they could function as just one module, scratchpad could get tabbing support (or other means of scratching multiple clients) so let's keep things clean.
-rw-r--r--rc.lua9
-rw-r--r--scratch/drop.lua (renamed from teardrop.lua)24
-rw-r--r--scratch/init.lua12
-rw-r--r--scratch/pad.lua (renamed from scratchpad.lua)36
4 files changed, 46 insertions, 35 deletions
diff --git a/rc.lua b/rc.lua
index f930520..92dd31e 100644
--- a/rc.lua
+++ b/rc.lua
@@ -16,8 +16,7 @@ require("awful.rules")
require("awful.autofocus")
-- User libraries
require("vicious")
-require("teardrop")
-require("scratchpad")
+require("scratch")
-- }}}
@@ -334,7 +333,7 @@ globalkeys = awful.util.table.join(
awful.key({ modkey }, "r", function () exec("rox", false) end),
awful.key({ modkey }, "w", function () exec("firefox") end),
awful.key({ altkey }, "F1", function () exec("urxvt") end),
- awful.key({ altkey }, "#49", function () teardrop("urxvt", "bottom") end),
+ awful.key({ altkey }, "#49", function () scratch.drop("urxvt", "bottom") end),
awful.key({ modkey }, "a", function () exec("urxvt -T Alpine -e alpine_exp") end),
awful.key({ modkey }, "g", function () sexec("GTK2_RC_FILES=~/.gtkrc-gajim gajim") end),
awful.key({ modkey }, "q", function () exec("emacsclient --eval '(make-remember-frame)'") end),
@@ -400,7 +399,7 @@ globalkeys = awful.util.table.join(
-- {{{ Focus controls
awful.key({ modkey }, "p", function () awful.screen.focus_relative(1) end),
- awful.key({ modkey }, "s", function () scratchpad.toggle() end),
+ awful.key({ modkey }, "s", function () scratch.pad.toggle() end),
awful.key({ modkey }, "u", awful.client.urgent.jumpto),
awful.key({ modkey }, "j", function ()
awful.client.focus.byidx(1)
@@ -427,7 +426,7 @@ globalkeys = awful.util.table.join(
-- {{{ Client manipulation
clientkeys = awful.util.table.join(
awful.key({ modkey }, "c", function (c) c:kill() end),
- awful.key({ modkey }, "d", function (c) scratchpad.set(c, 0.60, 0.60, true) end),
+ awful.key({ modkey }, "d", function (c) scratch.pad.set(c, 0.60, 0.60, true) end),
awful.key({ modkey }, "f", function (c) awful.titlebar.remove(c)
c.fullscreen = not c.fullscreen
end),
diff --git a/teardrop.lua b/scratch/drop.lua
index afcff28..f5cff97 100644
--- a/teardrop.lua
+++ b/scratch/drop.lua
@@ -1,15 +1,15 @@
-----------------------------------------------------------------
+-------------------------------------------------------------------
-- Drop-down applications manager for the awesome window manager
-----------------------------------------------------------------
--- Coded by: Lucas de Vries <lucas@glacicle.com>
--- Hacked by: Adrian C. <anrxc@sysphere.org>
+-------------------------------------------------------------------
+-- Coded by: * Adrian C. (anrxc) <anrxc@sysphere.org>
+-- * Lucas de Vries <lucas@glacicle.com>
-- Licensed under the WTFPL version 2
-- * http://sam.zoy.org/wtfpl/COPYING
-----------------------------------------------------------------
+-------------------------------------------------------------------
-- To use this module add:
--- require("teardrop")
+-- require("scratch")
-- to the top of your rc.lua, and call it from a keybinding:
--- teardrop(prog, vert, horiz, width, height, sticky, screen)
+-- scratch.drop(prog, vert, horiz, width, height, sticky, screen)
--
-- Parameters:
-- prog - Program to run; "urxvt", "gmrun", "thunderbird"
@@ -21,7 +21,7 @@
-- when <= 1 (0.25 (25% of the screen) by default)
-- sticky - Visible on all tags, false by default
-- screen - Screen (optional), mouse.screen by default
-----------------------------------------------------------------
+-------------------------------------------------------------------
-- Grab environment
local pairs = pairs
@@ -33,8 +33,8 @@ local capi = {
screen = screen
}
--- Teardrop: Drop-down applications manager for the awesome window manager
-module("teardrop")
+-- Scratchdrop: drop-down applications manager for the awesome window manager
+module("scratch.drop")
local dropdown = {}
@@ -51,7 +51,7 @@ function toggle(prog, vert, horiz, width, height, sticky, screen)
if not dropdown[prog] then
dropdown[prog] = {}
- -- Add unmanage signal for teardrop programs
+ -- Add unmanage signal for scratchdrop programs
capi.client.add_signal("unmanage", function (c)
for scr, cl in pairs(dropdown[prog]) do
if cl == c then
@@ -65,7 +65,7 @@ function toggle(prog, vert, horiz, width, height, sticky, screen)
spawnw = function (c)
dropdown[prog][screen] = c
- -- Teardrop clients are floaters
+ -- Scratchdrop clients are floaters
awful.client.floating.set(c, true)
-- Client geometry and placement
diff --git a/scratch/init.lua b/scratch/init.lua
new file mode 100644
index 0000000..eb037fc
--- /dev/null
+++ b/scratch/init.lua
@@ -0,0 +1,12 @@
+---------------------------------------------------------------
+-- Drop-down applications and scratchpad manager for awesome wm
+---------------------------------------------------------------
+-- Coded by: * Adrian C. (anrxc) <anrxc@sysphere.org>
+-- Licensed under the WTFPL version 2
+-- * http://sam.zoy.org/wtfpl/COPYING
+---------------------------------------------------------------
+
+require("scratch.pad")
+require("scratch.drop")
+
+module("scratch")
diff --git a/scratchpad.lua b/scratch/pad.lua
index af166d1..a092f13 100644
--- a/scratchpad.lua
+++ b/scratch/pad.lua
@@ -1,16 +1,16 @@
---------------------------------------------------------------
-- Basic scratchpad manager for the awesome window manager
---------------------------------------------------------------
--- Coded by: Adrian C. <anrxc@sysphere.org>
+-- Coded by: * Adrian C. (anrxc) <anrxc@sysphere.org>
-- Licensed under the WTFPL version 2
-- * http://sam.zoy.org/wtfpl/COPYING
---------------------------------------------------------------
-- To use this module add:
--- require("scratchpad")
+-- require("scratch")
-- to the top of your rc.lua, and call:
--- scratchpad.set(c, width, height, sticky, screen)
+-- scratch.pad.set(c, width, height, sticky, screen)
-- from a clientkeys binding, and:
--- scratchpad.toggle(screen)
+-- scratch.pad.toggle(screen)
-- from a globalkeys binding.
--
-- Parameters:
@@ -31,10 +31,10 @@ local capi = {
screen = screen
}
--- Scratchpad: Basic scratchpad manager for the awesome window manager
-module("scratchpad")
+-- Scratchpad: basic scratchpad manager for the awesome window manager
+module("scratch.pad")
-local scratch = {}
+local scratchpad = {}
-- Toggle a set of properties on a client.
local function toggleprop(c, prop)
@@ -76,27 +76,27 @@ function set(c, width, height, sticky, screen)
end
-- Prepare a table for storing clients,
- if not scratch.pad then scratch.pad = {}
+ if not scratchpad.pad then scratchpad.pad = {}
-- add unmanage signal for scratchpad clients
capi.client.add_signal("unmanage", function (c)
- if scratch.pad[screen] == c then
- scratch.pad[screen] = nil
+ if scratchpad.pad[screen] == c then
+ scratchpad.pad[screen] = nil
end
end)
end
-- If the scratcphad is emtpy, store the client,
- if not scratch.pad[screen] then
- scratch.pad[screen] = c
+ if not scratchpad.pad[screen] then
+ scratchpad.pad[screen] = c
-- then apply geometry and properties
setscratch(c)
else -- If a client is already scratched,
- local oc = scratch.pad[screen]
+ local oc = scratchpad.pad[screen]
-- unscratch, and compare it with the focused client
awful.client.floating.toggle(oc); toggleprop(oc, {})
-- If it matches clear the table, if not replace it
- if oc == c then scratch.pad[screen] = nil
- else scratch.pad[screen] = c; setscratch(c) end
+ if oc == c then scratchpad.pad[screen] = nil
+ else scratchpad.pad[screen] = c; setscratch(c) end
end
end
@@ -106,10 +106,10 @@ function toggle(screen)
local screen = screen or capi.mouse.screen
-- Check if we have a client on storage,
- if scratch.pad and
- scratch.pad[screen] ~= nil
+ if scratchpad.pad and
+ scratchpad.pad[screen] ~= nil
then -- and get it out, to play
- local c = scratch.pad[screen]
+ local c = scratchpad.pad[screen]
-- If it's visible on another tag hide it,
if c:isvisible() == false then c.hidden = true