]> git.madduck.net Git - etc/awesome.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

show notification window in focused screen
authorWooParadog <guohaochuan@gmail.com>
Sat, 19 Jul 2014 14:36:15 +0000 (22:36 +0800)
committerWooParadog <guohaochuan@gmail.com>
Sat, 19 Jul 2014 14:36:15 +0000 (22:36 +0800)
widgets/alsabar.lua
widgets/bat.lua
widgets/calendar.lua
widgets/contrib/task.lua
widgets/contrib/tpbat/init.lua
widgets/fs.lua
widgets/imap.lua
widgets/mpd.lua
widgets/net.lua
widgets/yawn/init.lua

index 365ac2d20ce71bcad3a6c4062169eb22fca1fc76..4ae12e563bf170fb9c38dab9f39e49e5e63ee139 100644 (file)
@@ -54,22 +54,22 @@ local alsabar =
 function alsabar.notify()
   alsabar.update()
 
-       local preset =
-       {
+    local preset =
+    {
       title   = "",
       text    = "",
       timeout = 4,
       font    = alsabar.notifications.font .. " " ..
                 alsabar.notifications.font_size,
       fg      = alsabar.notifications.color
-       }
+    }
 
-       if alsabar._muted
+    if alsabar._muted
   then
-               preset.title = alsabar.channel .. " - Muted"
-       else
-               preset.title = alsabar.channel .. " - " .. alsabar._current_level * 100 .. "%"
-       end
+        preset.title = alsabar.channel .. " - Muted"
+    else
+        preset.title = alsabar.channel .. " - " .. alsabar._current_level * 100 .. "%"
+    end
 
   int = math.modf(alsabar._current_level * alsabar.notifications.bar_size)
   preset.text = "["
@@ -78,15 +78,17 @@ function alsabar.notify()
                 .. "]"
 
   if alsabar._notify ~= nil then
-               alsabar._notify = naughty.notify ({
+        alsabar._notify = naughty.notify ({
         replaces_id = alsabar._notify.id,
-                         preset      = preset
+        preset      = preset,
+        screen = client.focus and client.focus.screen or 1
     })
-       else
-               alsabar._notify = naughty.notify ({
-        preset = preset
+    else
+        alsabar._notify = naughty.notify ({
+        preset = preset,
+        screen = client.focus and client.focus.screen or 1
     })
-       end
+    end
 end
 
 local function worker(args)
index 1d8f8c361a414960f1d0e2a5e73f7062c25f85a3..2ace758d7a786b5183a60f7d4f8fc2c58e4a8b62 100644 (file)
@@ -129,13 +129,15 @@ local function worker(args)
             then
                 bat.id = naughty.notify({
                     preset = bat_notification_critical_preset,
-                    replaces_id = bat.id
+                    replaces_id = bat.id,
+                    screen = client.focus and client.focus.screen or 1
                 }).id
             elseif nperc <= 15
             then
                 bat.id = naughty.notify({
                     preset = bat_notification_low_preset,
-                    replaces_id = bat.id
+                    replaces_id = bat.id,
+                    screen = client.focus and client.focus.screen or 1
                 }).id
             end
         end
index 61451fc8e31a2fbc292d88ab7519ca906ce65364..4e6eda764447ec15408d4ebe1d1277d7be2e6e56 100644 (file)
@@ -98,7 +98,8 @@ function calendar:show(t_out, inc_offset)
         position = calendar.position,
         fg = calendar.fg,
         bg = calendar.bg,
-        timeout = tims
+        timeout = tims,
+        screen = client.focus and client.focus.screen or 1
     })
 end
 
index a6c9f31deba21dc16b6d25dc9729125832db5393..6e6ebaeb7b4c0e74265527150eab69c76751da01 100644 (file)
@@ -51,7 +51,9 @@ function task:show()
                                          position = task.position,
                                          fg = task.fg,
                                          bg = task.bg,
-                                         timeout = task.timeout })
+                                         timeout = task.timeout,
+                                         screen = client.focus and client.focus.screen or 1
+                                     })
 end
 
 function task:prompt_add()
@@ -72,7 +74,8 @@ function task:prompt_add()
               position = task.position,
               fg       = task.fg,
               bg       = task.bg,
-              timeout  = task.timeout
+              timeout  = task.timeout,
+              screen = client.focus and client.focus.screen or 1
           })
       end,
       nil,
@@ -105,7 +108,8 @@ function task:prompt_search()
               position = task.position,
               fg       = task.fg,
               bg       = task.bg,
-              timeout  = task.timeout
+              timeout  = task.timeout,
+              screen = client.focus and client.focus.screen or 1
           })
       end,
       nil,
