]> git.madduck.net Git - etc/awesome.git/blobdiff - widgets/alsabar.lua

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:

layout: deprecations removed; submodule compacted
[etc/awesome.git] / widgets / alsabar.lua
index 093c461f5ef91675a3bba32f93124dc01b74fb13..cdbefd26590dca83a7acc318f886782cf3285a14 100644 (file)
@@ -16,7 +16,6 @@ local naughty      = require("naughty")
 local wibox        = require("wibox")
 
 local math         = { modf   = math.modf }
 local wibox        = require("wibox")
 
 local math         = { modf   = math.modf }
-local mouse        = mouse
 local string       = { format = string.format,
                        match  = string.match,
                        rep    = string.rep }
 local string       = { format = string.format,
                        match  = string.match,
                        rep    = string.rep }
@@ -43,7 +42,6 @@ local alsabar = {
         font      = beautiful.font:sub(beautiful.font:find(""), beautiful.font:find(" ")),
         font_size = "11",
         color     = beautiful.fg_normal,
         font      = beautiful.font:sub(beautiful.font:find(""), beautiful.font:find(" ")),
         font_size = "11",
         color     = beautiful.fg_normal,
-        bar_size  = 18,
         screen    = 1
     },
 
         screen    = 1
     },
 
@@ -71,12 +69,12 @@ function alsabar.notify()
         preset.title = string.format("%s - %s%%", alsabar.channel, alsabar._current_level)
     end
 
         preset.title = string.format("%s - %s%%", alsabar.channel, alsabar._current_level)
     end
 
-    int = math.modf((alsabar._current_level / 100) * alsabar.notifications.bar_size)
+    int = math.modf((alsabar._current_level / 100) * awful.screen.focused().mywibox.height)
     preset.text = string.format("[%s%s]", string.rep("|", int),
     preset.text = string.format("[%s%s]", string.rep("|", int),
-                  string.rep(" ", alsabar.notifications.bar_size - int))
+                  string.rep(" ", awful.screen.focused().mywibox.height - int))
 
 
-    if alsabar.followmouse then
-        preset.screen = mouse.screen
+    if alsabar.followtag then
+        preset.screen = awful.screen.focused()
     end
 
     if alsabar._notify ~= nil then
     end
 
     if alsabar._notify ~= nil then
@@ -107,7 +105,7 @@ local function worker(args)
     alsabar.step          = args.step or alsabar.step
     alsabar.colors        = args.colors or alsabar.colors
     alsabar.notifications = args.notifications or alsabar.notifications
     alsabar.step          = args.step or alsabar.step
     alsabar.colors        = args.colors or alsabar.colors
     alsabar.notifications = args.notifications or alsabar.notifications
-    alsabar.followmouse   = args.followmouse or false
+    alsabar.followtag     = args.followtag or false
 
     alsabar.bar = wibox.widget {
         forced_height    = height,
 
     alsabar.bar = wibox.widget {
         forced_height    = height,
@@ -165,7 +163,7 @@ local function worker(args)
           end),
           awful.button({}, 2, function()
                                                awful.util.spawn(string.format("%s set %s 100%%", alsabar.cmd, alsabar.channel))
           end),
           awful.button({}, 2, function()
                                                awful.util.spawn(string.format("%s set %s 100%%", alsabar.cmd, alsabar.channel))
-            pulsebar.update()
+            alsabar.update()
           end),
           awful.button({}, 3, function()
             awful.util.spawn(string.format("%s set %s toggle", alsabar.cmd, alsabar.togglechannel or alsabar.channel))
           end),
           awful.button({}, 3, function()
             awful.util.spawn(string.format("%s set %s toggle", alsabar.cmd, alsabar.togglechannel or alsabar.channel))