Re: [PATCH] naughty environment cleanup
At 1241929100 time_t, koniu wrote: I missed one s/screen/capi.screen/ in this patch, please amend. Amended. Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // There is nothing under this line. signature.asc Description: Digital signature
[PATCH] naughty environment cleanup
Hullo, a little continuation of recent naughty love - tidy environment is important :) More (importantly) to come - I'm trying to tackle a pretty severe bug I've been seeing recently. When we have a single notification in the screen which takes up the whole space, as soon as another popup replaces it, positioning of any further notifications goes to deep misery. This is not easy to track down since I can't watch variable values using... naughty and print doesn't help much these days. koniu From 03fe4ad49e7123749152c435b6192a799099e194 Mon Sep 17 00:00:00 2001 From: koniu gkusni...@gmail.com Date: Fri, 8 May 2009 08:01:14 +0100 Subject: [PATCH] naughty: environment cleanup Makes naughty environment handling same as awful modules: - relevant capi members all go to local capi = {} - relevant awful members are all implicitly required Signed-off-by: koniu gkusni...@gmail.com --- lib/naughty.lua.in | 47 +++ 1 files changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 3122083..1528fd7 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -7,19 +7,18 @@ -- Package environment local pairs = pairs local table = table -local wibox = wibox -local image = image local type = type -local hooks = require(awful.hooks) local string = string -local widget = widget +local capi = { screen = screen, + awesome = awesome, + dbus = dbus, + widget = widget, + wibox = wibox, + image = image } +local hooks = require(awful.hooks) local button = require(awful.button) local util = require(awful.util) -local capi = { screen = screen, awesome = awesome } local bt = require(beautiful) -local screen = screen -local awful = awful -local dbus = dbus --- Notification library module(naughty) @@ -103,7 +102,7 @@ local counter = 1 -- @class table notifications = {} -for s = 1, screen.count() do +for s = 1, capi.screen.count() do notifications[s] = { top_left = {}, top_right = {}, @@ -202,7 +201,7 @@ local function getIcon(name) for d, dir in pairs(config.icon_dirs) do for f, format in pairs(config.icon_formats) do local icon = dir .. name .. . .. format -if awful.util.file_readable(icon) then +if util.file_readable(icon) then return icon end end @@ -309,7 +308,7 @@ function notify(args) end -- create textbox -local textbox = widget({ type = textbox, align = flex }) +local textbox = capi.widget({ type = textbox, align = flex }) textbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die))) textbox:margin({ right = margin, left = margin, bottom = 2 * margin }) textbox.text = string.format('span font_desc=%sb%s/b%s/span', font, title, text) @@ -319,17 +318,17 @@ function notify(args) local iconbox = nil if icon then -- try to guess icon if the provided one is non-existent/readable -if type(icon) == string and not awful.util.file_readable(icon) then +if type(icon) == string and not util.file_readable(icon) then icon = getIcon(icon) end -- if we have an icon, use it if icon then -iconbox = widget({ type = imagebox, align = left }) +iconbox = capi.widget({ type = imagebox, align = left }) iconbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die))) local img if type(icon) == string then -img = image(icon) +img = capi.image(icon) else img = icon end @@ -344,11 +343,11 @@ function notify(args) end -- create container wibox -notification.box = wibox({ position = floating, - fg = fg, - bg = bg, - border_color = border_color, - border_width = border_width }) +notification.box = capi.wibox({ position = floating, +fg = fg, +bg = bg, +border_color = border_color, +border_width = border_width }) -- calculate the height if not height then @@ -398,8 +397,8 @@ end -- DBUS/Notification support -- Notify -if awful.hooks.dbus then -awful.hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire) +if hooks.dbus then +hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire) args = { preset = { } } if data.member == Notify then if text ~= then @@ -449,7 +448,7 @@ if awful.hooks.dbus then end
Re: [PATCH] naughty environment cleanup
OK, that was for next and it can as well go to master, here's the patch on top of that. Dunno how it will behave with patches in next tho, maybe better push the 1st one to next and forget this one... your choice B^] koniu From d3b27865c7de7adaac1306a365650d736395d554 Mon Sep 17 00:00:00 2001 From: koniu gkusni...@gmail.com Date: Fri, 8 May 2009 08:01:14 +0100 Subject: [PATCH] naughty: environment cleanup Makes naughty environment handling same as awful modules: - relevant capi members all go to local capi = {} - relevant awful members are all implicitly required Signed-off-by: koniu gkusni...@gmail.com --- lib/naughty.lua.in | 47 +++ 1 files changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 45ec3b5..8a34527 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -7,20 +7,19 @@ -- Package environment local pairs = pairs local table = table -local wibox = wibox -local image = image local type = type +local string = string local tostring = tostring +local capi = { screen = screen, + awesome = awesome, + dbus = dbus, + widget = widget, + wibox = wibox, + image = image } local hooks = require(awful.hooks) -local string = string -local widget = widget local button = require(awful.button) local util = require(awful.util) -local capi = { screen = screen, awesome = awesome } local bt = require(beautiful) -local screen = screen -local awful = awful -local dbus = dbus --- Notification library module(naughty) @@ -139,7 +138,7 @@ local counter = 1 -- @class table notifications = {} -for s = 1, screen.count() do +for s = 1, capi.screen.count() do notifications[s] = { top_left = {}, top_right = {}, @@ -238,7 +237,7 @@ local function getIcon(name) for d, dir in pairs(config.icon_dirs) do for f, format in pairs(config.icon_formats) do local icon = dir .. name .. . .. format -if awful.util.file_readable(icon) then +if util.file_readable(icon) then return icon end end @@ -327,7 +326,7 @@ function notify(args) end -- create textbox -local textbox = widget({ type = textbox, align = flex }) +local textbox = capi.widget({ type = textbox, align = flex }) textbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die))) textbox:margin({ right = config.margin, left = config.margin }) textbox.text = string.format('span font_desc=%sb%s/b%s/span', font, title, text) @@ -337,17 +336,17 @@ function notify(args) local iconbox = nil if icon then -- try to guess icon if the provided one is non-existent/readable -if type(icon) == string and not awful.util.file_readable(icon) then +if type(icon) == string and not util.file_readable(icon) then icon = getIcon(icon) end -- if we have an icon, use it if icon then -iconbox = widget({ type = imagebox, align = left }) +iconbox = capi.widget({ type = imagebox, align = left }) iconbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die))) local img if type(icon) == string then -img = image(icon) +img = capi.image(icon) else img = icon end @@ -362,11 +361,11 @@ function notify(args) end -- create container wibox -notification.box = wibox({ position = floating, - fg = fg, - bg = bg, - border_color = args.preset and args.preset.border_color or config.presets.normal.border_color, - border_width = config.border_width }) +notification.box = capi.wibox({ position = floating, +fg = fg, +bg = bg, +border_color = args.preset and args.preset.border_color or config.presets.normal.border_color, +border_width = config.border_width }) -- position the wibox local lines = 1; for i in string.gmatch(title..text, \n) do lines = lines + 1 end @@ -397,8 +396,8 @@ end -- DBUS/Notification support -- Notify -if awful.hooks.dbus then -awful.hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire) +if hooks.dbus then +hooks.dbus.register(org.freedesktop.Notifications, function (data, appname, replaces_id, icon, title, text, actions, hints, expire) args = { preset = { } } if data.member == Notify then if text ~= then @@ -448,7 +447,7 @@ if awful.hooks.dbus then end end if imgdata
Re: [PATCH] naughty environment cleanup
At 1241767784 time_t, koniu wrote: OK, that was for next and it can as well go to master, here's the patch on top of that. Dunno how it will behave with patches in next tho, maybe better push the 1st one to next and forget this one... your choice B^] I'd rather push it to next if does not fix anything. Unless you really need it into master for later fix? Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Tomorrow I was nothing, yesterday I'll be. signature.asc Description: Digital signature
Re: [PATCH] naughty environment cleanup
At 1241766914 time_t, koniu wrote: Pushed. Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Ferns will rule the world. signature.asc Description: Digital signature
Re: [PATCH] naughty environment cleanup
You can write files to relay data pretty reliably, btw. You can then tail -f to have something like stdout... -_- -AT 2009/5/8 Julien Danjou jul...@danjou.info: At 1241766914 time_t, koniu wrote: Pushed. Cheers, -- Julien Danjou // ᐰ jul...@danjou.info http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Ferns will rule the world. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkoD6poACgkQpGK1HsL+5c222QCcD9E3AwwUuJIxiR7Rc3hwGBV2 7f0AoL4JvK29iB7f+nEDtLJ1uIOyp7el =XkE+ -END PGP SIGNATURE- -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.
Re: [PATCH] naughty environment cleanup
On Fri, May 8, 2009 at 13:21, Andrei Thorp gar...@gmail.com wrote: You can write files to relay data pretty reliably, btw. You can then tail -f to have something like stdout... -_- Yes, io.stderr:write() is my new friend :] k -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.