index 72d6453c2f2f7b0de67ebde8427c4e89f3bd2ed4..782bf353deafc00c5d0c39f0edb5cc17c162b6a1 100644 (file)
@@ -75,7 +75,8 @@ function tpbat:show(t_out)
     tpbat_notification = naughty.notify({
         preset = { fg = beautiful.fg_normal },
         text = str,
-        timeout = t_out
+        timeout = t_out,
+        screen = client.focus and client.focus.screen or 1
     })
 end
 
@@ -111,7 +112,8 @@ function tpbat.register(args)
         local n = naughty.notify({
             preset = bat_notification_low_preset,
             title = "SMAPI Battery Warning: Unable to read battery state!",
-            text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths."
+            text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths.",
+            screen = client.focus and client.focus.screen or 1
         })
     end
 
@@ -137,13 +139,15 @@ function tpbat.register(args)
                 then
                     tpbat.id = naughty.notify({
                         preset = bat_notification_critical_preset,
-                        replaces_id = tpbat.id
+                        replaces_id = tpbat.id,
+                        screen = client.focus and client.focus.screen or 1
                     }).id
                 elseif bat_now.perc <= 15
                 then
                     tpbat.id = naughty.notify({
                         preset = bat_notification_low_preset,
-                        replaces_id = tpbat.id
+                        replaces_id = tpbat.id,
+                        screen = client.focus and client.focus.screen or 1
                     }).id
                 end
             end
index 79f821ef3ecd5c3fcaee0487a70abead4febb390..867ce3f3c4ac9117210a070565db98d557269a36 100644 (file)
@@ -46,7 +46,8 @@ function fs:show(t_out)
     notification = naughty.notify({
         preset = fs_notification_preset,
         text = ws,
-       timeout = t_out
+        timeout = t_out,
+        screen = client.focus and client.focus.screen or 1
     })
 end
 
@@ -66,7 +67,6 @@ local function worker(args)
     function update()
         fs_info = {}
         fs_now  = {}
-
         local f = io.popen("LC_ALL=C df -kP " .. partition)
 
         for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount)
@@ -99,7 +99,8 @@ local function worker(args)
                 text = partition .. " ran out!\nmake some room",
                 timeout = 8,
                 fg = "#000000",
-                bg = "#FFFFFF"
+                bg = "#FFFFFF",
+                screen = client.focus and client.focus.screen or 1
             })
             helpers.set_map("fs", true)
         else
index 6104388ff01a406e5aa61e2725e7aaf7c89e5e7a..c4040323f3d897412bc28e800b9d4d288bd6324f 100644 (file)
@@ -74,7 +74,11 @@ local function worker(args)
             else
                 nt = mail .. " has <b>" .. mailcount .. "</b> new messages"
             end
-            naughty.notify({ preset = mail_notification_preset, text = nt })
+            naughty.notify({
+                preset = mail_notification_preset,
+                text = nt,
+                screen = client.focus and client.focus.screen or 1
+            })
         end
 
         helpers.set_map(mail, mailcount)
index 1749b5710b9e0588ae2bf83e35b27e0e23e98687..73efebb48b3423b164a98bf0b73a1241fa2fa7bd 100644 (file)
@@ -92,7 +92,8 @@ local function worker(args)
                 mpd.id = naughty.notify({
                     preset = mpd_notification_preset,
                     icon = "/tmp/mpdcover.png",
-                    replaces_id = mpd.id
+                    replaces_id = mpd.id,
+                    screen = client.focus and client.focus.screen or 1
                 }).id
             end
         elseif mpd_now.state ~= "pause"
index 08c73663e4ec4eccbd0bc1172ed1c169455f9ebe..1e597319ceaddb68925992ff330e427b73bd36dd 100644 (file)
@@ -87,7 +87,8 @@ local function worker(args)
                     timeout  = 7,
                     position = "top_left",
                     icon     = helpers.icons_dir .. "no_net.png",
-                    fg       = notify_fg or "#FFFFFF"
+                    fg       = notify_fg or "#FFFFFF",
+                    screen = client.focus and client.focus.screen or 1
                 })
                 helpers.set_map(iface, false)
             end
index 4109d6c90152903274b460405034d92152e02f47..da2b856f033483329b9bccccb8bc1f6fd3c83674 100644 (file)
@@ -161,7 +161,8 @@ function yawn.show(t_out)
         preset = yawn_notification_preset,
         text = weather_data,
         icon = sky,
-        timeout = t_out
+        timeout = t_out,
+        screen = client.focus and client.focus.screen or 1
     })
 end