Forgot to even mention why I started this post, here's a patch for
naughty to respect wiboxes while calculating workarea.
From 635885217a3e9fbd58bcfda999253f54f25f076b Mon Sep 17 00:00:00 2001
From: koniu <[email protected]>
Date: Sun, 10 May 2009 16:32:32 +0100
Subject: [PATCH] naughty: use awful.wibox to get workarea

Signed-off-by: koniu <[email protected]>
---
 lib/naughty.lua.in |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in
index 01002d9..fbc6ef3 100644
--- a/lib/naughty.lua.in
+++ b/lib/naughty.lua.in
@@ -18,6 +18,7 @@ local capi = { screen = screen,
 local hooks = require("awful.hooks")
 local button = require("awful.button")
 local util = require("awful.util")
+local wibox = require("awful.wibox")
 local bt = require("beautiful")
 
 --- Notification library
@@ -118,7 +119,7 @@ end
 -- @param width Popup width (optional)
 -- @return Absolute position and index in { x = X, y = Y, idx = I } table
 local function get_offset(screen, position, idx, width, height)
-    local ws = capi.screen[screen].workarea
+    local ws = wibox.get_workarea(screen)
     local v = {}
     local idx = idx or #notifications[screen][position] + 1
     local width = width or notifications[screen][position][idx].width
@@ -364,11 +365,12 @@ function notify(args)
     end
 
     -- crop to workarea size if too big
-    if width > capi.screen[screen].workarea.width - 2 * (border_width or 0) - 2 * (config.padding or 0) then
-        width = capi.screen[screen].workarea.width - 2 * (border_width or 0) - 2 * (config.padding or 0)
+    local ws = wibox.get_workarea(screen)
+    if width > ws.width - 2 * (border_width or 0) - 2 * (config.padding or 0) then
+        width = ws.width - 2 * (border_width or 0) - 2 * (config.padding or 0)
     end
-    if height > capi.screen[screen].workarea.height - 2 * (border_width or 0) - 2 * (config.padding or 0) then
-        height = capi.screen[screen].workarea.height - 2 * (border_width or 0) - 2 * (config.padding or 0)
+    if height > ws.height - 2 * (border_width or 0) - 2 * (config.padding or 0) then
+        height = ws.height - 2 * (border_width or 0) - 2 * (config.padding or 0)
     end
 
     -- set size in notification object
-- 
1.6.3

Reply via email to