You are not logged in.

#1 2009-05-31 17:55:25

tyr0
Member
Registered: 2007-06-02
Posts: 152

[solved] Awesome3 config problem

Hi, I´m new to Awesome3 (3.3_rc4) and I tried to modify a rc.lua from the screenshot thread. Well, I tried to integrate the widget-code from the awesome-wiki, however, I encounter difficulties with the last line of the following code, which crashes awesome all the time:

mailwidget = widget({
    type = 'textbox',
    name = 'mailwidget'
--    align = 'right',
})
 
function run_script()
    local filedescriptor = io.popen('perl /home/thomas/.scripts/checkMail.pl')
    local value = filedescriptor:read()
    filedescriptor:close()

    return {value}
end
 
wicked.register(mailwidget, run_script, "$1", 90)
    ' <span color="#e2baf1">Mail:</span> $1'

Another problem affects the position of my widgets in the statusbar. The uncommented "align = 'right'" from the code above crashes awesome too. Don´t know why, because this happens only with two of the widgets. Here is the whole rc.lua:

require("awful")
require("beautiful")
require("naughty")
require("wicked")
require('invaders')
-- require("obvious.battery")

-- {{{ Variable definitions
theme_path = "/home/thomas/.config/awesome/themes/arch.lua"
beautiful.init(theme_path)

terminal = "urxvt"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor

modkey = "Mod1"

layouts =
{
    awful.layout.suit.tile,         -- 1
    awful.layout.suit.tile.left,     -- 2
    awful.layout.suit.tile.bottom,     -- 3
    awful.layout.suit.tile.top,        -- 4
    awful.layout.suit.fair,        -- 5
    awful.layout.suit.fair.horizontal,    -- 6 
    awful.layout.suit.max,        -- 7
    awful.layout.suit.max.fullscreen,    -- 8
    awful.layout.suit.magnifier,    -- 9
    awful.layout.suit.floating         -- 10
}

floatapps =
{
    -- by class
    ["MPlayer"] = true,
    ["feh"] = true,
    ["Heroes3.exe"] = true,
    ["Wine"] = true,
    -- by instance
        ["feh"] = true,
        ["mocp"] = true,
    ["H5_Game.exe"] = true
}

apptags =
{
    ["Gran Paradiso"] = { screen = 1, tag = 2 },
    ["Thunderbird-bin"] = { screen = 1, tag = 4 },
    ["Mplayer"] = { screen = 1, tag = 3 },
        ["soffice"] = { screen = 1, tag = 5 }
        -- ["Heroes3.exe"] = { screen = 1, tag = 3 },
}

use_titlebar = false
-- }}}

-- {{{ Tags
-- Define tags table.
tags = {}
tags.settings = {
    { name = "urxvt",   layout = layouts[1],  },
    { name = "www",     layout = layouts[1],  },
    { name = "media",   layout = layouts[7]  },
    { name = "mail",    layout = layouts[7],  },
    { name = "other",   layout = layouts[10], setslave = true },
}

-- Initialize tags
 for s = 1, screen.count() do
 tags[s] = {}
 for i, v in ipairs(tags.settings) do
 tags[s][i] = tag(v.name)
 tags[s][i].screen = s
 awful.tag.setproperty(tags[s][i], "layout",   v.layout)
 awful.tag.setproperty(tags[s][i], "setslave", v.setslave)
 awful.tag.setproperty(tags[s][i], "mwfact",   v.mwfact)
end
 tags[s][1].selected = true
end
-- }}}

-- {{{ Wibox
-- Create a textbox widget
mytextbox = widget({ type = "textbox", align = "right" })
-- Set the default text in textbox
mytextbox.text = "<b><small> " .. awesome.release .. " </small></b> "

-- Create a laucher widget and a main menu
myawesomemenu = {
   { "manual", terminal .. " -e man awesome" },
   { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
   { "restart", awesome.restart },
   { "quit", awesome.quit },
}

mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
                                        { "urxvt", terminal },
                    { "shutdown", terminal .. " -e poweroff" },
                    { "reboot", terminal .. "reboot" }
                                      }
})

mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
                                     menu = mymainmenu })

-- Create a systray
mysystray = widget({ type = "systray", align = "right" })

