You are not logged in.

#1 2008-06-02 01:31:07

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Awesome wicked widget help

I've been racking my brain over this for a couple days now, so hopefully I just need a new set of eyes to see what I'm doing wrong.

Trying to get the date widget from wicked working, and I can't seem to find a problem with it, but it isn't displaying.

.awesomerc.lua

--Clock
clock_wid = widget.new({ type = 'textbox',
                  name = 'clock_wid',
                  align = 'right'
})
wicked.register(clock_wid, 'date','Test: %A %d %B %Y %r')

and down at the status bar:

topbar:widget_add(clock_wid)

Can anyone help me with this? hmm

Offline

#2 2008-06-02 04:53:22

rizzix
Member
Registered: 2005-10-22
Posts: 55

Re: Awesome wicked widget help

I'm sorry but I have no idea. However I just wanted to say that it's really amusing to see such wicked, awesome and amazing posts by awesome users. tongue

Last edited by rizzix (2008-06-02 04:54:10)

Offline

#3 2008-06-02 06:38:13

Abelian
Member
Registered: 2008-04-23
Posts: 63

Re: Awesome wicked widget help

heleos, that worked fine for me:

--Clock
clock_wid = widget.new({ type = 'textbox',
                  name = 'clock_wid',
                  align = 'right'
})
wicked.register(clock_wid, 'date','Test: %A %d %B %Y %r')
-- Create a statusbar for each screen and add it
for s = 1, screen.count() do
    mystatusbar = statusbar.new({ position = "top", name = "mystatusbar" .. s,
                                fg = fg_normal, bg = bg_normal })
    mystatusbar:widget_add(mytaglist)
    mystatusbar:widget_add(mpdwidget)
    mystatusbar:widget_add(gmailwidget)
    mystatusbar:widget_add(clock_wid)
    mystatusbar:add(s)
end
-- }}}

Offline

#4 2008-06-02 09:49:02

GGLucas
Member
Registered: 2008-03-13
Posts: 113

Re: Awesome wicked widget help

It works here as well, did you make sure to get the absolute latest versions of both awesome-git and wicked-git ? There have been a lot of changes in how wicked communicates with awesome due to new features in the past few days, maybe you're using a newer version of wicked with a version of awesome that doesn't have those features.

Offline

#5 2008-06-02 09:54:24

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Re: Awesome wicked widget help

I dont think I am. I'm a little confused about how git works though. I'm sure to get the latest versions if I do a yaourt -Syu awesome-git wicked-git correct? I guess I can try removing all the configs and doing a new install?

edit: No luck. I don't know what I could be doing wrong, but I'm sure its something really simple

Last edited by heleos (2008-06-02 10:03:13)

Offline

#6 2008-06-02 10:01:49

GGLucas
Member
Registered: 2008-03-13
Posts: 113

Re: Awesome wicked widget help

