--[[
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 =
{
-- 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
--[[
Licensed under GNU General Public License v2
+ * (c) 2014, projektile
* (c) 2013, Luke Bonham
* (c) 2010-2012, Peter Hofmann
-- 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
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
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
--[[
-
- 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")
-- 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)
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
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
--[[
Licensed under GNU General Public License v2
+ * (c) 2014, projektile
* (c) 2013, Luke Bonham
* (c) 2010-2012, Peter Hofmann
-- 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)
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
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)
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
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
--[[
Licensed under GNU General Public License v2
+ * (c) 2014, projektile
* (c) 2013, Luke Bonham
* (c) 2010-2012, Peter Hofmann
-- 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)
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
-
- 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
--[[
Licensed under GNU General Public License v2
+ * (c) 2014, projektile
* (c) 2013, Luke Bonham
* (c) 2012, Josh Komoroske
* (c) 2010-2012, Peter Hofmann
-- 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)
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
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.
-
- 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.
--[[
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
local beautiful = require("beautiful")
local ipairs = ipairs
local tonumber = tonumber
+local math = require("math")
local uselesspiral = {}
-- 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
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
top = false
left = false
- gap_factor = (useless_gap / 100) * 2
-
if wa2.y == static_wa.y then
top = true
end
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.
--[[
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
-- 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"
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
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]
top = false
left = false
- gap_factor = (useless_gap / 100) * 2
-
if geom[y] == wa[y] then
top = true
end
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.
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
uselesstile.name = uselesstile.right.name
return uselesstile
+
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 = {}