From: Luke Bonham Date: Wed, 13 Sep 2017 10:33:40 +0000 (+0200) Subject: pulseaudio -> pulse; scallback merged into cmd (read wiki) X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/055e663772628e5a2ddb9c056da7222af517d086?hp=c2b186467c679338417b6f282f9f115ae6860716 pulseaudio -> pulse; scallback merged into cmd (read wiki) --- diff --git a/.gitmodules b/.gitmodules index a50818f..d95bcb5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 37c2141..e9dcc0b 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -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. diff --git a/README.rst b/README.rst index 9ba9715..84cdc8b 100644 --- a/README.rst +++ b/README.rst @@ -5,10 +5,10 @@ Lain Layouts, widgets and utilities for Awesome WM 4.x ------------------------------------------------- -:Author: Luke Bonham +:Author: Luca CPZ :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 diff --git a/lain-git.rockspec b/lain-git.rockspec index 1b42903..acb1967 100644 --- a/lain-git.rockspec +++ b/lain-git.rockspec @@ -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 = { diff --git a/scripts/dfs b/scripts/dfs index 47c7b82..9e02a87 100755 --- a/scripts/dfs +++ b/scripts/dfs @@ -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 diff --git a/util/init.lua b/util/init.lua index c43a9ed..8e7b8ef 100644 --- a/util/init.lua +++ b/util/init.lua @@ -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 index 0000000..aa9d58e --- /dev/null +++ b/widget/pulse.lua @@ -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 index f9a2302..0000000 --- a/widget/pulseaudio.lua +++ /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 diff --git a/widget/pulsebar.lua b/widget/pulsebar.lua index f97b2d1..7a0a3d4 100644 --- a/widget/pulsebar.lua +++ b/widget/pulsebar.lua @@ -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 c221a27..d902970 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit c221a2725d3968f85615328252b710fe0e60bd9e +Subproject commit d9029707520bf9ce8e3f695659d8ceea4fef0f01