You are not logged in.

#1 2013-01-13 01:39:46

cris9288
Member
Registered: 2013-01-07
Posts: 348

[SOLVED]More problems with Awesome volume widget

My volume widget is causing my X server to crash. I have it commented out right now. If I remove the comment marker and restart awesome, I am logged out and show my Slim login prompt.


this seems to be a relevant entry in journalctl

Jan 12 17:12:45 christian slim[849]: /usr/share/awesome/lib/gears/debug.lua:23: Assertion failed: 'false'
Jan 12 17:12:45 christian slim[849]: stack traceback:
Jan 12 17:12:45 christian slim[849]: /usr/share/awesome/lib/gears/debug.lua:23: in function 'assert'
Jan 12 17:12:45 christian slim[849]: /usr/share/awesome/lib/wibox/widget/base.lua:111: in function 'check_widget'
Jan 12 17:12:45 christian slim[849]: /usr/share/awesome/lib/wibox/layout/fixed.lua:59: in function 'add'
Jan 12 17:12:45 christian slim[849]: /home/christian/.config/awesome/rc.lua:221: in main chunk
Jan 12 17:12:45 christian slim[849]: /usr/share/awesome/lib/wibox/widget/systray.lua:60: More than one systray created!
Jan 12 17:12:45 christian slim[849]: E: awesome: main:520: couldn't find any rc file

X server exits after that last entry.
here is my volume function

local wibox = require("wibox")
local awful = require("awful")

volume_widget = wibox.widget.textbox()
volume_widget:set_align("right")

function volume(mode, widget)

     local cardid  = 0
     local channel = "Master"
     if mode == "update" then
         local status = io.popen("amixer -c " .. cardid .. " -- sget " .. channel):read("*all")
         
         local volume = tonumber(string.match(status, "(%d?%d?%d)%%"))
 
         status = string.match(status, "%[(o[^%]]*)%]")
 
         local color = "#FF0000"
         if string.find(status, "on", 1, true) then
              color = "#00FF00"
         end
         status = ""
         for i = 1, math.floor(volume / 10) do
             status = status .. "|"
         end
         for i = math.floor(volume / 10) + 1, 10 do
             status = status .. "-"
         end
         status = "-[" ..status .. "]+"
         volume_widget:set_markup("<span color=\"" .. color .. "\">" .. status .. "</span>")
     elseif mode == "up" then
         os.execute("amixer -q -c " .. cardid .. " sset " .. channel .. " 5%+")
         volume("update", widget)
     elseif mode == "down" then
         os.execute("amixer -q -c " .. cardid .. " sset " .. channel .. " 5%-")
         volume("update", widget)
     else
         os.execute("amixer -c " .. cardid .. " sset " .. channel .. " toggle")
         volume("update", widget)
     end
end
volume("update", volume_widget)

mytimer = timer({ timeout = 0.5 })
mytimer:connect_signal("timeout", function () volume("update", volume_widget) end)
mytimer:start()

I'm not sure why this function is making awesome think there are two systrays being created. Nothing changes in my rc.lua other than adding the widget to my wibox. I could post my rc.lua if needed. Does anyone have any ideas? Thanks for any help.

Last edited by cris9288 (2013-01-13 02:20:04)

Offline

#2 2013-01-13 02:19:11

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: [SOLVED]More problems with Awesome volume widget

ok nevermind. I'm so very stupid. Forgot require = ("volume") (had it there originally) and wrong widget name. I'll mark this as solved.

For anyone else trying to debug config errors: if the X server exits it might help to remove the add:systray line in the default rc.lua. This prevents two systrays from being created if there is an error after that point the the custom config file. Apparently, all configurations up to the point of an error remain in place, even as the default config is being applied. I did not know that. Maybe other people do, but I don't want this to be a complete waste of a thread.

Offline

Board footer

Powered by FluxBB