diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-09-10 22:25:40 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-09-10 22:25:40 +0200 |
commit | 23056abf6c53519a45edc8716bcd31b0760c9c19 (patch) | |
tree | 24b7ff7a6a7b265685d80a0a7fe2d9c2161893bd | |
parent | efb377afddec303ba0e932d2adb8882357b71345 (diff) | |
download | awesome-configs-23056abf6c53519a45edc8716bcd31b0760c9c19.tar.xz |
teardrop: improved tag switching
-rw-r--r-- | teardrop.lua | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/teardrop.lua b/teardrop.lua index efa05ac..ad5cce5 100644 --- a/teardrop.lua +++ b/teardrop.lua @@ -1,33 +1,33 @@ ---------------------------------------------------------------------------- --- Drop down (quake-like) applications for the awesome window manager ---------------------------------------------------------------------------- +-------------------------------------------------------------------------- +-- Drop-down applications module for the awesome window manager +-------------------------------------------------------------------------- -- Original by: Lucas de Vries <lucas_glacicle_com> -- * http://awesome.naquadah.org/wiki/Drop-down_terminal -- -- Modified by: Adrian C. <anrxc_sysphere_org> --- * Original code turned into a module --- * Startup notification disabled --- * Slides in from the bottom of the screen by default --- * Ported to awesome 3.4 (signals, new properties...) --- * Does not show up on tags when hidden +-- * turned into a module +-- * st-notification disabled +-- * bottom edge by default +-- * ported to awesome 3.4 +-- * different tag handling -- -- Licensed under the WTFPL version 2 -- * http://sam.zoy.org/wtfpl/COPYING ---------------------------------------------------------------------------- +-------------------------------------------------------------------------- -- To use this module add: -- require("teardrop") -- to the top of your rc.lua and call: -- teardrop.toggle(prog, edge, height, screen) -- from a keybinding. -- --- Parameters: +-- Parameters: -- prog - Program to run, for example: "urxvt" or "gmrun" -- edge - Screen edge (optional), 1 to drop down from the top of the -- screen, by default it slides in from the bottom -- height - Height (optional), in absolute pixels when > 1 or a height -- percentage when < 1, 0.25 (25% of the screen) by default -- screen - Screen (optional) ---------------------------------------------------------------------------- +-------------------------------------------------------------------------- -- Grab environment local pairs = pairs @@ -39,21 +39,20 @@ local capi = { } --- Teardrop: Drop down (quake-like) applications for the awesome window manager +-- Teardrop: Drop-down applications module for the awesome window manager module("teardrop") local dropdown = {} --- Drop down (quake-like) application toggle +-- Drop-down (quake-like) application toggle -- -- Create a new window for the drop-down application when it doesn't --- exist, or toggle between hidden and visible states if one does --- exist. +-- exist, or toggle between hidden and visible states when it does. function toggle(prog, edge, height, screen) - if screen == nil then screen = capi.mouse.screen end - if height == nil then height = 0.25 end if edge == nil then edge = 0 end + if height == nil then height = 0.25 end + if screen == nil then screen = capi.mouse.screen end local function untag(c) local tags = c:tags() @@ -93,10 +92,9 @@ function toggle(prog, edge, height, screen) height = screengeom.height * height end - -- Screen edge + -- Deduce edge if edge < 1 then -- Slide in from the bottom of the screen - -- * screen height (resolution-wibox)+wibox size-term height screenedge = screengeom.height + screengeom.y - height else -- Drop down from the top of the screen @@ -135,10 +133,14 @@ function toggle(prog, edge, height, screen) -- Get client c = dropdown[prog][screen] - -- Switch the client to the current workspace - awful.client.movetotag(awful.tag.selected(screen), c) + if c:isvisible() == false then + -- Hide when switching the workspace + c.hidden = true + -- Switch the client to the current workspace + awful.client.movetotag(awful.tag.selected(screen), c) + end - -- Focus and raise if not hidden + -- Focus and raise if hidden if c.hidden then c.hidden = false c:raise() |