]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: replace kmix with pulsemixer
authorSamir Benmendil <me@rmz.io>
Mon, 1 Feb 2016 22:15:25 +0000 (22:15 +0000)
committerSamir Benmendil <me@rmz.io>
Mon, 1 Feb 2016 22:15:25 +0000 (22:15 +0000)
awesome/rules.lua
awesome/utils.lua
awesome/widgets/volume_widget.lua

index 2bdd30699e26d7497c021a8d18247851ffae4f7b..fe8ffc0f44440c49c18ff6d147db153ef1286880 100644 (file)
@@ -31,12 +31,15 @@ awful.rules.rules = {
       properties = { floating = true } },
     { rule = { class = "gimp" },
       properties = { floating = true } },
-    { rule = { class = "Kmix" },
+    { rule = { class = "URxvt", instance = "pulsemixer" },
       properties = { floating = true,
                      skip_taskbar = true,
                      ontop = true,
-                     x = 1920 - 310, y = mywibox[mouse.screen].height,
-                     width = 100, height = 100 } },
+                     function (c)
+                        c:geometry({ x = 1920 - 500, y = mywibox[mouse.screen].height,
+                                     width = 500, height = 300})
+                        c:connect_signal("unfocus", function (c) c:kill() end)
+                     end } },
     { rule = { class = "URxvt"},
       properties = { opacity = 0.8 } },
     { rule = { class = "URxvt", instance = "mutt" },
index 7519473cb5d513321c4df379b72fcb7b5c02bb9e..0c56131b0b47a90c681fd134530e251888d4440c 100644 (file)
@@ -9,22 +9,41 @@ utils.globalkeys = { }
 local host = io.popen("hostname")
 utils.host = host:read("*l")
 
-function utils.run_or_kill(command)
-    -- Check throught the clients if the class match the command
-    local lower_command=string.lower(command)
+function utils.run_or_kill(prg, cprop, screen)
+    if not prg then
+        do return nil end
+    end
+
+    if not cprop then
+        cprop = { }
+    end
+
+    if not cprop.class then
+        cprop.class = prg
+    end
+
+    if not cprop.instance then
+        cprop.instance = ""
+    end
+
+    cprop.class = string.lower(cprop.class)
+    cprop.instance = string.lower(cprop.instance)
+
     for k, c in pairs(client.get()) do
         -- apparently some steam games don't have a client class
-        if c.class ~= nil then
-            local class=string.lower(c.class)
-            if string.match(class, lower_command) then
-                for i, v in ipairs(c:tags()) do
-                    c:kill()
-                    return
-                end
+        if c.class == nil then
+            return
+        end
+        local class=string.lower(c.class)
+        local instance=string.lower(c.instance)
+        if string.match(class, cprop.class) and string.match(instance, cprop.instance) then
+            for i, v in ipairs(c:tags()) do
+                c:kill()
+                return
             end
         end
     end
-    awful.util.spawn(command)
+    awful.util.spawn_with_shell(prg, screen)
 end
 
 -- http://awesome.naquadah.org/wiki/Autostart#Simple_way
@@ -37,7 +56,7 @@ function utils.run_once(prg,arg_string,pname,screen)
        pname = prg
     end
 
-    if not arg_string then 
+    if not arg_string then
         awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. "' || (" .. prg .. ")",screen)
     else
         awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. " ".. arg_string .."' || (" .. prg .. " " .. arg_string .. ")",screen)
index 48fcbadc48c0131039ec189cefefcc187f7f041d..91035758b081b43f18225b72f4d89fc5c4728638 100644 (file)
@@ -12,7 +12,11 @@ volwidget = wibox.widget.textbox()
 vicious.register(volwidget, vicious.contrib.pulse, '<span font="Symbola 12">🔊</span> '.."$1", 1, device)
 
 -- Mouse bindings
-volwidget:buttons(awful.util.table.join( awful.button({ }, 1, function () utils.run_or_kill("kmix") end),
+volwidget:buttons(awful.util.table.join(
+    awful.button({ }, 1,
+        function () 
+            utils.run_or_kill("urxvt -name pulsemixer -e pulsemixer", {class = "urxvt", instance = "pulsemixer"})
+        end),
     awful.button({ }, 2,
         function ()
             vicious.contrib.pulse.toggle(device)