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:

pulseaudio -> pulse; scallback merged into cmd (read wiki)
authorLuke Bonham <dada@archlinux.info>
Wed, 13 Sep 2017 10:33:40 +0000 (12:33 +0200)
committerLuca CPZ <dada@archlinux.info>
Thu, 5 Oct 2017 09:32:01 +0000 (11:32 +0200)
.gitmodules
ISSUE_TEMPLATE.md
README.rst
lain-git.rockspec
scripts/dfs
util/init.lua
widget/pulse.lua [new file with mode: 0644]
widget/pulseaudio.lua [deleted file]
widget/pulsebar.lua
wiki

index a50818fd507d0ed5c2283eba482ad16842ebc072..d95bcb57322f746bfd5e79c4fa9edff5cafdd045 100644 (file)
@@ -1,3 +1,3 @@
 [submodule "lain.wiki"]
        path = wiki
-       url = https://github.com/copycat-killer/lain.wiki.git
+       url = https://github.com/lcpz/lain.wiki.git
index 37c2141da70793b0ff81182bc269551997123543..e9dcc0bc84153ab625241f7907997231c71b43a6 100644 (file)
@@ -1,21 +1,33 @@
-# If you have a question
+# Please, read me!
 
-Take the following steps:
-
-1. [Google it](https://encrypted.google.com)
-2. Search [Awesome doc](https://awesomewm.org/doc)
-3. Ask [community](https://awesomewm.org/community)
-
-and, if you still don't have an answer, you can ask here.
-
-**Please be warned:** if your question is __unrelated__ to this repository, a reply is only an act of kindness.
+So that I can help you quickly and without having to redirect you here.
 
 # If you have an issue
 
-**Please read the [wiki](https://github.com/copycat-killer/lain/wiki) and search the [Issues section](https://github.com/copycat-killer/lain/issues) first.**
+**Please read the [wiki](https://github.com/lcpz/lain/wiki) and search the [Issues section](https://github.com/lcpz/lain/issues) first.**
 
 If you can't find a solution there, then go ahead and provide:
 
 * output of `awesome -v` and `lua -v`
 * expected behavior and actual behavior
 * steps to reproduce the problem
+* X error log
+
+# How to provide X error log
+
+There are two ways:
+
+* (Physically) Restart X like this:
+  ```shell
+  startx -- -keeptty -nolisten tcp > $HOME/.xorg.log 2>&1
+  ```
+  the error log will be output into `$HOME/.xorg.log`.
+
+* (Virtually) Use [Xephyr](https://wikipedia.org/wiki/Xephyr):
+  ```shell
+  # set screen size as you like
+  Xephyr :1 -screen 1280x800 2> stdout.txt & DISPLAY=:1 awesome
+  ```
+  the error log will be output in the file `stdout.txt`.
+
+Before reporting, read the log and see if you can solve it yourself.
index 9ba9715dfff8ba0ba80d796681936f02506725dc..84cdc8b25fc356c16341e92c1b052abed9766adb 100644 (file)
@@ -5,10 +5,10 @@ Lain
 Layouts, widgets and utilities for Awesome WM 4.x
 -------------------------------------------------
 
-:Author: Luke Bonham <dada [at] archlinux [dot] info>
+:Author: Luca CPZ <dada [at] archlinux [dot] info>
 :Version: git
 :License: GNU-GPL2_
-:Source: https://github.com/copycat-killer/lain
+:Source: https://github.com/lcpz/lain
 
 Description
 -----------
@@ -35,5 +35,5 @@ Contributed widgets have to be put in ``widget/contrib``.
 .. _GNU-GPL2: http://www.gnu.org/licenses/gpl-2.0.html
 .. _awesome-vain: https://github.com/vain/awesome-vain
 .. _Awesome: https://github.com/awesomeWM/awesome
-.. _wiki: https://github.com/copycat-killer/lain/wiki
-.. _lain.helpers: https://github.com/copycat-killer/lain/blob/master/helpers.lua
+.. _wiki: https://github.com/lcpz/lain/wiki
+.. _lain.helpers: https://github.com/lcpz/lain/blob/master/helpers.lua
index 1b42903c0636876f22c37df04f8f812626b00bcc..acb1967d17e81a97009446874f61b44cba34dfbe 100644 (file)
@@ -1,7 +1,7 @@
 package = "lain"
 version = "git"
 source = {
-   url = "https://github.com/copycat-killer/lain",
+   url = "https://github.com/lcpz/lain",
    tag = "git"
 }
 description = {
@@ -11,7 +11,7 @@ description = {
 
         Optional dependency: curl (for IMAP, MPD and weather widgets).
     ]],
-   homepage = "https://github.com/copycat-killer/lain",
+   homepage = "https://github.com/lcpz/lain",
    license = "GPL v2"
 }
 dependencies = {
index 47c7b82020f88ef131cc90962e1b0a2956e2bebe..9e02a8773daced934461d7c0a307b1123ef81343 100755 (executable)
@@ -4,7 +4,7 @@
 #   JM,  10/12/2004
 #
 #   Integrated into Lain in september 2013
-#   https://github.com/copycat-killer/lain
+#   https://github.com/lcpz/lain
 
 #   Requires gawk
 
index c43a9ed731be95ede8d14c7725a9a7685777841b..8e7b8ef12cc3127da8224051f13d53d29941c61c 100644 (file)
@@ -76,7 +76,7 @@ function util.magnify_client(c, width_f, height_f)
     end
 end
 
--- https://github.com/copycat-killer/lain/issues/195
+-- https://github.com/lcpz/lain/issues/195
 function util.mc(c, width_f, height_f)
     c = c or util.magnified_client
     if not c then return end
diff --git a/widget/pulse.lua b/widget/pulse.lua
new file mode 100644 (file)
index 0000000..aa9d58e
--- /dev/null
@@ -0,0 +1,59 @@
+--[[
+
+     Licensed under GNU General Public License v2
+      * (c) 2016, Luke Bonham
+
+--]]
+
+local helpers = require("lain.helpers")
+local shell   = require("awful.util").shell
+local wibox   = require("wibox")
+local string  = { gmatch = string.gmatch,
+                  match  = string.match,
+                  format = string.format }
+local type = type
+
+-- PulseAudio volume
+-- lain.widget.pulse
+
+local function factory(args)
+    local pulse    = { widget = wibox.widget.textbox(), device = "N/A" }
+    local args     = args or {}
+    local timeout  = args.timeout or 5
+    local settings = args.settings or function() end
+
+    pulse.devicetype = args.devicetype or "sink"
+    pulse.cmd = args.cmd or "pacmd list-" .. pulse.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
+
+    function pulse.update()
+        helpers.async({ shell, "-c", type(pulse.cmd) == "string" and pulse.cmd or pulse.cmd() },
+        function(s)
+            volume_now = {
+                index  = string.match(s, "index: (%S+)") or "N/A",
+                device = string.match(s, "device.string = \"(%S+)\"") or "N/A",
+                muted  = string.match(s, "muted: (%S+)") or "N/A"
+            }
+
+            pulse.device = volume_now.index
+
+            local ch = 1
+            volume_now.channel = {}
+            for v in string.gmatch(s, ":.-(%d+)%%") do
+                volume_now.channel[ch] = v
+                ch = ch + 1
+            end
+
+            volume_now.left  = volume_now.channel[1] or "N/A"
+            volume_now.right = volume_now.channel[2] or "N/A"
+
+            widget = pulse.widget
+            settings()
+        end)
+    end
+
+    helpers.newtimer("pulse", timeout, pulse.update)
+
+    return pulse
+end
+
+return factory
diff --git a/widget/pulseaudio.lua b/widget/pulseaudio.lua
deleted file mode 100644 (file)
index f9a2302..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
---[[
-
-     Licensed under GNU General Public License v2
-      * (c) 2016, Luke Bonham
-
---]]
-
-local helpers = require("lain.helpers")
-local shell   = require("awful.util").shell
-local wibox   = require("wibox")
-local string  = { gmatch = string.gmatch,
-                  match  = string.match,
-                  format = string.format }
-
--- PulseAudio volume
--- lain.widget.pulseaudio
-
-local function factory(args)
-    local pulseaudio  = { widget = wibox.widget.textbox() }
-    local args        = args or {}
-    local timeout     = args.timeout or 5
-    local settings    = args.settings or function() end
-    local scallback   = args.scallback
-
-    pulseaudio.device = "N/A"
-    pulseaudio.devicetype = args.devicetype or "sink"
-    pulseaudio.cmd = args.cmd or "pacmd list-" .. pulseaudio.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
-
-    function pulseaudio.update()
-        if scallback then pulseaudio.cmd = scallback() end
-
-        helpers.async({ shell, "-c", pulseaudio.cmd }, function(s)
-            volume_now = {
-                index = string.match(s, "index: (%S+)") or "N/A",
-                device = string.match(s, "device.string = \"(%S+)\"") or "N/A",
-                sink   = device, -- legacy API
-                muted  = string.match(s, "muted: (%S+)") or "N/A"
-            }
-
-            pulseaudio.device = volume_now.index
-
-            local ch = 1
-            volume_now.channel = {}
-            for v in string.gmatch(s, ":.-(%d+)%%") do
-                volume_now.channel[ch] = v
-                ch = ch + 1
-            end
-
-            volume_now.left  = volume_now.channel[1] or "N/A"
-            volume_now.right = volume_now.channel[2] or "N/A"
-
-            widget = pulseaudio.widget
-
-            settings()
-        end)
-    end
-
-    helpers.newtimer("pulseaudio", timeout, pulseaudio.update)
-
-    return pulseaudio
-end
-
-return factory
index f97b2d170c9c82f4a877e9162e8104f315d3da24..7a0a3d4d9de5b0ce4288871bd3f39a1b1b790a62 100644 (file)
@@ -17,7 +17,7 @@ local string         = { format = string.format,
                          rep    = string.rep }
 local type, tonumber = type, tonumber
 
--- Pulseaudio volume bar
+-- PulseAudio volume bar
 -- lain.widget.pulsebar
 
 local function factory(args)
@@ -30,6 +30,7 @@ local function factory(args)
 
         _current_level = 0,
         _mute          = "no",
+        device         = "N/A"
     }
 
     local args       = args or {}
@@ -39,20 +40,17 @@ local function factory(args)
     local height     = args.heigth or 1
     local ticks      = args.ticks or false
     local ticks_size = args.ticks_size or 7
-    local scallback  = args.scallback
 
-    pulsebar.cmd                 = args.cmd or "pacmd list-sinks | sed -n -e '0,/*/d' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
-    pulsebar.sink                = args.sink or 0 -- Legacy, does nothing
     pulsebar.colors              = args.colors or pulsebar.colors
     pulsebar.followtag           = args.followtag or false
     pulsebar.notification_preset = args.notification_preset
-    pulsebar.device              = "N/A"
     pulsebar.devicetype          = args.devicetype or "sink"
     pulsebar.cmd                 = args.cmd or "pacmd list-" .. pulsebar.devicetype .. "s | sed -n -e '/*/,$!d' -e '/index/p' -e '/base volume/d' -e '/volume:/p' -e '/muted:/p' -e '/device\\.string/p'"
 
     if not pulsebar.notification_preset then
-        pulsebar.notification_preset      = {}
-        pulsebar.notification_preset.font = "Monospace 10"
+        pulsebar.notification_preset = {
+            font = "Monospace 10"
+        }
     end
 
     pulsebar.bar = wibox.widget {
@@ -70,14 +68,12 @@ local function factory(args)
     pulsebar.tooltip = awful.tooltip({ objects = { pulsebar.bar } })
 
     function pulsebar.update(callback)
-        if scallback then pulsebar.cmd = scallback() end
-
-        helpers.async({ awful.util.shell, "-c", pulsebar.cmd }, function(s)
+        helpers.async({ awful.util.shell, "-c", type(pulsebar.cmd) == "string" and pulsebar.cmd or pulsebar.cmd() },
+        function(s)
             volume_now = {
-                index = string.match(s, "index: (%S+)") or "N/A",
+                index  = string.match(s, "index: (%S+)") or "N/A",
                 device = string.match(s, "device.string = \"(%S+)\"") or "N/A",
-                sink   = device, -- legacy API
-                muted = string.match(s, "muted: (%S+)") or "N/A"
+                muted  = string.match(s, "muted: (%S+)") or "N/A"
             }
 
             pulsebar.device = volume_now.index
@@ -102,11 +98,11 @@ local function factory(args)
                 pulsebar.bar:set_value(pulsebar._current_level / 100)
                 if pulsebar._current_level == 0 or mute == "yes" then
                     pulsebar._mute = mute
-                    pulsebar.tooltip:set_text ("[Muted]")
+                    pulsebar.tooltip:set_text ("[muted]")
                     pulsebar.bar.color = pulsebar.colors.mute
                 else
                     pulsebar._mute = "no"
-                    pulsebar.tooltip:set_text(string.format("%s: %s", pulsebar.device, volu))
+                    pulsebar.tooltip:set_text(string.format("%s %s: %s", pulsebar.devicetype, pulsebar.device, volu))
                     pulsebar.bar.color = pulsebar.colors.unmute
                 end
 
@@ -121,10 +117,10 @@ local function factory(args)
         pulsebar.update(function()
             local preset = pulsebar.notification_preset
 
-            preset.title = string.format("Sink %s - %s%%", pulsebar.device, pulsebar._current_level)
+            preset.title = string.format("%s %s - %s%%", pulsebar.devicetype, pulsebar.device, pulsebar._current_level)
 
             if pulsebar._mute == "yes" then
-                preset.title = preset.title .. " Muted"
+                preset.title = preset.title .. " muted"
             end
 
             int = math.modf((pulsebar._current_level / 100) * awful.screen.focused().mywibox.height)
diff --git a/wiki b/wiki
index c221a2725d3968f85615328252b710fe0e60bd9e..d9029707520bf9ce8e3f695659d8ceea4fef0f01 160000 (submodule)
--- a/wiki
+++ b/wiki
@@ -1 +1 @@
-Subproject commit c221a2725d3968f85615328252b710fe0e60bd9e
+Subproject commit d9029707520bf9ce8e3f695659d8ceea4fef0f01