Merge branch 'projektile-master'

This commit is contained in:
luke bonham 2014-09-26 12:38:22 +02:00
commit 1ed42223a2
9 changed files with 201 additions and 126 deletions

View File

@ -2,12 +2,14 @@
--[[
Licensed under GNU General Public License v2
* (c) 2014, projektile
* (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 =
{
@ -21,10 +23,23 @@ function cascade.arrange(p)
-- 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
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

View File

@ -2,6 +2,7 @@
--[[
Licensed under GNU General Public License v2
* (c) 2014, projektile
* (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...
--
-- (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
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
-- 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
@ -108,8 +120,8 @@ function cascadetile.arrange(p)
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
@ -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.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

View 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")
@ -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
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
-- 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)
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)
@ -61,24 +77,24 @@ function centerfair.arrange(p)
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
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!
local offset_x = wa.x
local offset_x = wa.x
if useless_gap > 0 then
offset_x = offset_x
offset_x = offset_x
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.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
@ -128,8 +144,8 @@ function centerfair.arrange(p)
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

View File

@ -2,6 +2,7 @@
--[[
Licensed under GNU General Public License v2
* (c) 2014, projektile
* (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
-- 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
-- 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)
@ -37,7 +50,7 @@ function centerwork.arrange(p)
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
@ -48,8 +61,8 @@ function centerwork.arrange(p)
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)
@ -57,7 +70,7 @@ function centerwork.arrange(p)
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
@ -73,29 +86,29 @@ function centerwork.arrange(p)
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.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.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.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

View File

@ -2,6 +2,7 @@
--[[
Licensed under GNU General Public License v2
* (c) 2014, projektile
* (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
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
-- 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)
@ -79,43 +93,26 @@ function termfair.arrange(p)
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
g.width = width
g.width = width - useless_gap
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
g.height = height
g.height = height - useless_gap
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
-- 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.x = g.x + (useless_gap / 2)
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
c:geometry(g)
remaining_clients = remaining_clients - 1

View File

@ -2,6 +2,7 @@
--[[
Licensed under GNU General Public License v2
* (c) 2014, projektile
* (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
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
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)
@ -47,8 +61,8 @@ local function fair(p, orientation)
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
@ -61,34 +75,20 @@ local function fair(p, orientation)
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
-- Top and left clients are shrinked by two steps and
-- get moved away from the border. Other clients just
-- get shrinked in one direction.
-- 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)
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
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.

View File

@ -2,7 +2,8 @@
--[[
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
@ -11,6 +12,7 @@
local beautiful = require("beautiful")
local ipairs = ipairs
local tonumber = tonumber
local math = require("math")
local uselesspiral = {}
@ -18,19 +20,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
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 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
wa.height = wa.height / 2
wa.height = (wa.height / 2)
else
wa.width = wa.width / 2
wa.width = (wa.width / 2)
end
end
@ -49,10 +64,10 @@ local function spiral(p, spiral)
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
@ -64,8 +79,6 @@ local function spiral(p, spiral)
top = false
left = false
gap_factor = (useless_gap / 100) * 2
if wa2.y == static_wa.y then
top = true
end
@ -75,17 +88,17 @@ local function spiral(p, spiral)
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
wa2.height = wa2.height - (1 + gap_factor) * useless_gap
wa2.height = wa2.height - (useless_gap / 2)
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
wa2.width = wa2.width - (1 + gap_factor) * useless_gap
wa2.width = wa2.width - (useless_gap / 2)
end
end
-- End of useless gap.

View File

@ -2,7 +2,8 @@
--[[
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
@ -22,6 +23,15 @@ 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
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 height = "height"
@ -36,7 +46,8 @@ local function tile_group(cls, wa, orientation, fact, group)
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
@ -58,20 +69,19 @@ local function tile_group(cls, wa, orientation, fact, group)
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 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
geom[width] = size
geom[height] = math.floor(unused * fact[i] / total_fact)
geom[x] = group.coord
geom[y] = coord
geom[width] = size - global_border - (bw * 2)
geom[height] = math.floor(unused * fact[i] / total_fact) - (bw * 2)
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]
@ -88,8 +98,6 @@ local function tile_group(cls, wa, orientation, fact, group)
top = false
left = false
gap_factor = (useless_gap / 100) * 2
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
geom[height] = geom[height] - (2 + gap_factor) * useless_gap
geom[height] = geom[height] - (2 * useless_gap)
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
geom[width] = geom[width] - (2 + gap_factor) * useless_gap
geom[width] = geom[width] - (2 * useless_gap)
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.
@ -181,7 +189,7 @@ local function tile(param, orientation)
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
@ -228,3 +236,4 @@ uselesstile.arrange = uselesstile.right.arrange
uselesstile.name = uselesstile.right.name
return uselesstile

View File

@ -23,14 +23,14 @@ local alsa = {}
local function worker(args)
local args = args or {}
local timeout = args.timeout or 5
local channel = args.channel or "Master"
local channel = args.channel or "Master -c 1"
local settings = args.settings or function() end
alsa.widget = wibox.widget.textbox('')
function alsa.update()
local f = assert(io.popen('amixer -M get ' .. channel))
local mixer = f:read("*a")
local f = assert(io.popen('amixer get ' .. channel))
local mixer = f:read("*all")
f:close()
volume_now = {}