From 1aacf1efc474d74f7aa0cf3f4e3fb8c0d383de6a Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 22 Feb 2015 19:29:18 +0000 Subject: [PATCH 1/7] Add useless gap utility functions --- lib/awful/tag.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index a1865b8e..5b360d72 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -383,6 +383,30 @@ function tag.getmwfact(t) return tag.getproperty(t, "mwfact") or 0.5 end +--- Set the spacing between clients +-- @param useless_gap The spacing between clients +-- @param t The tag to modify, if null tag.selected() is used. +function tag.setgap(useless_gap, t) + local t = t or tag.selected() + if useless_gap >= 0 then + tag.setproperty(t, "useless_gap", useless_gap) + end +end + +--- Increase the spacing between clients +-- @param add Value to add to the spacing between clients +-- @param t The tag to modify, if null tag.selected() is used. +function tag.incgap(add, t) + tag.setgap(tag.getgap(t) + add, t) +end + +--- Get the spacing between clients +-- @param t Optional tag. +function tag.getgap(t) + local t = t or tag.selected() + return tag.getproperty(t, "useless_gap") or 0 +end + --- Set the number of master windows. -- @param nmaster The number of master windows. -- @param[opt] t The tag. @@ -673,6 +697,7 @@ capi.tag.add_signal("property::icon") capi.tag.add_signal("property::icon_only") capi.tag.add_signal("property::layout") capi.tag.add_signal("property::mwfact") +capi.tag.add_signal("property::useless_gap") capi.tag.add_signal("property::ncol") capi.tag.add_signal("property::nmaster") capi.tag.add_signal("property::windowfact") From 056dee0426f4c0d791329fc3cf56bc88e648a076 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 22 Feb 2015 19:44:37 +0000 Subject: [PATCH 2/7] layout: Remove dead code --- lib/awful/layout/init.lua | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 97b94a74..643891cd 100755 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -173,17 +173,6 @@ capi.client.connect_signal("property::screen", function(c, old_screen) layout.arrange(c.screen) end) -local function arrange_on_tagged(c, tag) - if not tag.screen then return end - layout.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 - c:emit_signal("request::activate", "layout.arrange_on_tagged", - {raise=false}) - end - end -end local function arrange_tag(t) layout.arrange(tag.getscreen(t)) end From a7f2600a38050bdff34d6e8d25e3f6ac966c57fe Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 22 Feb 2015 19:51:10 +0000 Subject: [PATCH 3/7] layout: attached_connect_signal is deprecated --- lib/awful/layout/init.lua | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 643891cd..6d3157de 100755 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -10,14 +10,15 @@ -- Grab environment we need local ipairs = ipairs local type = type -local tag = require("awful.tag") local util = require("awful.util") local ascreen = require("awful.screen") local capi = { screen = screen, awesome = awesome, - client = client + client = client, + tag = tag } +local tag = require("awful.tag") local client = require("awful.client") local timer = require("gears.timer") @@ -178,15 +179,17 @@ local function arrange_tag(t) end capi.screen.add_signal("arrange") + +capi.tag.connect_signal("property::mwfact", arrange_tag) +capi.tag.connect_signal("property::nmaster", arrange_tag) +capi.tag.connect_signal("property::ncol", arrange_tag) +capi.tag.connect_signal("property::layout", arrange_tag) +capi.tag.connect_signal("property::windowfact", arrange_tag) +capi.tag.connect_signal("property::selected", arrange_tag) +capi.tag.connect_signal("property::activated", arrange_tag) +capi.tag.connect_signal("tagged", arrange_tag) + for s = 1, capi.screen.count() do - tag.attached_connect_signal(s, "property::mwfact", arrange_tag) - tag.attached_connect_signal(s, "property::nmaster", arrange_tag) - tag.attached_connect_signal(s, "property::ncol", arrange_tag) - tag.attached_connect_signal(s, "property::layout", arrange_tag) - tag.attached_connect_signal(s, "property::windowfact", arrange_tag) - tag.attached_connect_signal(s, "property::selected", arrange_tag) - tag.attached_connect_signal(s, "property::activated", arrange_tag) - tag.attached_connect_signal(s, "tagged", arrange_tag) capi.screen[s]:connect_signal("property::workarea", function(screen) layout.arrange(screen.index) end) From 01ac50c5edab1c2dbb4dc6040c07b91cd5b91ff3 Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 2 Jul 2015 22:06:06 +0200 Subject: [PATCH 4/7] feat(lib: awful: layout): set useless gap --- lib/awful/layout/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 6d3157de..971c214a 100755 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -134,9 +134,12 @@ function layout.arrange(screen) p.screen = screen p.geometries = setmetatable({}, {__mode = "k"}) layout.get(screen).arrange(p) + local useless_gap = tag.getgap(tag.selected(screen)) for c, g in pairs(p.geometries) do - g.width = g.width - c.border_width * 2 - g.height = g.height - c.border_width * 2 + g.width = g.width - c.border_width * 2 - useless_gap * 2 + g.height = g.height - c.border_width * 2 - useless_gap * 2 + g.x = g.x + useless_gap + g.y = g.y + useless_gap c:geometry(g) end capi.screen[screen]:emit_signal("arrange") @@ -187,6 +190,7 @@ capi.tag.connect_signal("property::layout", arrange_tag) capi.tag.connect_signal("property::windowfact", arrange_tag) capi.tag.connect_signal("property::selected", arrange_tag) capi.tag.connect_signal("property::activated", arrange_tag) +capi.tag.connect_signal("property::useless_gap", arrange_tag) capi.tag.connect_signal("tagged", arrange_tag) for s = 1, capi.screen.count() do From 82549c04cd5b3df34cf81e563115b3d5720f8ed2 Mon Sep 17 00:00:00 2001 From: actionless Date: Thu, 2 Jul 2015 23:24:04 +0200 Subject: [PATCH 5/7] feat(lib: awful: tag): get useless_gap from beautiful if no any --- lib/awful/tag.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index 5b360d72..e5348e19 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -10,6 +10,7 @@ -- Grab environment we need local util = require("awful.util") local timer = require("gears.timer") +local beautiful = require("beautiful") local tostring = tostring local pairs = pairs local ipairs = ipairs @@ -404,7 +405,7 @@ end -- @param t Optional tag. function tag.getgap(t) local t = t or tag.selected() - return tag.getproperty(t, "useless_gap") or 0 + return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or 0 end --- Set the number of master windows. From 1a32ba6ecb05469ee1318d11d969029286b779c9 Mon Sep 17 00:00:00 2001 From: actionless Date: Fri, 3 Jul 2015 00:20:28 +0200 Subject: [PATCH 6/7] feat(themes): add 'useless_gap' prop to all themes --- themes/default/theme.lua | 1 + themes/sky/theme.lua | 1 + themes/xresources/theme.lua | 1 + themes/zenburn/theme.lua | 1 + 4 files changed, 4 insertions(+) diff --git a/themes/default/theme.lua b/themes/default/theme.lua index 64de0f4f..65b686ac 100644 --- a/themes/default/theme.lua +++ b/themes/default/theme.lua @@ -17,6 +17,7 @@ theme.fg_focus = "#ffffff" theme.fg_urgent = "#ffffff" theme.fg_minimize = "#ffffff" +theme.useless_gap = 0 theme.border_width = 1 theme.border_normal = "#000000" theme.border_focus = "#535d6c" diff --git a/themes/sky/theme.lua b/themes/sky/theme.lua index b5252bcb..936d4ddd 100644 --- a/themes/sky/theme.lua +++ b/themes/sky/theme.lua @@ -19,6 +19,7 @@ theme.fg_focus = "#2e3436" theme.fg_urgent = "#2e3436" theme.fg_minimize = "#2e3436" +theme.useless_gap = 0 theme.border_width = 2 theme.border_normal = "#dae3e0" theme.border_focus = "#729fcf" diff --git a/themes/xresources/theme.lua b/themes/xresources/theme.lua index c98582a6..589614cb 100644 --- a/themes/xresources/theme.lua +++ b/themes/xresources/theme.lua @@ -22,6 +22,7 @@ theme.fg_focus = theme.bg_normal theme.fg_urgent = theme.bg_normal theme.fg_minimize = theme.bg_normal +theme.useless_gap = dpi(5) theme.border_width = dpi(1) theme.border_normal = xrdb.color0 theme.border_focus = theme.bg_focus diff --git a/themes/zenburn/theme.lua b/themes/zenburn/theme.lua index 5e626e9e..69be51de 100644 --- a/themes/zenburn/theme.lua +++ b/themes/zenburn/theme.lua @@ -25,6 +25,7 @@ theme.bg_systray = theme.bg_normal -- }}} -- {{{ Borders +theme.useless_gap = 0 theme.border_width = 2 theme.border_normal = "#3F3F3F" theme.border_focus = "#6F6F6F" From c961622fc053c0c52ac369b804aeef1a0a9e3b9d Mon Sep 17 00:00:00 2001 From: actionless Date: Fri, 3 Jul 2015 02:15:52 +0200 Subject: [PATCH 7/7] fix(lib: awful: layout): equal useless gaps --- lib/awful/layout/init.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/awful/layout/init.lua b/lib/awful/layout/init.lua index 971c214a..11e65bd2 100755 --- a/lib/awful/layout/init.lua +++ b/lib/awful/layout/init.lua @@ -121,20 +121,21 @@ function layout.arrange(screen) local p = {} p.workarea = capi.screen[screen].workarea + local useless_gap = tag.getgap(tag.selected(screen)) -- 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 + local padding = ascreen.padding(capi.screen[screen]) or {} + p.workarea.x = p.workarea.x + (padding.left or 0) + useless_gap + p.workarea.y = p.workarea.y + (padding.top or 0) + useless_gap + p.workarea.width = p.workarea.width - ((padding.left or 0 ) + + (padding.right or 0) + useless_gap * 2) + p.workarea.height = p.workarea.height - ((padding.top or 0) + + (padding.bottom or 0) + useless_gap * 2) + p.geometry = capi.screen[screen].geometry p.clients = client.tiled(screen) p.screen = screen p.geometries = setmetatable({}, {__mode = "k"}) layout.get(screen).arrange(p) - local useless_gap = tag.getgap(tag.selected(screen)) for c, g in pairs(p.geometries) do g.width = g.width - c.border_width * 2 - useless_gap * 2 g.height = g.height - c.border_width * 2 - useless_gap * 2