-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
                    awful.button({ }, 1, awful.tag.viewonly),
                    awful.button({ modkey }, 1, awful.client.movetotag),
                    awful.button({ }, 3, function (tag) tag.selected = not tag.selected end),
                    awful.button({ modkey }, 3, awful.client.toggletag),
                    awful.button({ }, 4, awful.tag.viewnext),
                    awful.button({ }, 5, awful.tag.viewprev)
                    )
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
                     awful.button({ }, 1, function (c)
                                              if not c:isvisible() then
                                                  awful.tag.viewonly(c:tags()[1])
                                              end
                                              client.focus = c
                                              c:raise()
                                          end),
                     awful.button({ }, 3, function ()
                                              if instance then
                                                  instance:hide()
                                                  instance = nil
                                              else
                                                  instance = awful.menu.clients({ width=250 })
                                              end
                                          end),
                     awful.button({ }, 4, function ()
                                              awful.client.focus.byidx(1)
                                              if client.focus then client.focus:raise() end
                                          end),
                     awful.button({ }, 5, function ()
                                              awful.client.focus.byidx(-1)
                                              if client.focus then client.focus:raise() end
                                          end))

for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = widget({ type = "textbox", align = "left" })
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = widget({ type = "imagebox", align = "right" })
    mylayoutbox[s]:buttons(awful.util.table.join(
                           awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
                           awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
                           awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist.new(s, awful.widget.taglist.label.all, mytaglist.buttons)
 
--    -- Gigamo battery widget
--        batterywidget = widget({type = "textbox", name = "batterywidget", align = "right" })
--
-- function batteryInfo(adapter)
--     spacer = " "
--            local fcur = io.open("/sys/class/power_supply/"..adapter.."/charge_now")    
--            local fcap = io.open("/sys/class/power_supply/"..adapter.."/charge_full")
--            local fsta = io.open("/sys/class/power_supply/"..adapter.."/status")
--            local cur = fcur:read()
--            local cap = fcap:read()
--            local sta = fsta:read()
--            local battery = math.floor(cur * 100 / cap)
--    if sta:match("Charging") then
--            dir = "^"
--            battery = "A/C ("..battery..")"
--    elseif sta:match("Discharging") then
--            dir = "v"
--    if tonumber(battery) > 25 and tonumber(battery) < 75 then
--            battery = battery
--    elseif tonumber(battery) < 25 then
--    if tonumber(battery) < 10 then
--            naughty.notify({ title      = "Battery Warning"
--            , text       = "Battery low!"..spacer..battery.."%"..spacer.."left!"
--            , timeout    = 5
--            , position   = "top_right"
--            , fg         = beautiful.fg_focus
--            , bg         = beautiful.bg_focus
--})
--end
--            battery = battery
--     else
--            battery = battery
--end
--   else
--      dir = "="
--      battery = "A/C"
--end
--      batterywidget.text = spacer.."Bat:"..spacer..dir..battery..dir..spacer
--      fcur:close()
--      fcap:close()
--      fsta:close()
--end
        
        -- Create a date widget
        mydatewidget = widget({
        type = "textbox",
        name = "mydatewidget",
        align = "right" })
        wicked.register(mydatewidget, wicked.widgets.date, " ::: %b %e, %R ", 1)

--    mytextbox.text = " " .. execute_command("perl /home/thomas/.scripts/conky-updates.pl") .. " 


      -- MPD
      
    mpdwidget = widget({
    type = 'textbox',
    name = 'mpdwidget',
    align = 'right',
    })
    wicked.register(mpdwidget, wicked.widgets.mpd, 
    function (widget, args)
           if args[1]:find("volume:") == nil then
              return ' <span color="#e2baf1">Now Playing:</span> '..args[1]
           else
                      return ''
                   end
        end)
        
    netwidget = widget({
    type = 'textbox',
    name = 'netwidget',
    align = 'right',
    })
    wicked.register(netwidget, wicked.widgets.net, 
        ' <span color="#e2baf1">Net:</span> ${wlan0 down} / ${wlan0 up}',
    nil, nil, 3)
    
    cpugraphwidget = widget({
        type = 'graph',
        name = 'cpugraphwidget',
        align = 'right',
    })

    cpugraphwidget.height = 0.85
    cpugraphwidget.width = 45
    cpugraphwidget.bg = '#333333'
    cpugraphwidget.border_color = '#0a0a0a'
    cpugraphwidget.grow = 'left'

    cpugraphwidget:plot_properties_set('cpu', {
        fg = '#AEC6D8',
    fg_center = '#285577',
    fg_end = '#e2baf1',
    vertical_gradient = false
    })    

    wicked.register(cpugraphwidget, wicked.widgets.cpu, '$1', 1, 'cpu')

--Mail
mailwidget = widget({
    type = 'textbox',
    name = 'mailwidget'
--    align = 'right',
})
 
function run_script()
    local filedescriptor = io.popen('perl /home/thomas/.scripts/checkMail.pl')
    local value = filedescriptor:read()
    filedescriptor:close()

    return {value}
end
 
-- Runs 'my_nifty_script.py' every 90 seconds and puts its output into the widget
wicked.register(mailwidget, run_script, "$1", 90)
--    ' <span color="#e2baf1">Mail:</span> $1'

--Arch
archwidget = widget({
    type = 'textbox',
    name = 'archwidget'
--    align = 'right',
})
 
function run_script()
    local filedescriptor = io.popen('perl /home/thomas/.scripts/conky-updates.pl')
    local value = filedescriptor:read()
    filedescriptor:close()

    return {value}
end
 
-- Runs 'my_nifty_script.py' every 90 seconds and puts its output into the widget
wicked.register(archwidget, run_script, "$1", 1000)


    -- Mousebindings for MPD
    mpdwidget:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.util.spawn("mpc toggle")  end),
    awful.button({ }, 4, function () awful.util.spawn("aumix -v +3") end),
    awful.button({ }, 5, function () awful.util.spawn("aumix -v -3") end),
    awful.button({ }, 8, function () awful.util.spawn("mpc prev") end),
    awful.button({ }, 9, function () awful.util.spawn("mpc next") end)))
    

    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist.new(function(c)
                                                  return awful.widget.tasklist.label.currenttags(c, s)
                                              end, mytasklist.buttons)

    -- Create the wibox
    mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal })
    -- Add widgets to the wibox - order matters
    mywibox[s].widgets = { mylauncher,
                           mytaglist[s],
                                                    -- mytasklist[s],
                                                 cpugraphwidget,
                                                    netwidget,
                                                     mypromptbox[s],
                                                     -- obvious.battery(),
                           -- mytextbox,
                                                     mpdwidget,
                                                     mailwidget,
                                                     archwidget,
                                                     mydatewidget,
                                                     mylayoutbox[s],
                           s == 1 and mysystray or nil }
    mywibox[s].screen = s