Doing `yaourt -Sy awesome-git wicked-git` should give you the latest versions (leave out the u, or it'll only try to upgrade, which it won't do because it's in the aur)

Offline

#7 2008-06-02 10:17:07

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Re: Awesome wicked widget help

That didn't help. Still no clock... I just did a fresh install of linux, is there some library I'm missing or something?

Offline

#8 2008-06-02 10:22:37

Abelian
Member
Registered: 2008-04-23
Posts: 63

Re: Awesome wicked widget help

Post your .awesomerc.lua so we can see if your missing anything in there.

btw, nice avatar smile

Offline

#9 2008-06-02 15:52:07

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Re: Awesome wicked widget help

I'll post it when I get home, I'm currently at work.

I like the icon too, someone made it in the artwork forum smile

Offline

#10 2008-06-02 18:51:12

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Re: Awesome wicked widget help

Alright, here's my awesomerc:

-- awesome 3 configuration file

-- Include awesome library, with lots of useful function!
require("awful")
require("wicked")
--require("eminent")

-- {{{ Defaults
default_font = 'Bitstream Vera Sans Mono 8'
default_mwfact = 0.79
spacer = " "
separator = " "
--menu = 'mydmenu'

terminal = 'urxvt'
filemanager = 'thunar'
webbrowser = 'opera'
musicplayer = 'urxvt -e mocp'
--musicplayer = 'urxvt -e ncmpc'

music_toggle = 'mocp -G'
music_stop = 'mocp -s'
music_next = 'mocp -f'
music_prev = 'mocp -r'

--[[
music_toggle = 'mpc toggle'
music_stop = 'mpc stop'
music_next = 'mpc next'
music_prev = 'mpc prev'
--]]

-- Background Colors
bg_normal = '#000000'
bg_focus = '#555555'
bg_urgent = '#FF0000'

-- Text Colors
fg_normal = '#FFFFFF'
fg_focus = 'light blue'
fg_urgent = '#FFFFFF'

-- Border Colors
border_width = '2'
border_normal = '#000000'
border_focus = '#555555'

-- Title Bar Colors
bg_normal_t = '#555555'
bg_focus_t = '#000000'
fg_normal_t = 'light blue'
fg_focus_t = '#ffffff'

modkey = "Mod4"
-- Other layouts: magnifier, spiral, dwindle, tileleft
layouts = { "tile", "tilebottom", "tiletop", "max", "floating" }

-- Setting Defaults:
awesome.colors_set({ fg = fg_normal, bg = bg_normal })
-- }}}

-- {{{
function bg(colour, text)
    return '<bg color="'..colour..'" />'..text
end
function fg(colour, text)
    return '<span color="'..colour..'">'..text..'</span>'
end
function font(font, text)
    return '<span font_desc="'..font..'">'..text..'</span>'
end
function title()
    return '<title />'
end
function title_normal()
    return bg(bg_normal, fg(fg_normal, font(default_font, title())))
end
function title_focus()
    return bg(bg_focus, fg(fg_focus, font(default_font, title())))
end
function title_urgent()
    return bg(bg_urgent, fg(fg_urgent, font(default_font, title())))
end
-- {{{
-- Titlebar Color
 
  function title_normal_t()
      return bg(bg_normal_t, fg(fg_normal_t, font(default_font, title())))
  end
  function title_focus_t()
      return bg(bg_focus_t, fg(fg_focus_t, font(default_font, title())))
  end
 
function heading(text)
    return fg(fg_focus, font(default_font, text))
end
-- }}}

-- {{{ Tags
-- Define tags table
tags = {}
for s = 1, screen.count() do
    -- Each screen has its own tag table
    tags[s] = {}
    -- Create 9 tags per screen
    for tagnumber = 1, 4 do
        tags[s][tagnumber] = tag.new({ name = tagnumber })
        -- Add tags to screen one by one
        tags[s][tagnumber]:add(s)
    end
    -- I'm sure you want to see at least one tag.
    tags[s][1]:view(true)
    tags[s][1]:mwfact_set(default_mwfact)
    -- Rename tags
    tags[s][1]:name_set("main")
    tags[s][1]:layout_set("floating")
    tags[s][2]:name_set("www")
    tags[s][2]:layout_set("tilebottom")
    tags[s][3]:name_set("code")
    tags[s][3]:layout_set("tile")
    tags[s][4]:name_set("float")
    tags[s][4]:layout_set("floating")
end
-- }}}

--{{{ Widgets
--Clock
clock_wid = widget.new({ type = 'textbox',
             name = 'clock_wid',
             align = 'right'
})
wicked.register(clock_wid, 'date','Test: %A %d %B %Y %r')
--[[ MPD
mpd_wid = widget.new({ type = "textbox", name = "mpd_wid", align = "left" })
mpd_wid:set("text", "[]: not playing")
mpd_wid = widget.new({ type = 'textbox', name = 'mpd_wid'})
wicked.register(mpd_wid, 'mpd', ' <span color="white">Now Playing:</span> $1')
--]]
--}}}

-- {{{ Statusbar
-- Create a taglist widget
mytaglist = widget.new({ type = "taglist", name = "mytaglist" })
mytaglist:mouse({}, 1, awful.tag.viewonly)
mytaglist:mouse({ modkey }, 1, awful.client.toggletag)
mytaglist:mouse({}, 3,
                function (tag)
                    tag:view(not tag:isselected())
                end)
mytaglist:mouse({ modkey }, 3, awful.client.toggletag)
mytaglist:mouse({ }, 4, awful.tag.viewnext)
mytaglist:mouse({ }, 5, awful.tag.viewprev)

mytaglist:set('text_normal',spacer..title_normal()..spacer)
mytaglist:set('text_focus',spacer..title_focus()..spacer)
mytaglist:set('text_urgent',spacer..title_urgent()..spacer)

-- Create a tasklist widget
mytasklist = widget.new({ type = "tasklist", name = "mytasklist" })
mytasklist:mouse({ }, 1, function (c) c:focus_set() end)
mytasklist:mouse({ }, 4, function () awful.client.focus(1) end)
mytasklist:mouse({ }, 5, function () awful.client.focus(-1) end)

mytasklist:set('text_normal',spacer..title_normal()..spacer)
mytasklist:set('text_focus',spacer..title_focus()..spacer)
mytasklist:set('text_urgent',spacer..title_urgent()..spacer)

-- Create a textbox widget
mytextbox = widget.new({ type = "textbox", name = "mytextbox", align = "left" })
-- Set the default text in textbox
mytextbox:set("text", "<b><small> awesome " ..AWESOME_VERSION.. " </small></b>")

-- Create an iconbox widget
myiconbox = widget.new({ type = "iconbox", name = "myiconbox", align = "right" })
myiconbox:set("image", "/usr/share/awesome/icons/awesome16.png")

-- Create an iconbox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox = {}
for s = 1, screen.count() do
    mylayoutbox[s] = widget.new({ type = "iconbox", name = "myiconbox", align = "left" })
    mylayoutbox[s]:mouse({ }, 1, function () awful.layout.inc(layouts, 1) end)    
    mylayoutbox[s]:mouse({ }, 3, function () awful.layout.inc(layouts, -1) end)    
    mylayoutbox[s]:mouse({ }, 4, function () awful.layout.inc(layouts, 1) end)    
    mylayoutbox[s]:mouse({ }, 5, function () awful.layout.inc(layouts, -1) end)    
    mylayoutbox[s]:set("image", "/usr/share/awesome/icons/layouts/tilew.png")
end

-- Create a statusbar for each screen and add it
for s = 1, screen.count() do
    topbar = statusbar.new({ position = "top", name = "topbar" .. s,
                                fg = fg_normal, bg = bg_normal })
    -- Add widgets to the statusbar - order matters
    topbar:widget_add(mytaglist)
    topbar:widget_add(mylayoutbox[s])
    topbar:widget_add(mytasklist)
    topbar:widget_add(clock_wid)
    topbar:widget_add(myiconbox)
    topbar:add(s)
    mytitlebar = titlebar.new({ position = "top" , name = 'titlebar',
    height= 10 , text_normal = title_normal_t() ,text_focus = title_focus_t()})
end
-- }}}

-- {{{ Mouse bindings
awesome.mouse({ }, 3, function () awful.spawn(terminal) end)
awesome.mouse({ }, 4, awful.tag.viewnext)
awesome.mouse({ }, 5, awful.tag.viewprev)
client.mouse({ }, 1, function (c) c:focus_set(); c:raise() end)
client.mouse({ modkey }, 1, function (c) c:mouse_move() end)
client.mouse({ modkey }, 3, function (c) c:mouse_resize() end)
-- Titlebar Bindings
titlebar.mouse({ }, 1, function (c) c:focus_set(); c:raise(); c:mouse_move() end)
titlebar.mouse({ }, 3, function (c) c:mouse_resize() end)
titlebar.mouse({ }, 2, function() client.focus_get():kill() end)
titlebar.mouse({ }, 4, function() awful.client.togglefloating() end)
-- }}}

-- {{{ Key bindings

-- Bind keyboard digits
-- 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
    keybinding.new({ modkey }, i,
                   function ()
                       local screen = mouse.screen_get()
                       if tags[screen][i] then
                           awful.tag.viewonly(tags[screen][i])
                       end
                   end):add()
    keybinding.new({ modkey, "Control" }, i,
                   function ()
                       local screen = mouse.screen_get()
                       if tags[screen][i] then
                           tags[i]:view(not tags[screen][i]:isselected())
                       end
                   end):add()
    keybinding.new({ modkey, "Shift" }, i,
                   function ()
                       local screen = mouse.screen_get()
                       if tags[screen][i] then
                           awful.client.movetotag(tags[screen][i])
                       end
                   end):add()
    keybinding.new({ modkey, "Control", "Shift" }, i,
                   function ()
                       local screen = mouse.screen_get()
                       if tags[screen][i] then
                           awful.client.toggletag(tags[screen][i])
                       end
                   end):add()
end

keybinding.new({ modkey }, "Left", awful.tag.viewprev):add()
keybinding.new({ modkey }, "Right", awful.tag.viewnext):add()

-- Standard program
keybinding.new({ modkey }, "Return", function () awful.spawn(terminal) end):add()

keybinding.new({ modkey, "Control" }, "r", awesome.restart):add()
keybinding.new({ modkey, "Shift" }, "q", awesome.quit):add()

-- Client manipulation
keybinding.new({ modkey, "Shift" }, "c", function () client.focus_get():kill() end):add()
keybinding.new({ modkey }, "j", function () awful.client.focus(1); client.focus_get():raise() end):add()
keybinding.new({ modkey }, "k", function () awful.client.focus(-1);  client.focus_get():raise() end):add()
keybinding.new({ modkey, "Shift" }, "j", function () awful.client.swap(1) end):add()
keybinding.new({ modkey, "Shift" }, "k", function () awful.client.swap(-1) end):add()
keybinding.new({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add()
keybinding.new({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add()
keybinding.new({ modkey, "Control" }, "space", function () awful.client.togglefloating() end):add()

-- Layout manipulation
keybinding.new({ modkey }, "l", function () awful.tag.incmwfact(0.05) end):add()
keybinding.new({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end):add()
keybinding.new({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(1) end):add()
keybinding.new({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end):add()
keybinding.new({ modkey, "Control" }, "h", function () awful.tag.incncol(1) end):add()
keybinding.new({ modkey, "Control" }, "l", function () awful.tag.incncol(1) end):add()
keybinding.new({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
keybinding.new({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()

-- Custom bindings
keybinding.new({ modkey }, "f", function () awful.spawn(filemanager) end):add()
keybinding.new({ modkey }, "t", function () awful.spawn(terminal) end):add()
keybinding.new({ modkey }, "w", function () awful.spawn(webbrowser) end):add()
keybinding.new({ modkey }, "g", function () awful.spawn(musicplayer) end):add()

keybinding.new({ modkey }, "z", function () awful.spawn(music_prev) end):add()
keybinding.new({ modkey }, "x", function () awful.spawn(music_stop) end):add()
keybinding.new({ modkey }, "v", function () awful.spawn(music_toggle) end):add()
keybinding.new({ modkey }, "b", function () awful.spawn(music_next) end):add()
-- }}}


-- {{{ Hooks
-- Hook function to execute when focusing a client.
function hook_focus(c)
    c:border_set({ width = 1, color = "#999999" })
end

-- Hook function to execute when unfocusing a client.
function hook_unfocus(c)
    c:border_set({ width = 1, color = "black" })
end

-- Hook function to exeucte when the mouse is over a client.
function hook_mouseover(c)
    -- Sloppy focus, but disabled for magnifier layout
    if awful.layout.get(c:screen_get()) ~= "magnifier" then
        c:focus_set()
    end
end

-- Hook function to execute when a new client appears.
function hook_newclient(c)
      if c:name_get() ~= "panel" then
        c:titlebar_set(mytitlebar)
      end
      
      -- Prevents new windows from becoming master
    cls = client.visible_get(mouse.screen_get())
    for i,p in pairs(cls) do
        if p ~= c then
            c:swap(p)
            break
        end
    end
    
    -- New client may not receive focus
    -- if they're not focusable, so set border anyway.
    c:border_set({ width = 1, color = "black" })
    c:focus_set()
    if c:name_get():lower():find("mplayer") then
        c:floating_set(true)
    end
    if c:name_get():lower():find("pidgin") then
    c:floating_set(true)
    end
    if c:name_get():lower():find("gimp") then
    c:floating_set(true)
    end
    if c:name_get():lower():find("opera") then
    
    end
    if c:name_get():lower():find("thunar") then
    c:floating_set(true)
    end
end

-- Hook function to execute when arranging the screen
-- (tag switch, new client, etc)
function hook_arrange(screen)
    local layout = awful.layout.get(screen)
    mylayoutbox[screen]:set("image", "/usr/share/awesome/icons/layouts/" .. layout .. "w.png")
end

-- Hook called every 60 seconds
function hook_timer ()
--    mytextbox:set("text", os.time() .. " time_t")
end

-- Hook for urgency hints
function hook_urgent ()

end

-- Set up some hooks
hooks.focus(hook_focus)
hooks.unfocus(hook_unfocus)
hooks.newclient(hook_newclient)
hooks.mouseover(hook_mouseover)
hooks.arrange(hook_arrange)
hooks.timer(1, hook_timer)
hooks.urgent(hook_urgent)
-- }}}

-- Respect size hints
awesome.resizehints_set(false)

Offline

#11 2008-06-02 20:31:46

GGLucas
Member
Registered: 2008-03-13
Posts: 113

Re: Awesome wicked widget help

Ah, I see the problem, you're using the hooks functions, using those, you can only use one function per hook, this is not recommended because it doesn't allow for external libraries like wicked to use their own hooks, instead, use the awful.hooks functions, replace this bit:

hooks.focus(hook_focus)
hooks.unfocus(hook_unfocus)
hooks.newclient(hook_newclient)
hooks.mouseover(hook_mouseover)
hooks.arrange(hook_arrange)
hooks.timer(1, hook_timer)
hooks.urgent(hook_urgent)

with

awful.hooks.focus(hook_focus)
awful.hooks.unfocus(hook_unfocus)
awful.hooks.newclient(hook_newclient)
awful.hooks.mouseover(hook_mouseover)
awful.hooks.arrange(hook_arrange)
awful.hooks.timer(1, hook_timer)
awful.hooks.urgent(hook_urgent)

That should make it work.

Last edited by GGLucas (2008-06-02 20:32:28)

Offline

#12 2008-06-02 20:50:42

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Re: Awesome wicked widget help

Hmmm.... I must confess my undying love for you! Thank you so much! I figured it was something easy like that, since everyone elses functions were working. Is there any disadvantages of using awful.hook instead of hook?

ALSO, i'm going to hijack my own thread, since you may know the answer tongue
How can I make certain windows spawn in certain tags?

Offline

#13 2008-06-02 20:54:51

Abelian
Member
Registered: 2008-04-23
Posts: 63

Re: Awesome wicked widget help

No disadvantages, only advantages. Here is a bit of my hooks section that has the "send to tag":

function hook_newclient(c)
    c:border_set({ width = 1, color = "black" })
    c:focus_set()
    local name = c:name_get()

    --create firefox tag                                                                                               
    if name:lower():find("minefield") then
       awful.client.movetotag( eminent.tag.getn( 2, 1,  true ), c)
    end

    --create main tag                                                                                                  
    if name:lower():find("ncmpc")
       or name:lower():find("mutt")
       or name:lower():find("irssi")
       then
          awful.client.movetotag( eminent.tag.getn( 1, 1,  true ), c)
    end

    if name:lower():find("vlc")
       then
          awful.client.movetotag(eminent.tag.getn(5,1,true),c)
       end

    if name:lower():find("adobe")
       then
          awful.client.movetotag(eminent.tag.getn(4,1,true),c)
       end
end

doesn't like your using eminent, so replace eminent.tag.getn with your relevant tag object (tag[1][1] for example I think)

Offline

#14 2008-06-02 20:58:53

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Re: Awesome wicked widget help

Should I change to eminent library? I have it downloaded, just commented out because I didn't know how to use them at the time

Offline

#15 2008-06-02 23:08:51

GGLucas
Member
Registered: 2008-03-13
Posts: 113

Re: Awesome wicked widget help

Eminent is for dynamic tagging, I find it very useful to be able to create and destroy tags at will without any effort, since I sometimes need more tags, and sometimes less, than usual.
If you want to use it, you might want to read the wiki page at: http://awesome.naquadah.org/wiki/index.php/Eminent

Offline

#16 2008-06-02 23:46:56

heleos
Member
From: Maine, USA
Registered: 2007-04-24
Posts: 678

Re: Awesome wicked widget help

I'll probably stay away from it for now. Im still getting used to separate tabs.

By the way, I knew your name looked familiar, your config is on the awesome site. I borrowed some of yours smile

Offline

Board footer

Powered by FluxBB