You are not logged in.
Pages: 1
hey, i'm messing around with awesomewm for the first time and getting familiar with lua by trying to write some widgets. my first is a simple battery notifcation widget that uses a text widget and awful progresbar
can anybody tell my why this is crashing awesome? I am requreing it after awful in my rc.lua and adding both the text and progrsesbar to the wibox
Bw = {
charge = "n/a",
time = "n/a",
update = function(self, pbar, time)
stats = io.popen('acpi')
str = stats:read("*all")
self:parse_charge(str)
self:parse_time(str)
pbar.set_value(self.charge)
time.text = self.time
end,
parse_charge = function(self, str)
match = "%d%d%d?%%"
chargeraw = string.match(str, match)
chargei = string.sub(chargeraw, 0, -2)
self.charge = chargei/100
end,
parse_time = function(self, str)
match = "%d%d:%d%d:%d%d"
timestr = string.match(str, match)
self.time = timestr
end
}
bat_text = widget({ type = "textbox", name = "bat_text", align = "right" })
bat_text.text = ""
batprog = awful.widget.progressbar()
batprog:set_width(8)
batprog:set_height(10)
batprog:set_vertical(true)
batprog:set_background_color('#494B4F')
batprog:set_color('#AECF96')
batprog:set_gradient_colors({ '#AECF96', '#88A175', '#FF5656' })
Bw:update(batprog, bat_text)
bwtimer = timer({ timeout = 300 })
bwtimer:add_signal("timeout", function() Bw:update(batprog, bat_text) end)
bwtimer:start()
Offline
Don't you think including the error would be a good idea?
You need to install an RTFM interface.
Offline
no error. awesome fails to load the script and reverts back to default config file, which i know because the theme changes. awesome -k shows that my config file is fine.
Offline
no error.
Not possible, read your stderr. Your code is broken somewhere and the lua stack trace will tell you where. I don't have motivation to debug your code line by line.
Edit: if you still can't figure it out, do it like this http://awesome.naquadah.org/wiki/Using_Xephyr
Last edited by anrxc (2011-11-20 21:53:44)
You need to install an RTFM interface.
Offline
i figured it out by looking at stderr. problem was pbar.set_time() instead of pbar:set_time(). too used to python and php
thanks for your help.
Offline
Hey, slipperysubject. A couple pointers: first, when you find a solution it's usually good to share it for posterity (which you did) and mark the topic as "Solved;" just edit the title. Second, as anrxc pointed out, using Xephyr can really save you from a headache if you make a mistake in rc.lua. There's even a package in the AUR--awmtt--that let's you do this easily. I use it any time I make changes to rc.lua, even if it's just changing a path to a theme file.
Offline
You can check .xsession-errors for errors as well.
Offline
Pages: 1