end
-- }}}

-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}

-- {{{ Key bindings
globalkeys = awful.util.table.join(
    awful.key({ modkey,           }, "h",   awful.tag.viewprev       ),
    awful.key({ modkey,           }, "l",  awful.tag.viewnext       ),
    awful.key({ modkey,           }, "Escape", awful.tag.history.restore),

    awful.key({ modkey,           }, "j",
        function ()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({ modkey,           }, "k",
        function ()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({ modkey,           }, "w", function () mymainmenu:show(true)        end),

    -- Layout manipulation
    awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1) end),
    awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1) end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus( 1)       end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1)       end),
    awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey,           }, "Tab",
        function ()
            awful.client.focus.history.previous()
            if client.focus then
                client.focus:raise()
            end
        end),

    -- Standard program
    awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift"   }, "q", awesome.quit),

    awful.key({ modkey,           }, "Right", function () awful.tag.incmwfact( 0.05)    end),
    awful.key({ modkey,           }, "Left",  function () awful.tag.incmwfact(-0.05)    end),
    awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
    awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
    awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
    awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
    awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
    awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),

    -- Mina
    awful.key({ }, "XF86AudioPlay",            function () awful.util.spawn("mpc toggle")  end),
    awful.key({ }, "XF86AudioStop",            function () awful.util.spawn("mpc stop")    end),
    awful.key({ }, "XF86AudioNext",            function () awful.util.spawn("mpc next")  end),
    awful.key({ }, "XF86AudioPrev",            function () awful.util.spawn("mpc prev")  end),
    awful.key({ }, "XF86AudioLowerVolume",     function () awful.util.spawn("aumix -v -3")  end),
    awful.key({ }, "XF86AudioRaiseVolume",     function () awful.util.spawn("aumix -v +3")  end),
    awful.key({ }, "XF86AudioMute",            function () awful.util.spawn("aumix -v mute")  end),
    awful.key({ }, "XF86HomePage",             function () awful.util.spawn("firefox")  end),
    awful.key({ }, "XF86Mail",                 function () awful.util.spawn("thunderbird3")  end),
    

    -- Prompt
    awful.key({ modkey }, "F2",
              function ()
                  awful.prompt.run({ prompt = " Run: " },
                  mypromptbox[mouse.screen],
                  awful.util.spawn, awful.completion.shell,
                  awful.util.getdir("cache") .. "/history")
              end),

    awful.key({ modkey }, "x",
              function ()
                  awful.prompt.run({ prompt = "Run Lua code: " },
                  mypromptbox[mouse.screen],
                  awful.util.eval, nil,
                  awful.util.getdir("cache") .. "/history_eval")
              end)
)

