Permalink
Browse files

Improve decoration subsystem

  • Loading branch information...
1 parent 2aa6ca0 commit 617185cfac429f61c76c58d0698cb12727a15554 @Elv13 committed Jun 4, 2012
View
@@ -167,8 +167,10 @@ end
function save()
local f = io.open(util.getdir("config") .. "/serialized.lua",'w')
- f:write("return " .. serialise(data2).." \n")
- f:close()
+ if f then
+ f:write("return " .. serialise(data2).." \n")
+ f:close()
+ end
end
function load()
View
@@ -36,26 +36,28 @@ return {
kill = {
},
- keys = {
+ float = {
},
- float = {
+ keys = {
},
- dockable = {
+ minimized = {
},
- maximized = {
- Dolphin = true,
+ slave = {
},
- honorsizehints = {
+ below = {
+ Dolphin = true,
+ Kate = true,
},
- minimized = {
+ maximized = {
+ Dolphin = true,
},
- onTop = {
+ titlebar = {
},
struts = {
@@ -65,13 +67,12 @@ return {
},
ontop = {
- Kruler = true,
},
- run = {
+ hidden = {
},
- titlebar = {
+ run = {
},
above = {
@@ -81,18 +82,16 @@ return {
border_width = {
},
- hidden = {
+ onTop = {
},
- below = {
- Dolphin = true,
- Kate = true,
+ honorsizehints = {
},
skip_taskbar = {
},
- slave = {
+ dockable = {
},
sticky = {
@@ -106,15 +105,32 @@ return {
},
},
+ tag = {
+ Imaging = {
+ class = {
+ Kcalc = true,
+
+},
+
+},
+ Game = {
+ class = {
+ Kcalc = true,
+
+},
+
+},
+
+},
},
titlebars = {
},
iconPath = "/home/lepagee/.config/awesome/theme/darkBlue//Icon/",
scr = {
- boo = "test",
irc = 5,
+ boo = "test",
media = 4,
test = {
[12] = {
View
@@ -253,10 +253,10 @@ function new(parent)
end
function data:repaint()
+ private_data["workarea"] = deco:update()
if layout then
layout:update()
end
- deco:update()
end
local function change_visibility(value)
@@ -295,19 +295,25 @@ function new(parent)
title = function(value) title = value; data:emit_signal("title::changed",value) end,
focus = set_focus,
active = set_active,
+ workarea = false,
}
for k,v in pairs({"height", "width","y","x"}) do
set_map[v] = function (value) change_geo(v,value) end
end
local get_map = {
- parent = function() return parent end,
- title = function() return get_title() end,
- focus = function() return focus end,
- active = function() return active_cg end,
- decorations = function() return deco end,
+ parent = function() return parent end,
+ title = function() return get_title() end,
+ focus = function() return focus end,
+ active = function() return active_cg end,
+ decorations = function() return deco end,
+ workarea = function() return private_data["workarea"] end,
}
+ for k,v in pairs({"height", "width","y","x"}) do
+ get_map[v] = function () return (type(private_data[v]) == "function") and private_data[v]() or private_data[v] end
+ end
+
object_model(data,get_map,set_map,private_data,{always_handle = {visible = true},autogen_getmap = true})
return data
end
View
@@ -12,6 +12,7 @@ local function add_decoration(list,cg,wb, args)--{class, position, index, ontop,
if not wb then return end
local deco = args or {}
deco.position = args.position or "top"
+ deco.ontop = args.ontop or false
deco.align = args.align or "ajust"
deco.update_callback = args.update_callback or nil
local wb = (type(wb) == "function") and wb(cg) or wb
@@ -163,39 +164,36 @@ function decoration(cg)
end
local padding = {}
-
+
local ajust_workarea = {
- top = function(wb) return { x= 0 , y= wb.y , width = 0 , height = - wb.height } end,
- bottom = function(wb) return { x= 0 , y= 0 , width = 0 , height = - wb.height } end,
- left = function(wb) return { x= wb.x , y= 0 , width = -wb.width , height = 0 } end,
- right = function(wb) return { x= 0 , y= 0 , width = -wb.width , height = 0 } end,
+ top = function(wb,wa) return { x= wa.x , y= wa.y+wb.height , width = wa.width , height = wa.height - wb.height } end,
+ bottom = function(wb,wa) return { x= wa.x , y= wa.y , width = wa.width , height = wa.height - wb.height } end,
+ left = function(wb,wa) return { x= wa.x+wb.width , y= wa.y , width = wa.width-wb.width , height = wa.height } end,
+ right = function(wb,wa) return { x= wa.x , y= wa.y , width = wa.width-wb.width , height = wa.height } end,
}
function data:update()
local workarea = {width = cg.width, height = cg.height, x = cg.x, y = cg.y}
for k,v in pairs(decolist) do
- print("class",k)
for k2,v2 in ipairs(v) do
if v2.wibox then
- if (k == "edge") then print("here44",v2.wibox,type(v2.wibox),v2.position,v2.wibox.orientation,v2.wibox.height,v2.wibox.width,cg.width)end
- local geo = ajust_pos(v2,cg)
- --v2.wibox:geometry(geo)
+ local geo = ajust_pos(v2,workarea)
for k3,v3 in ipairs({"width","height","x","y"}) do
- print(v3,geo[v3],cg[v3])
if not ((v3 == "width" or v3 == "height") and geo[v3] == 0) then
v2.wibox[v3] = geo[v3] or 2
end
end
- --v2.wibox.visible = cg.visible
- --print("pos:",v2.position,v2.wibox,k2,cg,cg.title,"visible",v2.wibox.visible,"geo",v2.wibox.x,v2.wibox.y,v2.wibox.width,v2.wibox.height)
if type(v2.update_callback) == "function" then
v2.update_callback()
end
end
- workarea = ajust_workarea[v2.position](workarea,v2)
+ if not v2.ontop then
+ workarea = ajust_workarea[v2.position](v2.wibox,workarea)
+ end
end
end
+ return workarea
end
function data:work_area()
View
@@ -32,8 +32,8 @@ local function create_edge(args)
cg2 = function (value) private_data.cg2 = value end,
x = function (value) private_data.x,private_data.wibox.x = value,value end,
y = function (value) private_data.y,private_data.wibox.y = value,value end,
- width = (data.orientation == "horizontal") and function (value) private_data.wibox.width = value end or false,
- height = (data.orientation == "horizontal") and false or function (value) private_data.wibox.height = value end,
+ width = function (value) private_data.wibox.width = value end,
+ height = function (value) private_data.wibox.height = value end,
}
for k,v in pairs({"orientation"}) do
set_map[v] = false
@@ -28,8 +28,8 @@ local function new(cg,orientation)
splitter1 = splitter(cg,{y=function() return cg.y+cg.height/2 end ,x=function() return cg.x end , index=1 ,direction="right" })
splitter2 = splitter(cg,{y=function() return cg.y+cg.height/2 end ,x=function() return cg.x+cg.width-48 end ,direction="left" })
end
- cg.decorations:add_decoration(splitter1,{class="splitter",position="top",align="beginning",update_callback= function() splitter1:update() end})
- cg.decorations:add_decoration(splitter2,{class="splitter",position="top",align="beginning",update_callback= function() splitter2:update() end})
+ cg.decorations:add_decoration(splitter1,{class="splitter",position="top",align="beginning",ontop=true,update_callback= function() splitter1:update() end})
+ cg.decorations:add_decoration(splitter2,{class="splitter",position="top",align="beginning",ontop=true,update_callback= function() splitter2:update() end})
local function sum_ratio(only_visible)
local sumratio = 0
@@ -51,11 +51,11 @@ local function new(cg,orientation)
end
function data:update()
- local relX,relY,prev = cg.x,cg.y,nil
+ local relX,relY,prev = cg.workarea.x,cg.workarea.y,nil
for k,v in ipairs(cg:childs()) do
if v.visible ~= false and (#v:childs() > 0 or v:has_client() == true) then --TODO visible childs
- local width = ( orientation == "horizontal" ) and cg.width or ratio_to_percent(data.ratio[k])*cg.width
- local height = ( orientation == "vertical" ) and cg.height or ratio_to_percent(data.ratio[k])*cg.height
+ local width = ( orientation == "horizontal" ) and cg.workarea.width or ratio_to_percent(data.ratio[k])*cg.workarea.width
+ local height = ( orientation == "vertical" ) and cg.workarea.height or ratio_to_percent(data.ratio[k])*cg.workarea.height
if prev and prev.decorations["edge"] then
print("This do work",#prev.decorations["edge"],prev.decorations["edge"][1].cg2,v)
@@ -64,7 +64,7 @@ local function new(cg,orientation)
print("You failed",prev.decorations["edge"])
end
-
+ print("geo h w x y",height,width,relX,relY)
v:geometry({width = width, height = height, x = relX, y = relY })
v:repaint()
relY = relY + (( orientation == "horizontal" ) and v.height or 0)
@@ -10,17 +10,16 @@ local splitter = require( "ultiLayout.widgets.splitter" )
module("ultiLayout.layouts.stack")
function new(cg,have_tiltebar)
- if not cg then return end
+ if not cg then return end
local data = {}
local tb = nil
local asplitter = splitter.create_splitter_bar(cg)
cg.swapable = true
function data:update()
local margin = (cg.width-(2*(beautiful.client_margin or 0)) < 0 or cg.height-(2*(beautiful.client_margin or 0)) < 0) and 0 or beautiful.client_margin or 0
- local margin_top = (tb) and tb.wibox.height or 0
for k,v in ipairs(cg:childs()) do
- v:geometry({width = cg.width-(margin*2), height = cg.height-margin_top-(margin*2), x = cg.x+(margin/2), y = cg.y+margin_top+(margin/2)})
+ v:geometry({width = cg.workarea.width-(margin*2), height = cg.workarea.height-(margin*2), x = cg.workarea.x+(margin/2), y = cg.workarea.y+(margin/2)})
v:repaint()
end
--if tb then tb:update() end
@@ -10,7 +10,7 @@ function new(cg,c)
function data:update()
c.hidden = not cg.visible
- c:geometry({x = cg.x, y = cg.y, width = cg.width, height = cg.height})
+ c:geometry({x = cg.workarea.x, y = cg.workarea.y, width = cg.workarea.width, height = cg.workarea.height})
end
function data:set_active(sub_cg)
@@ -73,8 +73,8 @@ local function create_splitter(cg,args)
local visible = false
local get_map = {
- x = function() return private_data.x end,
- y = function() return private_data.y end
+ x = function() return (type(private_data.x) == "function") and private_data.x() or private_data.x end,
+ y = function() return (type(private_data.y) == "function") and private_data.y() or private_data.y end
}
local set_map = {
x = false,
Submodule vicious updated from 059442 to 06e8f7

0 comments on commit 617185c

Please sign in to comment.