You are not logged in.

#1 2015-09-06 06:09:18

enzyme
Member
Registered: 2015-08-08
Posts: 44

network widget error (solved)

im trying to setup a network widget using the awesome.naquadwhatever page https://awesome.naquadah.org/wiki/Gigamo_Wifi_Widget
and i come across this error. I tried using the edited version at the bottom of the page and it gave me another error about awk i dont remember its not important.

so the error im getting is:
/home/user/.config/awesome/rc.lua:126 '}' expected (to close '{' at line 123) near 'function'

ive looked around maybe i didnt use the right keywords when searching and the stuff that might have helped me maybe i didnt know how to read haha im still really new at this but im doing my best to teach myself and learn

ok so heres my rc.lua

so my question is what might i be doing wrong or can you direct me to a page that is actually readable?

115   -- {{{ Wibox
116
117   -- Initialize widget
118   cpuwidget = wibox.widget.textbox()
119   -- Register widget
120   vicious.register(cpuwidget, vicious.widgets.cpu, "|@$1% CPU|")
121 
122   -- Initialize widget
123    wifiwidget = widget({type = "textbox", name = "wifiwidget", align = "right"
124   -- Register widget 
125 
126   function wifiInfo()
127        spacer = " "
128        local wifiStrength = execute_command("awk 'NR==3 {print \$3 \"%\"} /proc/net/wireless | sed 's/\\\.//g'")
129        wifiwidget.text = "Wifi:"..spacer..wifiStrength..spacer
130    end
131
132   -- Initialize widget
memwidget = wibox.widget.textbox()
-- Register widget
vicious.register(memwidget, vicious.widgets.mem, "@$1% RAM|", 13)

-- Create a textclock widget
mytextclock = awful.widget.textclock()

-- 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, awful.tag.viewtoggle),
                    awful.button({ modkey }, 3, awful.client.toggletag),
                    awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
                    awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
                    )
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
                     awful.button({ }, 1, function (c)
                                              if c == client.focus then
                                                  c.minimized = true
                                              else
                                                  -- Without this, the following
                                                  -- :isvisible() makes no sense
                                                  c.minimized = false
                                                  if not c:isvisible() then
                                                      awful.tag.viewonly(c:tags()[1])
                                                  end
                                                  -- This will also un-minimize
                                                  -- the client, if needed
                                                  client.focus = c
                                                  c:raise()
                                              end
                                          end),
                     awful.button({ }, 3, function ()
                                              if instance then
                                                  instance:hide()
                                                  instance = nil
                                              else
                                                  instance = awful.menu.clients({
                                                      theme = { 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] = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    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(s, awful.widget.taglist.filter.all, mytaglist.buttons)

    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)

    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s })

    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(mylauncher)
    left_layout:add(mytaglist[s])
    left_layout:add(mypromptbox[s]) 
    

    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(cpuwidget)
    right_layout:add(memwidget)
    right_layout:add(volume_widget)
    --wifi widget call
    right_layout:add(wifi_widget)
    right_layout:add(mytextclock)
    right_layout:add(mylayoutbox[s])

    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    --layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)

    mywibox[s]:set_widget(layout)
end
-- }}}

Last edited by enzyme (2015-09-06 06:17:40)

Offline

#2 2015-09-06 06:16:58

enzyme
Member
Registered: 2015-08-08
Posts: 44

Re: network widget error (solved)

nevermind i figured it out lol

Offline

#3 2015-09-06 11:39:41

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,744
Website

Re: network widget error (solved)

enzyme wrote:

nevermind i figured it out lol

Please post your solution for the benefit of others.
https://wiki.archlinux.org/index.php/Fo … way_street

Offline

Board footer

Powered by FluxBB