-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
clientkeys = awful.util.table.join(
    awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
    awful.key({ modkey, "Shift"   }, "c",      function (c) c:kill()                         end),
    awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
    awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
    awful.key({ modkey }, "t", awful.client.togglemarked),
    awful.key({ modkey,}, "m",
        function (c)
            c.maximized_horizontal = not c.maximized_horizontal
            c.maximized_vertical   = not c.maximized_vertical
        end)
)

-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
   keynumber = math.min(9, math.max(#tags[s], keynumber));
end

for i = 1, keynumber do
    table.foreach(awful.key({ modkey }, i,
                  function ()
                        local screen = mouse.screen
                        if tags[screen][i] then
                            awful.tag.viewonly(tags[screen][i])
                        end
                  end), function(_, k) table.insert(globalkeys, k) end)
    table.foreach(awful.key({ modkey, "Control" }, i,
                  function ()
                      local screen = mouse.screen
                      if tags[screen][i] then
                          tags[screen][i].selected = not tags[screen][i].selected
                      end
                  end), function(_, k) table.insert(globalkeys, k) end)
    table.foreach(awful.key({ modkey, "Shift" }, i,
                  function ()
                      if client.focus and tags[client.focus.screen][i] then
                          awful.client.movetotag(tags[client.focus.screen][i])
                      end
                  end), function(_, k) table.insert(globalkeys, k) end)
    table.foreach(awful.key({ modkey, "Control", "Shift" }, i,
                  function ()
                      if client.focus and tags[client.focus.screen][i] then
                          awful.client.toggletag(tags[client.focus.screen][i])
                      end
                  end), function(_, k) table.insert(globalkeys, k) end)
    table.foreach(awful.key({ modkey, "Shift" }, "F" .. i,
                  function ()
                      local screen = mouse.screen
                      if tags[screen][i] then
                          for k, c in pairs(awful.client.getmarked()) do
                              awful.client.movetotag(tags[screen][i], c)
                          end
                      end
                   end), function(_, k) table.insert(globalkeys, k) end)
end

-- Set keys
root.keys(globalkeys)
-- }}}

-- {{{ Hooks
-- Hook function to execute when focusing a client.
awful.hooks.focus.register(function (c)
    if not awful.client.ismarked(c) then
        c.border_color = beautiful.border_focus
    end
end)

-- Hook function to execute when unfocusing a client.
awful.hooks.unfocus.register(function (c)
    if not awful.client.ismarked(c) then
        c.border_color = beautiful.border_normal
    end
end)

-- Hook function to execute when marking a client
awful.hooks.marked.register(function (c)
    c.border_color = beautiful.border_marked
end)

-- Hook function to execute when unmarking a client.
awful.hooks.unmarked.register(function (c)
    c.border_color = beautiful.border_focus
end)

-- Hook function to execute when a new client appears.
awful.hooks.manage.register(function (c, startup)
    -- If we are not managing this application at startup,
    -- move it to the screen where the mouse is.
    -- We only do it for filtered windows (i.e. no dock, etc).
    if not startup and awful.client.focus.filter(c) then
        c.screen = mouse.screen
    end

    if use_titlebar then
        -- Add a titlebar
        awful.titlebar.add(c, { modkey = modkey })
    end
    -- Add mouse bindings
    c:buttons(awful.util.table.join(
        awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
        awful.button({ modkey }, 1, awful.mouse.client.move),
        awful.button({ modkey }, 3, awful.mouse.client.resize)
    ))
    -- New client may not receive focus
    -- if they're not focusable, so set border anyway.
    c.border_width = beautiful.border_width
    c.border_color = beautiful.border_normal

    -- Check if the application should be floating.
    local cls = c.class
    local inst = c.instance
    if floatapps[cls] then
        awful.client.floating.set(c, floatapps[cls])
        elseif floatapps[inst] then
        awful.client.floating.set(c, floatapps[inst])
    end

    -- Check application->screen/tag mappings.
    local target
    if apptags[cls] then
        target = apptags[cls]
    elseif apptags[inst] then
        target = apptags[inst]
    end
    if target then
        c.screen = target.screen
        awful.client.movetotag(tags[target.screen][target.tag], c)
    end

    -- Do this after tag mapping, so you don't see it on the wrong tag for a split second.
    client.focus = c

    -- Set key bindings
    c:keys(clientkeys)

    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)

    -- Honor size hints: if you want to drop the gaps between windows, set this to false.
     c.size_hints_honor = false

    awful.placement.centered(c)

end)

-- Hook function to execute when arranging the screen.
-- (tag switch, new client, etc)
awful.hooks.arrange.register(function (screen)
    local layout = awful.layout.getname(awful.layout.get(screen))
    if layout and beautiful["layout_" ..layout] then
        mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
    else
        mylayoutbox[screen].image = nil
    end

    -- Give focus to the latest client in history if no window has focus
    -- or if the current window is a desktop or a dock one.
    if not client.focus then
        local c = awful.client.focus.history.get(screen, 0)
        if c then client.focus = c end
    end
end)

awful.hooks.timer.register(3, function()
      batteryInfo("BAT0")
             end)

-- Hook called every minute
awful.hooks.timer.register(60, function ()
    mytextbox.text = os.date(" %a %b %d, %H:%M ")
end)
-- }}}


