inital commit of clone of old repo

This commit is contained in:
Contegix Support
2015-04-12 18:06:28 -05:00
parent 5529249e29
commit 77e1a1340d
3071 changed files with 157540 additions and 4 deletions

View File

@ -0,0 +1,156 @@
---------------------------------------------------------------------------
-- @author Julien Danjou <julien@danjou.info>
-- @copyright 2008 Julien Danjou
-- @release v3.4.10
---------------------------------------------------------------------------
-- Grab environment we need
local ipairs = ipairs
local type = type
local capi = { screen = screen, client = client }
local tag = require("awful.tag")
local util = require("awful.util")
local suit = require("awful.layout.suit")
local ascreen = require("awful.screen")
local capi = {
screen = screen,
awesome = awesome,
client = client
}
local client = require("awful.client")
--- Layout module for awful
module("awful.layout")
-- This is a special lock used by the arrange function.
-- This avoids recurring call by emitted signals.
local arrange_lock = false
--- Get the current layout.
-- @param screen The screen number.
-- @return The layout function.
function get(screen)
local t = tag.selected(screen)
return tag.getproperty(t, "layout") or suit.floating
end
--- Change the layout of the current tag.
-- @param layouts A table of layouts.
-- @param i Relative index.
function inc(layouts, i)
local t = tag.selected()
if t then
local curlayout = get()
local curindex
local rev_layouts = {}
for k, v in ipairs(layouts) do
if v == curlayout then
curindex = k
break
end
end
if curindex then
local newindex = util.cycle(#layouts, curindex + i)
set(layouts[newindex])
end
end
end
--- Set the layout function of the current tag.
-- @param layout Layout name.
function set(layout, t)
t = t or tag.selected()
tag.setproperty(t, "layout", layout)
end
--- Arrange a screen using its current layout.
-- @param screen The screen to arrange.
function arrange(screen)
if arrange_lock then return end
arrange_lock = true
local p = {}
p.workarea = capi.screen[screen].workarea
-- Handle padding
local padding = ascreen.padding(capi.screen[screen])
if padding then
p.workarea.x = p.workarea.x + (padding.left or 0)
p.workarea.y = p.workarea.y + (padding.top or 0)
p.workarea.width = p.workarea.width - ((padding.left or 0 ) + (padding.right or 0))
p.workarea.height = p.workarea.height - ((padding.top or 0) + (padding.bottom or 0))
end
p.geometry = capi.screen[screen].geometry
p.clients = client.tiled(screen)
p.screen = screen
get(screen).arrange(p)
capi.screen[screen]:emit_signal("arrange")
arrange_lock = false
end
--- Get the current layout name.
-- @param layout The layout.
-- @return The layout name.
function getname(layout)
local layout = layout or get()
return layout.name
end
local function arrange_prop(obj) arrange(obj.screen) end
capi.client.add_signal("new", function(c)
c:add_signal("property::size_hints_honor", arrange_prop)
c:add_signal("property::struts", arrange_prop)
c:add_signal("property::minimized", arrange_prop)
c:add_signal("property::sticky", arrange_prop)
c:add_signal("property::fullscreen", arrange_prop)
c:add_signal("property::maximized_horizontal", arrange_prop)
c:add_signal("property::maximized_vertical", arrange_prop)
c:add_signal("property::border_width", arrange_prop)
c:add_signal("property::hidden", arrange_prop)
c:add_signal("property::titlebar", arrange_prop)
c:add_signal("property::floating", arrange_prop)
c:add_signal("property::geometry", arrange_prop)
-- If prop is screen, we do not know what was the previous screen, so
-- let's arrange all screens :-(
c:add_signal("property::screen", function(c)
for screen = 1, capi.screen.count() do arrange(screen) end end)
end)
local function arrange_on_tagged(c, tag)
if not tag.screen then return end
arrange(tag.screen)
if not capi.client.focus or not capi.client.focus:isvisible() then
local c = client.focus.history.get(tag.screen, 0)
if c then capi.client.focus = c end
end
end
for s = 1, capi.screen.count() do
tag.attached_add_signal(s, "property::mwfact", arrange_prop)
tag.attached_add_signal(s, "property::nmaster", arrange_prop)
tag.attached_add_signal(s, "property::ncol", arrange_prop)
tag.attached_add_signal(s, "property::layout", arrange_prop)
tag.attached_add_signal(s, "property::windowfact", arrange_prop)
tag.attached_add_signal(s, "property::selected", arrange_prop)
tag.attached_add_signal(s, "tagged", arrange_prop)
capi.screen[s]:add_signal("property::workarea", function(screen)
arrange(screen.index)
end)
capi.screen[s]:add_signal("tag::attach", function (screen, tag)
arrange(screen.index)
end)
capi.screen[s]:add_signal("tag::detach", function (screen, tag)
arrange(screen.index)
end)
capi.screen[s]:add_signal("padding", function (screen)
arrange(screen.index)
end)
end
capi.client.add_signal("focus", function(c) arrange(c.screen) end)
capi.client.add_signal("list", function()
for screen = 1, capi.screen.count() do
arrange(screen)
end
end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -0,0 +1,74 @@
---------------------------------------------------------------------------
-- @author Julien Danjou <julien@danjou.info>
-- @copyright 2008 Julien Danjou
-- @release v3.4.10
---------------------------------------------------------------------------
-- Grab environment we need
local ipairs = ipairs
local math = math
--- Fair layouts module for awful
module("awful.layout.suit.fair")
local function fair(p, orientation)
local wa = p.workarea
local cls = p.clients
if #cls > 0 then
local cells = math.ceil(math.sqrt(#cls))
local strips = math.ceil(#cls / cells)
local cell = 0
local strip = 0
for k, c in ipairs(cls) do
local g = {}
if ( orientation == "east" and #cls > 2 )
or ( orientation == "south" and #cls <= 2 ) then
if #cls < (strips * cells) and strip == strips - 1 then
g.width = wa.width / (cells - ((strips * cells) - #cls))
else
g.width = wa.width / cells
end
g.height = wa.height / strips
g.x = wa.x + cell * g.width
g.y = wa.y + strip * g.height
else
if #cls < (strips * cells) and strip == strips - 1 then
g.height = wa.height / (cells - ((strips * cells) - #cls))
else
g.height = wa.height / cells
end
g.width = wa.width / strips
g.x = wa.x + strip * g.width
g.y = wa.y + cell * g.height
end
c:geometry(g)
cell = cell + 1
if cell == cells then
cell = 0
strip = strip + 1
end
end
end
end
--- Horizontal fair layout.
-- @param screen The screen to arrange.
horizontal = {}
horizontal.name = "fairh"
function horizontal.arrange(p)
return fair(p, "east")
end
-- Vertical fair layout.
-- @param screen The screen to arrange.
name = "fairv"
function arrange(p)
return fair(p, "south")
end

View File

@ -0,0 +1,13 @@
---------------------------------------------------------------------------
-- @author Gregor Best
-- @copyright 2008 Gregor Best
-- @release v3.4.10
---------------------------------------------------------------------------
--- Dummy function for floating layout
module("awful.layout.suit.floating")
function arrange()
end
name = "floating"

View File

@ -0,0 +1,9 @@
require("awful.layout.suit.max")
require("awful.layout.suit.tile")
require("awful.layout.suit.fair")
require("awful.layout.suit.floating")
require("awful.layout.suit.magnifier")
require("awful.layout.suit.spiral")
--- Suits for awful
module("awful.layout.suit")

View File

@ -0,0 +1,92 @@
---------------------------------------------------------------------------
-- @author Julien Danjou &lt;julien@danjou.info&gt;
-- @copyright 2008 Julien Danjou
-- @release v3.4.10
---------------------------------------------------------------------------
-- Grab environment we need
local ipairs = ipairs
local math = math
local tag = require("awful.tag")
local capi =
{
client = client,
screen = screen
}
local client = require("awful.client")
--- Magnifier layout module for awful
module("awful.layout.suit.magnifier")
function arrange(p)
-- Fullscreen?
local area = p.workarea
local cls = p.clients
local focus = capi.client.focus
local mwfact = tag.getmwfact(tag.selected(p.screen))
local fidx
-- Check that the focused window is on the right screen
if focus and focus.screen ~= p.screen then focus = nil end
if not focus and #cls > 0 then
focus = cls[1]
fidx = 1
end
-- If focused window is not tiled, take the first one which is tiled.
if client.floating.get(focus) then
focus = cls[1]
fidx = 1
end
-- Abort if no clients are present
if not focus then return end
local geometry = {}
if #cls > 1 then
geometry.width = area.width * math.sqrt(mwfact)
geometry.height = area.height * math.sqrt(mwfact)
geometry.x = area.x + (area.width - geometry.width) / 2
geometry.y = area.y + (area.height - geometry.height) /2
else
geometry.x = area.x
geometry.y = area.y
geometry.width = area.width
geometry.height = area.height
end
focus:geometry(geometry)
focus:raise()
if #cls > 1 then
geometry.x = area.x
geometry.y = area.y
geometry.height = area.height / (#cls - 1)
geometry.width = area.width
-- We don't know what the focus window index. Try to find it.
if not fidx then
for k, c in ipairs(cls) do
if c == focus then
fidx = k
break
end
end
end
-- First move clients that are before focused client.
for k = fidx + 1, #cls do
cls[k]:geometry(geometry)
geometry.y = geometry.y + geometry.height
end
-- Then move clients that are after focused client.
-- So the next focused window will be the one at the top of the screen.
for k = 1, fidx - 1 do
cls[k]:geometry(geometry)
geometry.y = geometry.y + geometry.height
end
end
end
name = "magnifier"

View File

@ -0,0 +1,41 @@
---------------------------------------------------------------------------
-- @author Julien Danjou &lt;julien@danjou.info&gt;
-- @copyright 2008 Julien Danjou
-- @release v3.4.10
---------------------------------------------------------------------------
-- Grab environment we need
local pairs = pairs
local client = require("awful.client")
--- Maximized and fullscreen layouts module for awful
module("awful.layout.suit.max")
local function fmax(p, fs)
-- Fullscreen?
local area
if fs then
area = p.geometry
else
area = p.workarea
end
for k, c in pairs(p.clients) do
c:geometry(area)
end
end
--- Maximized layout.
-- @param screen The screen to arrange.
name = "max"
function arrange(p)
return fmax(p, false)
end
--- Fullscreen layout.
-- @param screen The screen to arrange.
fullscreen = {}
fullscreen.name = "fullscreen"
function fullscreen.arrange(p)
return fmax(p, true)
end

View File

@ -0,0 +1,58 @@
---------------------------------------------------------------------------
-- @author Uli Schlachter &lt;psychon@znc.in&gt;
-- @copyright 2009 Uli Schlachter
-- @copyright 2008 Julien Danjou
-- @release v3.4.10
---------------------------------------------------------------------------
-- Grab environment we need
local ipairs = ipairs
module("awful.layout.suit.spiral")
local function spiral(p, spiral)
local wa = p.workarea
local cls = p.clients
local n = #cls
for k, c in ipairs(cls) do
if k < n then
if k % 2 == 0 then
wa.height = wa.height / 2
else
wa.width = wa.width / 2
end
end
if k % 4 == 0 and spiral then
wa.x = wa.x - wa.width
elseif k % 2 == 0 or
(k % 4 == 3 and k < n and spiral) then
wa.x = wa.x + wa.width
end
if k % 4 == 1 and k ~= 1 and spiral then
wa.y = wa.y - wa.height
elseif k % 2 == 1 and k ~= 1 or
(k % 4 == 0 and k < n and spiral) then
wa.y = wa.y + wa.height
end
c:geometry(wa)
end
end
--- Dwindle layout
dwindle = {}
dwindle.name = "dwindle"
function dwindle.arrange(p)
return spiral(p, false)
end
--- Spiral layout
name = "spiral"
function arrange(p)
return spiral(p, true)
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -0,0 +1,180 @@
---------------------------------------------------------------------------
-- @author Donald Ephraim Curtis &lt;dcurtis@cs.uiowa.edu&gt;
-- @author Julien Danjou &lt;julien@danjou.info&gt;
-- @copyright 2009 Donald Ephraim Curtis
-- @copyright 2008 Julien Danjou
-- @release v3.4.10
---------------------------------------------------------------------------
-- Grab environment we need
local ipairs = ipairs
local math = math
local tag = require("awful.tag")
--- Tiled layouts module for awful
module("awful.layout.suit.tile")
local function tile_group(cls, wa, orientation, fact, group)
-- get our orientation right
local height = "height"
local width = "width"
local x = "x"
local y = "y"
if orientation == "top" or orientation == "bottom" then
height = "width"
width = "height"
x = "y"
y = "x"
end
-- make this more generic (not just width)
available = wa[width] - (group.coord - wa[x])
-- find our total values
local total_fact = 0
local min_fact = 1
local size = group.size
for c = group.first,group.last do
-- determine the width/height based on the size_hint
local i = c - group.first +1
local size_hints = cls[c].size_hints
local size_hint = size_hints["min_"..width] or size_hints["base_"..width] or 0
size_hint = size_hint + cls[c].border_width*2
size = math.max(size_hint, size)
-- calculate the height
if not fact[i] then
fact[i] = min_fact
else
min_fact = math.min(fact[i],min_fact)
end
total_fact = total_fact + fact[i]
end
size = math.min(size, available)
local coord = wa[y]
local geom = {}
local used_size = 0
local unused = wa[height]
for c = group.first,group.last do
local i = c - group.first +1
geom[width] = size
geom[height] = math.floor(unused * fact[i] / total_fact)
geom[x] = group.coord
geom[y] = coord
geom = cls[c]:geometry(geom)
coord = coord + geom[height]
unused = unused - geom[height]
total_fact = total_fact - fact[i]
used_size = math.max(used_size, geom[width])
end
return used_size
end
local function tile(param, orientation)
local t = tag.selected(param.screen)
orientation = orientation or "right"
-- this handles are different orientations
local height = "height"
local width = "width"
local x = "x"
local y = "y"
if orientation == "top" or orientation == "bottom" then
height = "width"
width = "height"
x = "y"
y = "x"
end
local cls = param.clients
local nmaster = math.min(tag.getnmaster(t), #cls)
local nother = math.max(#cls - nmaster,0)
local mwfact = tag.getmwfact(t)
local wa = param.workarea
local ncol = tag.getncol(t)
local data = tag.getdata(t).windowfact
if not data then
data = {}
tag.getdata(t).windowfact = data
end
local coord = wa[x]
local place_master = true
if orientation == "left" or orientation == "top" then
-- if we are on the left or top we need to render the other windows first
place_master = false
end
-- this was easier than writing functions because there is a lot of data we need
for d = 1,2 do
if place_master and nmaster > 0 then
local size = wa[width]
if nother > 0 then
size = math.min(wa[width] * mwfact, wa[width] - (coord - wa[x]))
end
if not data[0] then
data[0] = {}
end
coord = coord + tile_group(cls, wa, orientation, data[0], {first=1, last=nmaster, coord = coord, size = size})
end
if not place_master and nother > 0 then
local last = nmaster
-- we have to modify the work area size to consider left and top views
local wasize = wa[width]
if nmaster > 0 and (orientation == "left" or orientation == "top") then
wasize = wa[width] - wa[width]*mwfact
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 first = last + 1
last = last + math.floor((#cls - last)/(ncol - i + 1))
-- tile the column and update our current x coordinate
if not data[i] then
data[i] = {}
end
coord = coord + tile_group(cls, wa, orientation, data[i], { first = first, last = last, coord = coord, size = size })
end
end
place_master = not place_master
end
end
right = {}
right.name = "tile"
right.arrange = tile
--- The main tile algo, on left.
-- @param screen The screen number to tile.
left = {}
left.name = "tileleft"
function left.arrange(p)
return tile(p, "left")
end
--- The main tile algo, on bottom.
-- @param screen The screen number to tile.
bottom = {}
bottom.name = "tilebottom"
function bottom.arrange(p)
return tile(p, "bottom")
end
--- The main tile algo, on top.
-- @param screen The screen number to tile.
top = {}
top.name = "tiletop"
function top.arrange(p)
return tile(p, "top")
end
arrange = right.arrange
name = right.name