]> git.madduck.net Git - etc/awesome.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

save arezzo files
authorprojektile <tlp2749@email.vccs.edu>
Mon, 22 Sep 2014 15:25:27 +0000 (11:25 -0400)
committercopycat-killer <dada@archlinux.info>
Wed, 5 Aug 2015 11:31:14 +0000 (13:31 +0200)
layout/cascade.lua
layout/cascadetile.lua
layout/centerfair.lua
layout/centerwork.lua
layout/termfair.lua
layout/uselessfair.lua
layout/uselesspiral.lua
layout/uselesstile.lua

index cabacefa2826df515bc77f5cf1cf2eba5772d30c..999c599efeb6042391c7a00499bd1568f37604e6 100644 (file)
@@ -2,12 +2,14 @@
 --[[
                                                   
      Licensed under GNU General Public License v2 
 --[[
                                                   
      Licensed under GNU General Public License v2 
+      * (c) 2014,      projektile                 
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
 --]]
 
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
 --]]
 
-local tag = require("awful.tag")
+local tag       = require("awful.tag")
+local beautiful = require("beautiful")
 
 local cascade =
 {
 
 local cascade =
 {
@@ -21,10 +23,23 @@ function cascade.arrange(p)
 
     -- Cascade windows.
 
 
     -- Cascade windows.
 
+    -- A global border can be defined with
+    -- beautiful.global_border_width.
+    local global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- Themes border width requires an offset.
+    local bw = tonumber(beautiful.border_width) or 0
+
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
+    wa.height = wa.height - ((global_border * 2) + (bw * 2))
+    wa.width = wa.width - ((global_border * 2) + (bw * 2))
+    wa.x = wa.x + global_border
+    wa.y = wa.y + global_border
+
     -- Opening a new window will usually force all existing windows to
     -- get resized. This wastes a lot of CPU time. So let's set a lower
     -- bound to "how_many": This wastes a little screen space but you'll
     -- Opening a new window will usually force all existing windows to
     -- get resized. This wastes a lot of CPU time. So let's set a lower
     -- bound to "how_many": This wastes a little screen space but you'll
index 98821e31e08bd8889d97bed328081a4e54e5d1e3..e9b942560cc6a32333d4de128b413d45cd8c7840 100644 (file)
@@ -2,6 +2,7 @@
 --[[
                                                   
      Licensed under GNU General Public License v2 
 --[[
                                                   
      Licensed under GNU General Public License v2 
+      * (c) 2014,      projektile                 
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
@@ -30,25 +31,36 @@ function cascadetile.arrange(p)
 
     -- It's a bit hard to demonstrate the behaviour with ASCII-images...
     --
 
     -- It's a bit hard to demonstrate the behaviour with ASCII-images...
     --
-    --       (1)              (2)              (3)              (4)
-    --   +-----+---+      +-----+---+      +-----+---+      +-----+---+
-    --   |     |   |      |     |   |      |     |   |      |     | 4 |
-    --   |     |   |      |     | 2 |      |     | 3 |      |     |   |
-    --   |  1  |   |  ->  |  1  |   |  ->  |  1  |   |  ->  |  1  +---+
-    --   |     |   |      |     +---+      |     +---+      |     | 3 |
-    --   |     |   |      |     |   |      |     | 2 |      |     |---|
-    --   |     |   |      |     |   |      |     |---|      |     | 2 |
-    --   |     |   |      |     |   |      |     |   |      |     |---|
-    --   +-----+---+      +-----+---+      +-----+---+      +-----+---+
+    --         (1)                 (2)                 (3)                 (4)
+    --   +----------+---+    +----------+---+    +----------+---+    +----------+---+
+    --   |          |   |    |          | 3 |    |          | 4 |    |         +---+|
+    --   |          |   | -> |          |   | -> |         +---++ -> |        +---+|+
+    --   |  1       | 2 |    |  1      +---++    |  1      | 3 ||    |  1    +---+|+|
+    --   |          |   |    |         | 2 ||    |        +---++|    |      +---+|+ |
+    --   |          |   |    |         |   ||    |        | 2 | |    |      | 2 |+  |
+    --   +----------+---+    +---------+---++    +--------+---+-+    +------+---+---+
 
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
 
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
+    if useless_gap < 0 then useless_gap = 0 end
+
+    -- A global border can be defined with
+    -- beautiful.global_border_width
+    local global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- Themes border width requires an offset
+    local bw = tonumber(beautiful.border_width) or 0
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
+    -- Borders are factored in.
+    wa.height = wa.height - ((global_border * 2) + (bw * 2))
+    wa.width = wa.width - ((global_border * 2) + (bw * 2))
+
     -- Width of main column?
     local t = tag.selected(p.screen)
     local mwfact
     -- Width of main column?
     local t = tag.selected(p.screen)
     local mwfact
@@ -108,8 +120,8 @@ function cascadetile.arrange(p)
         end
 
         g.height = wa.height
         end
 
         g.height = wa.height
-        g.x = wa.x
-        g.y = wa.y
+        g.x = wa.x + global_border
+        g.y = wa.y + global_border
         if useless_gap > 0
         then
             -- Reduce width once and move window to the right. Reduce
         if useless_gap > 0
         then
             -- Reduce width once and move window to the right. Reduce
@@ -138,7 +150,7 @@ function cascadetile.arrange(p)
                 g.width = slavewid - current_offset_x
                 g.height = wa.height - current_offset_y
                 g.x = wa.x + mainwid + (how_many - i) * cascadetile.offset_x
                 g.width = slavewid - current_offset_x
                 g.height = wa.height - current_offset_y
                 g.x = wa.x + mainwid + (how_many - i) * cascadetile.offset_x
-                g.y = wa.y + (i - 1) * cascadetile.offset_y
+                g.y = wa.y + (i - 1) * cascadetile.offset_y + global_border
                 if useless_gap > 0
                 then
                     g.width = g.width - 2 * useless_gap
                 if useless_gap > 0
                 then
                     g.width = g.width - 2 * useless_gap
index 49b4a14c6498f6dfa1ceba9ffa23e88ccd5faaf4..01a2fe06f064fe04858a0d85118cb304fa8f23b7 100644 (file)
@@ -1,11 +1,12 @@
 
 --[[
 
 --[[
-                                                  
-     Licensed under GNU General Public License v2 
-      * (c) 2013,      Luke Bonham                
-      * (c) 2010,      Nicolas Estibals           
-      * (c) 2010-2012, Peter Hofmann              
-                                                  
+                                                 
+     Licensed under GNU General Public License v2
+      * (c) 2014,      projektile                
+      * (c) 2013,      Luke Bonham               
+      * (c) 2010,      Nicolas Estibals          
+      * (c) 2010-2012, Peter Hofmann             
+                                                 
 --]]
 
 local tag       = require("awful.tag")
 --]]
 
 local tag       = require("awful.tag")
@@ -41,15 +42,30 @@ function centerfair.arrange(p)
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width .
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width .
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
+    if useless_gap < 0 then useless_gap = 0 end
+
+    -- A global border can be defined with
+    -- beautiful.global_border_width
+    local global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- Themes border width requires an offset
+    local bw = tonumber(beautiful.border_width) or 0
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
+    -- Borders are factored in.
+    wa.height = wa.height - ((global_border * 2) + (bw * 2))
+    wa.width = wa.width - ((global_border * 2) + (bw * 2))
+
     -- How many vertical columns? Read from nmaster on the tag.
     local t = tag.selected(p.screen)
     local num_x = centerfair.nmaster or tag.getnmaster(t)
     local ncol = centerfair.ncol or tag.getncol(t)
     -- How many vertical columns? Read from nmaster on the tag.
     local t = tag.selected(p.screen)
     local num_x = centerfair.nmaster or tag.getnmaster(t)
     local ncol = centerfair.ncol or tag.getncol(t)
+    if num_x <= 2 then num_x = 2 end
+    if num_x > #cls then num_x = #cls end
 
     local width = math.floor((wa.width-(num_x+1)*useless_gap) / num_x)
 
 
     local width = math.floor((wa.width-(num_x+1)*useless_gap) / num_x)
 
@@ -61,24 +77,24 @@ function centerfair.arrange(p)
         local g = {}
         g.width = width
         g.height = wa.height - 2*useless_gap - 2
         local g = {}
         g.width = width
         g.height = wa.height - 2*useless_gap - 2
-        g.y = offset_y
+        g.y = offset_y + global_border
         for i = 1, #cls do
         for i = 1, #cls do
-            g.x = offset_x + (i - 1) * (width + useless_gap + 2)
+            g.x = offset_x + (i - 1) * (width + useless_gap + 2) + global_border
             cls[i]:geometry(g)
         end
     else
         -- More clients than the number of columns, let's arrange it!
             cls[i]:geometry(g)
         end
     else
         -- More clients than the number of columns, let's arrange it!
-        local offset_x = wa.x 
+        local offset_x = wa.x
         if useless_gap > 0 then
         if useless_gap > 0 then
-           offset_x = offset_x 
+           offset_x = offset_x
         end
 
         -- Master client deserves a special treatement
         local g = {}
         end
 
         -- Master client deserves a special treatement
         local g = {}
-        g.width = wa.width - (num_x-1)*width -num_x*useless_gap - 2
+        g.width = wa.width - (num_x  - 1) * width - num_x * useless_gap
         g.height = wa.height - 2*useless_gap - 2
         g.height = wa.height - 2*useless_gap - 2
-        g.x = offset_x + useless_gap
-        g.y = offset_y
+        g.x = offset_x + useless_gap + global_border
+        g.y = offset_y + global_border
         cls[1]:geometry(g)
 
         -- Treat the other clients
         cls[1]:geometry(g)
 
         -- Treat the other clients
@@ -128,8 +144,8 @@ function centerfair.arrange(p)
 
         for i = 1, (num_x-1) do
             to_remove = 2
 
         for i = 1, (num_x-1) do
             to_remove = 2
-            g.height = math.floor((wa.height-useless_gap)/num_y[i]) 
-            g.y = offset_y
+            g.height = math.floor((wa.height - (num_y[i] * useless_gap)) / num_y[i])
+            g.y = offset_y + global_border
             for j = 0, (num_y[i]-2) do
                 cls[nclient]:geometry(g)
                 nclient = nclient + 1
             for j = 0, (num_y[i]-2) do
                 cls[nclient]:geometry(g)
                 nclient = nclient + 1
index 939f18c3d467bed574cd444726069dead33d12e0..61f4907b78d1f581f11d013a467ff72a5af3ea00 100644 (file)
@@ -2,6 +2,7 @@
 --[[
                                                   
      Licensed under GNU General Public License v2 
 --[[
                                                   
      Licensed under GNU General Public License v2 
+      * (c) 2014,      projektile                 
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
@@ -26,10 +27,22 @@ function centerwork.arrange(p)
     -- beautiful.useless_gap_width .
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
 
     -- beautiful.useless_gap_width .
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
 
+    -- A global border can be defined with
+    -- beautiful.global_border_width
+    local global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- Themes border width requires an offset
+    local bw = tonumber(beautiful.border_width) or 0
+
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
+    -- Borders are factored in.
+    wa.height = wa.height - ((global_border * 2) + (bw * 2))
+    wa.width = wa.width - ((global_border * 2) + (bw * 2))
+
     -- Width of main column?
     local t = awful.tag.selected(p.screen)
     local mwfact = awful.tag.getmwfact(t)
     -- Width of main column?
     local t = awful.tag.selected(p.screen)
     local mwfact = awful.tag.getmwfact(t)
@@ -37,7 +50,7 @@ function centerwork.arrange(p)
     if #cls > 0
     then
         -- Main column, fixed width and height.
     if #cls > 0
     then
         -- Main column, fixed width and height.
-        local c = cls[1]
+        local c = cls[#cls]
         local g = {}
         local mainwid = math.floor(wa.width * mwfact)
         local slavewid = wa.width - mainwid
         local g = {}
         local mainwid = math.floor(wa.width * mwfact)
         local slavewid = wa.width - mainwid
@@ -48,8 +61,8 @@ function centerwork.arrange(p)
 
         g.height = wa.height - 2 * useless_gap
         g.width = mainwid
 
         g.height = wa.height - 2 * useless_gap
         g.width = mainwid
-        g.x = wa.x + slaveLwid
-        g.y = wa.y + useless_gap
+        g.x = wa.x + slaveLwid + global_border
+        g.y = wa.y + useless_gap + global_border
 
         c:geometry(g)
 
 
         c:geometry(g)
 
@@ -57,7 +70,7 @@ function centerwork.arrange(p)
         if #cls > 1
         then
             local at = 0
         if #cls > 1
         then
             local at = 0
-            for i = (#cls),2,-1
+            for i = (#cls - 1),1,-1
             do
                 -- It's all fixed. If there are more than 5 clients,
                 -- those additional clients will float. This is
             do
                 -- It's all fixed. If there are more than 5 clients,
                 -- those additional clients will float. This is
@@ -73,29 +86,29 @@ function centerwork.arrange(p)
                 if at == centerwork.top_left
                 then
                     -- top left
                 if at == centerwork.top_left
                 then
                     -- top left
-                    g.x = wa.x + useless_gap
-                    g.y = wa.y + useless_gap
+                    g.x = wa.x + useless_gap + global_border
+                    g.y = wa.y + useless_gap + global_border
                     g.width = slaveLwid - 2 * useless_gap
                     g.height = slaveThei - useless_gap
                 elseif at == centerwork.top_right
                 then
                     -- top right
                     g.width = slaveLwid - 2 * useless_gap
                     g.height = slaveThei - useless_gap
                 elseif at == centerwork.top_right
                 then
                     -- top right
-                    g.x = wa.x + slaveLwid + mainwid + useless_gap
-                    g.y = wa.y + useless_gap
+                    g.x = wa.x + slaveLwid + mainwid + useless_gap + global_border
+                    g.y = wa.y + useless_gap + global_border
                     g.width = slaveRwid - 2 * useless_gap
                     g.height = slaveThei - useless_gap
                 elseif at == centerwork.bottom_left
                 then
                     -- bottom left
                     g.width = slaveRwid - 2 * useless_gap
                     g.height = slaveThei - useless_gap
                 elseif at == centerwork.bottom_left
                 then
                     -- bottom left
-                    g.x = wa.x + useless_gap
-                    g.y = wa.y + slaveThei + useless_gap
+                    g.x = wa.x + useless_gap + global_border
+                    g.y = wa.y + slaveThei + useless_gap + global_border
                     g.width = slaveLwid - 2 * useless_gap
                     g.height = slaveBhei - 2 * useless_gap
                 elseif at == centerwork.bottom_right
                 then
                     -- bottom right
                     g.width = slaveLwid - 2 * useless_gap
                     g.height = slaveBhei - 2 * useless_gap
                 elseif at == centerwork.bottom_right
                 then
                     -- bottom right
-                    g.x = wa.x + slaveLwid + mainwid + useless_gap
-                    g.y = wa.y + slaveThei + useless_gap
+                    g.x = wa.x + slaveLwid + mainwid + useless_gap + global_border
+                    g.y = wa.y + slaveThei + useless_gap + global_border
                     g.width = slaveRwid - 2 * useless_gap
                     g.height = slaveBhei - 2 * useless_gap
                 end
                     g.width = slaveRwid - 2 * useless_gap
                     g.height = slaveBhei - 2 * useless_gap
                 end
index 89a44bbd0e9e3145b2df77448e44e13663cb541b..4e45eec3cd55c91b9de683bd752ff091db2fbffe 100644 (file)
@@ -2,6 +2,7 @@
 --[[
                                                   
      Licensed under GNU General Public License v2 
 --[[
                                                   
      Licensed under GNU General Public License v2 
+      * (c) 2014,      projektile                 
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
       * (c) 2013,      Luke Bonham                
       * (c) 2010-2012, Peter Hofmann              
                                                   
@@ -38,11 +39,24 @@ function termfair.arrange(p)
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
+    if useless_gap < 0 then useless_gap = 0 end
+
+    -- A global border can be defined with
+    -- beautiful.global_border_width
+    local global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- Themes border width requires an offset
+    local bw = tonumber(beautiful.border_width) or 0
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
 
     -- Screen.
     local wa = p.workarea
     local cls = p.clients
 
+    -- Borders are factored in.
+    wa.height = wa.height - ((global_border * 2) + (bw * 2))
+    wa.width = wa.width - ((global_border * 2) + (bw * 2))
+
     -- How many vertical columns?
     local t = tag.selected(p.screen)
     local num_x = termfair.nmaster or tag.getnmaster(t)
     -- How many vertical columns?
     local t = tag.selected(p.screen)
     local num_x = termfair.nmaster or tag.getnmaster(t)
@@ -79,43 +93,26 @@ function termfair.arrange(p)
             local g = {}
             if this_x == (num_x - 1)
             then
             local g = {}
             if this_x == (num_x - 1)
             then
-                g.width = wa.width - (num_x - 1) * width
+                g.width = wa.width - (num_x - 1) * width - useless_gap
             else
             else
-                g.width = width
+                g.width = width - useless_gap
             end
             if this_y == (num_y - 1)
             then
             end
             if this_y == (num_y - 1)
             then
-                g.height = wa.height - (num_y - 1) * height
+                g.height = wa.height - (num_y - 1) * height - useless_gap
             else
             else
-                g.height = height
+                g.height = height - useless_gap
             end
 
             end
 
-            g.x = wa.x + this_x * width
-            g.y = wa.y + this_y * height
+            g.x = wa.x + this_x * width + global_border
+            g.y = wa.y + this_y * height + global_border
 
             if useless_gap > 0
             then
 
             if useless_gap > 0
             then
-                -- Top and left clients are shrinked by two steps and
-                -- get moved away from the border. Other clients just
-                -- get shrinked in one direction.
-                
-                gap_factor = (useless_gap / 100) * 2
-
-                if this_x == 0
-                then
-                    g.width = g.width - (2 + gap_factor) * useless_gap
-                    g.x = g.x + useless_gap
-                else
-                    g.width = g.width - (1 + gap_factor) * useless_gap
-                end
+                -- All clients tile evenly.
+                g.x = g.x + (useless_gap / 2)
+                g.y = g.y + (useless_gap / 2)
 
 
-                if this_y == 0
-                then
-                    g.height = g.height - (2 + gap_factor) * useless_gap
-                    g.y = g.y + useless_gap
-                else
-                    g.height = g.height - (1 + gap_factor) * useless_gap
-                end
             end
             c:geometry(g)
             remaining_clients = remaining_clients - 1
             end
             c:geometry(g)
             remaining_clients = remaining_clients - 1
index 6aa6666bd85e777efb4a56885fb6f2516e48ddd6..6a386c39c69963835d7e102310be4b1878f99b95 100644 (file)
@@ -2,6 +2,7 @@
 --[[
                                                   
      Licensed under GNU General Public License v2 
 --[[
                                                   
      Licensed under GNU General Public License v2 
+      * (c) 2014,      projektile                 
       * (c) 2013,      Luke Bonham                
       * (c) 2012,      Josh Komoroske             
       * (c) 2010-2012, Peter Hofmann              
       * (c) 2013,      Luke Bonham                
       * (c) 2012,      Josh Komoroske             
       * (c) 2010-2012, Peter Hofmann              
@@ -19,10 +20,23 @@ local function fair(p, orientation)
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
+    if useless_gap < 0 then useless_gap = 0 end
 
 
+    -- A global border can be defined with
+    -- beautiful.global_border_width.
+    local global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- Themes border width requires an offset.
+    local bw = tonumber(beautiful.border_width) or 0
+
+    -- get our orientation right.
     local wa = p.workarea
     local cls = p.clients
 
     local wa = p.workarea
     local cls = p.clients
 
+    wa.height = wa.height - ((global_border * 2) + (bw * 2))
+    wa.width = wa.width - ((global_border * 2) + (bw * 2))
+
     if #cls > 0 then
         local cells = math.ceil(math.sqrt(#cls))
         local strips = math.ceil(#cls / cells)
     if #cls > 0 then
         local cells = math.ceil(math.sqrt(#cls))
         local strips = math.ceil(#cls / cells)
@@ -47,8 +61,8 @@ local function fair(p, orientation)
                 this_x = cell
                 this_y = strip
 
                 this_x = cell
                 this_y = strip
 
-                g.x = wa.x + cell * g.width
-                g.y = wa.y + strip * g.height
+                g.x = wa.x + cell * g.width + global_border
+                g.y = wa.y + strip * g.height + global_border
 
             else
                 if #cls < (strips * cells) and strip == strips - 1 then
 
             else
                 if #cls < (strips * cells) and strip == strips - 1 then
@@ -61,34 +75,20 @@ local function fair(p, orientation)
                 this_x = strip
                 this_y = cell
 
                 this_x = strip
                 this_y = cell
 
-                g.x = wa.x + strip * g.width
-                g.y = wa.y + cell * g.height
+                g.x = wa.x + strip * g.width + global_border
+                g.y = wa.y + cell * g.height + global_border
+
             end
 
             -- Useless gap.
             if useless_gap > 0
             then
             end
 
             -- Useless gap.
             if useless_gap > 0
             then
-                -- Top and left clients are shrinked by two steps and
-                -- get moved away from the border. Other clients just
-                -- get shrinked in one direction.
-
-                gap_factor = (useless_gap / 100) * 2
+                -- All clients tile evenly.
+                g.width = g.width - useless_gap
+                g.x = g.x + (useless_gap / 2)
+                g.height = g.height - useless_gap
+                g.y = g.y + (useless_gap / 2)
 
 
-                if this_x == 0
-                then
-                    g.width = g.width - (2 + gap_factor) * useless_gap
-                    g.x = g.x + useless_gap
-                else
-                    g.width = g.width - (1 + gap_factor) * useless_gap
-                end
-
-                if this_y == 0
-                then
-                    g.height = g.height - (2 + gap_factor) * useless_gap
-                    g.y = g.y + useless_gap
-                else
-                    g.height = g.height - (1 + gap_factor) * useless_gap
-                end
             end
             -- End of useless gap.
 
             end
             -- End of useless gap.
 
index 3164c7597ea9d2d0a003a5361d125d8b9b450c02..7c72912d51a56a66386d401bab5fb65a9ecea1d8 100644 (file)
@@ -2,7 +2,8 @@
 --[[
                                                   
      Licensed under GNU General Public License v2 
 --[[
                                                   
      Licensed under GNU General Public License v2 
-      * (c) 2013,      Luke Bonham                
+      * (c) 2014       projektile                 
+      * (c) 2013       Luke Bonham                
       * (c) 2009       Uli Schlachter             
       * (c) 2008       Julien Danjolu             
                                                   
       * (c) 2009       Uli Schlachter             
       * (c) 2008       Julien Danjolu             
                                                   
@@ -11,6 +12,8 @@
 local beautiful = require("beautiful")
 local ipairs    = ipairs
 local tonumber  = tonumber
 local beautiful = require("beautiful")
 local ipairs    = ipairs
 local tonumber  = tonumber
+local math      = require("math")
+local naughty   = require("naughty")
 
 local uselesspiral = {}
 
 
 local uselesspiral = {}
 
@@ -18,19 +21,32 @@ local function spiral(p, spiral)
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width.
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
+    if useless_gap < 0 then useless_gap = 0 end
 
 
+    -- A global border can be defined with
+    -- beautiful.global_border_width
+    local global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- Themes border width requires an offset
+    local bw = tonumber(beautiful.border_width) or 0
+
+    -- get our orientation right
     local wa = p.workarea
     local cls = p.clients
     local wa = p.workarea
     local cls = p.clients
-    local n = #cls
+    local n = #cls -- number of windows total; k = which window number
+
+    wa.height = wa.height - ((global_border * 2) + (bw * 2))
+    wa.width = wa.width - ((global_border * 2) + (bw * 2))
 
     local static_wa = wa
 
     for k, c in ipairs(cls) do
         if k < n then
             if k % 2 == 0 then
 
     local static_wa = wa
 
     for k, c in ipairs(cls) do
         if k < n then
             if k % 2 == 0 then
-                wa.height = wa.height / 2
+                wa.height = (wa.height / 2)
             else
             else
-                wa.width = wa.width / 2
+                wa.width = (wa.width / 2)
             end
         end
 
             end
         end
 
@@ -49,10 +65,10 @@ local function spiral(p, spiral)
         end
 
             local wa2 = {}
         end
 
             local wa2 = {}
-            wa2.x = wa.x
-            wa2.y = wa.y
-            wa2.height = wa.height
-            wa2.width = wa.width
+            wa2.x = wa.x + (useless_gap / 2) + global_border
+            wa2.y = wa.y + (useless_gap / 2) + global_border
+            wa2.height = wa.height - (useless_gap / 2)
+            wa2.width = wa.width - (useless_gap / 2)
 
         -- Useless gap.
         if useless_gap > 0
 
         -- Useless gap.
         if useless_gap > 0
@@ -64,8 +80,6 @@ local function spiral(p, spiral)
             top = false
             left = false
 
             top = false
             left = false
 
-            gap_factor = (useless_gap / 100) * 2
-
             if wa2.y == static_wa.y then
                top = true
             end
             if wa2.y == static_wa.y then
                top = true
             end
@@ -75,17 +89,17 @@ local function spiral(p, spiral)
             end
 
             if top then
             end
 
             if top then
-                wa2.height = wa2.height - (2 + gap_factor) * useless_gap
-                wa2.y = wa2.y + useless_gap
+                wa2.height = wa2.height - useless_gap
+                wa2.y = wa2.y - (useless_gap / 2)
             else
             else
-                wa2.height = wa2.height - (1 + gap_factor) * useless_gap
+                wa2.height = wa2.height - (useless_gap / 2)
             end
 
             if left then
             end
 
             if left then
-                wa2.width = wa2.width - (2 + gap_factor) * useless_gap
-                wa2.x = wa2.x + useless_gap
+                wa2.width = wa2.width - useless_gap
+                wa2.x = wa2.x - (useless_gap / 2)
             else
             else
-                wa2.width = wa2.width - (1 + gap_factor) * useless_gap
+                wa2.width = wa2.width - (useless_gap / 2)
             end
         end
         -- End of useless gap.
             end
         end
         -- End of useless gap.
index e4965009d4890459012f0d73edb41d2963d2a0cf..47aa4a443ebcd6695b2d76bdcce94c8a903346a2 100644 (file)
@@ -2,12 +2,14 @@
 --[[
                                                   
      Licensed under GNU General Public License v2 
 --[[
                                                   
      Licensed under GNU General Public License v2 
-      * (c) 2013,      Luke Bonham                
+      * (c) 2014       projektile                 
+      * (c) 2013       Luke Bonham                
       * (c) 2009       Donald Ephraim Curtis      
       * (c) 2008       Julien Danjolu             
                                                   
 --]]
 
       * (c) 2009       Donald Ephraim Curtis      
       * (c) 2008       Julien Danjolu             
                                                   
 --]]
 
+local naughty = require("naughty")
 local tag       = require("awful.tag")
 local beautiful = require("beautiful")
 local ipairs    = ipairs
 local tag       = require("awful.tag")
 local beautiful = require("beautiful")
 local ipairs    = ipairs
@@ -22,6 +24,14 @@ local function tile_group(cls, wa, orientation, fact, group)
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width .
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
     -- A useless gap (like the dwm patch) can be defined with
     -- beautiful.useless_gap_width .
     local useless_gap = tonumber(beautiful.useless_gap_width) or 0
+    if useless_gap < 0 then useless_gap = 0 end
+
+    -- A global border can be defined with
+    -- beautiful.global_border_width
+    global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
+    -- BW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
 
     -- get our orientation right
     local height = "height"
 
     -- get our orientation right
     local height = "height"
@@ -36,7 +46,8 @@ local function tile_group(cls, wa, orientation, fact, group)
     end
 
     -- make this more generic (not just width)
     end
 
     -- make this more generic (not just width)
-    available = wa[width] - (group.coord - wa[x])
+    --if for top
+    available = wa[width] - (group.coord - wa[x]) -- it's truly not here
 
     -- find our total values
     local total_fact = 0
 
     -- find our total values
     local total_fact = 0
@@ -58,20 +69,19 @@ local function tile_group(cls, wa, orientation, fact, group)
         end
         total_fact = total_fact + fact[i]
     end
         end
         total_fact = total_fact + fact[i]
     end
-    size = math.min(size, available)
-
+    size = math.min(size, (available - global_border))
     local coord = wa[y]
     local geom = {}
     local used_size = 0
     local coord = wa[y]
     local geom = {}
     local used_size = 0
-    local unused = wa[height]
+    local unused = wa[height] - (global_border * 2)
     local stat_coord = wa[x]
     --stat_coord = size
     for c = group.first,group.last do
         local i = c - group.first +1
     local stat_coord = wa[x]
     --stat_coord = size
     for c = group.first,group.last do
         local i = c - group.first +1
-        geom[width] = size
+        geom[width] = size - global_border
         geom[height] = math.floor(unused * fact[i] / total_fact)
         geom[height] = math.floor(unused * fact[i] / total_fact)
-        geom[x] = group.coord
-        geom[y] = coord
+        geom[x] = group.coord + global_border + (useless_gap / 2)
+        geom[y] = coord + global_border + (useless_gap / 2)
 
         coord = coord + geom[height]
         unused = unused - geom[height]
 
         coord = coord + geom[height]
         unused = unused - geom[height]
@@ -88,8 +98,6 @@ local function tile_group(cls, wa, orientation, fact, group)
             top = false
             left = false
 
             top = false
             left = false
 
-            gap_factor = (useless_gap / 100) * 2
-
             if geom[y] == wa[y] then
                 top = true
             end
             if geom[y] == wa[y] then
                 top = true
             end
@@ -99,17 +107,17 @@ local function tile_group(cls, wa, orientation, fact, group)
             end
 
             if top then
             end
 
             if top then
-                geom[height] = geom[height] - (2 + gap_factor) * useless_gap
+                geom[height] = geom[height] - (2 * useless_gap)
                 geom[y] = geom[y] + useless_gap
             else
                 geom[y] = geom[y] + useless_gap
             else
-                geom[height] = geom[height] - (1 + gap_factor) * useless_gap 
+                geom[height] = geom[height] - useless_gap
             end
 
             if left then
             end
 
             if left then
-                geom[width] = geom[width] - (2 + gap_factor) * useless_gap
+                geom[width] = geom[width] - (2 * useless_gap)
                 geom[x] = geom[x] + useless_gap
             else
                 geom[x] = geom[x] + useless_gap
             else
-                geom[width] = geom[width] - (1 + gap_factor) * useless_gap
+                geom[width] = geom[width] - useless_gap
             end
         end
         -- End of useless gap.
             end
         end
         -- End of useless gap.
@@ -136,6 +144,11 @@ local function tile(param, orientation)
         y = "x"
     end
 
         y = "x"
     end
 
+    -- A global border can be defined with
+    -- beautiful.global_border_width
+    global_border = tonumber(beautiful.global_border_width) or 0
+    if global_border < 0 then global_border = 0 end
+
     local cls = param.clients
     local nmaster = math.min(tag.getnmaster(t), #cls)
     local nother = math.max(#cls - nmaster,0)
     local cls = param.clients
     local nmaster = math.min(tag.getnmaster(t), #cls)
     local nother = math.max(#cls - nmaster,0)
@@ -181,7 +194,7 @@ local function tile(param, orientation)
             end
             for i = 1,ncol do
                 -- Try to get equal width among remaining columns
             end
             for i = 1,ncol do
                 -- Try to get equal width among remaining columns
-                local size = math.min( (wasize - (coord - wa[x])) / (ncol - i + 1) )
+                local size = math.min((wasize - (coord - wa[x]))  / (ncol - i + 1)) --+ (global_border/(ncol))/(ncol+i^2)
                 local first = last + 1
                 last = last + math.floor((#cls - last)/(ncol - i + 1))
                 -- tile the column and update our current x coordinate
                 local first = last + 1
                 last = last + math.floor((#cls - last)/(ncol - i + 1))
                 -- tile the column and update our current x coordinate
@@ -228,3 +241,4 @@ uselesstile.arrange = uselesstile.right.arrange
 uselesstile.name = uselesstile.right.name
 
 return uselesstile
 uselesstile.name = uselesstile.right.name
 
 return uselesstile
+