-- {{ Quick'n'Dirty Autostart
-- awful.util.spawn("xset r rate 200 30")
-- awful.util.spawn("numlockx")
-- awful.util.spawn("setxkbmap se")
-- awful.util.spawn("xrandr --output LVDS --off")
-- awful.util.spawn("xrandr --output VGA-0 --mode 1680x1050")
-- awful.util.spawn("mount /media/usb")
-- awful.util.spawn("gsynaptics-init")
awful.util.spawn("keytouchd")
awful.util.spawn("xscreensaver -no-splash")
awful.util.spawn("urxvtd -q -f -o")
awful.util.spawn("nm-applet")
awful.util.spawn("xcompmgr -c -t-5 -l-5 -r4.2 -o.80")
-- awful.util.spawn("xsetroot -cursor_name obsidian")
awful.util.spawn("xrdb -merge ~/.Xdefaults")
-- }}

Thank you very much for every hint!

Last edited by tyr0 (2009-06-01 15:51:54)

Offline

#2 2009-05-31 23:18:46

dunz0r
Member
From: Sweden
Registered: 2009-03-30
Posts: 258
Website

Re: [solved] Awesome3 config problem

the wicked.register thing looks wrong.
should be iirc

wicked.register(mailwidget, run_script, "$1", 90,
' <span color="#e2baf1">Mail:</span> $1')

RTFM or GTFO
hax0r.se

Offline

#3 2009-06-01 03:48:46

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: [solved] Awesome3 config problem

tyr0 wrote:

The uncommented "align = 'right'" from the code above crashes awesome too. Don´t know why, because this happens only with two of the widgets.

You can't just uncomment the line.  "name" would no longer be the last element, so you need to add a comma.  I've also seen in #awesome that trailing commas are no longer allowed in the 3.3 branch (I still use 3.2.1, so I can't confirm this myself).  In any case, it won't hurt to remove the trailing comma.

mailwidget = widget({
    type = 'textbox',
    name = 'mailwidget',
    align = 'right'
})

Offline

#4 2009-06-01 08:39:39

tyr0
Member
Registered: 2007-06-02
Posts: 152

Re: [solved] Awesome3 config problem

tdy, thank you. The comma thing was the problem. I should have noticed it. However, wicked.register still does not work, but thank you for the hint, dunz0r.

Last edited by tyr0 (2009-06-01 12:20:42)

Offline

#5 2009-06-01 14:36:09

tyr0
Member
Registered: 2007-06-02
Posts: 152

Re: [solved] Awesome3 config problem

This problem is really strange:

archwidget = widget({
    type = 'textbox',
    name = 'archwidget',
    align = 'right'
})
 
function run_script()
    local filedescriptor = io.popen('perl /home/thomas/.scripts/conky-updates.pl')
    local value = filedescriptor:read()
    filedescriptor:close()

    return {value}
end
 
wicked.register(archwidget, run_script, "$1", 1000,
    ' <span color="#e2baf1">arch:</span> $1')

-- cpu-widget
    
cpuwidget = widget({
    type = 'textbox',
    name = 'cpuwidget',
    align = 'right'
})

wicked.register(cpuwidget, wicked.widgets.cpu,
    ' <span color="#e2baf1">CPU:</span> $1%')

The cpuwidget works properly, the archwidget does not show anything. Maybe it does not call the output value of the perl-script...

EDIT: Solved, the correct line is:

wicked.register(archwidget, run_script, '<span color="#e2baf1"> arch:</span> $1', 1000)

Last edited by tyr0 (2009-06-01 15:22:21)

Offline

Board footer

Powered by FluxBB