You are not logged in.

#1 2014-02-25 00:23:23

xworld
Member
Registered: 2012-05-27
Posts: 153

Wibox set_bg doesn't take effect

I recently added the tasklist the a wibox on the bottom of my screen, separate from the standard Awesome WM bar at the top. I noticed that it isn't the same color as the top bar, and if I try to change the top bar color in theme.lua to make it as light as the bottom bar it just makes the bottom bar that much lighter. So I tried following this documentation:
http://awesome.naquadah.org/doc/api/mod … box:set_bg

But any colors I seem to add either throw errors or take no affect.

http://i.imgur.com/TXkwg6h.png

There's a screen so you can see what I mean. I'm sure it's something very simple that I'm missing.

Offline

#2 2014-02-25 00:32:38

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

The colour of the taskbox depend only on the given hexcode in the theme.lua i think.
Maybe it's because the window is active. Sections of active  windows often get lighter colours assigned by the theme file.

Offline

#3 2014-02-25 00:42:31

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

I've tried something like this:

theme.mytasklist_bg_normal = "#333333"
theme.mytasklist_bg_focus = "#333333"

In theme.lua, as mytasklist is what the bottom wibox contains, but it does nothing. I tried using wibox:set_bg() in rc.lua but that didnt take any effect either.

Last edited by xworld (2014-02-25 01:40:09)

Offline

#4 2014-02-27 07:20:19

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

in a more or less default rc.lua
the variables have to be general, they're not specific to the tasklist.
try something like this

theme.bg_normal     = "#161616"
theme.bg_focus      = "#3e3e3e"

theme.fg_normal     = "#c8c8c8"
theme.fg_focus      = "#55aaff"

this is taken from a working theme.lua.
adapt your colors try it, and if it don't work try it with the default rc.lua from /etc/xdg/awesome
good luck, sorry for the late answer smile

Offline

#5 2014-03-04 18:39:03

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

I have tried that, as that is what was originally set in my theme.lua, I only added the tasklist specific part later. For some reason, no matter what color I make the background, it always sets the bottom tasklist a few shades lighter. Here's the wibox I created so you can see:

mywibox2 = awful.wibox({ position = "bottom" })


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({ 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
    mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)

mywibox2:set_widget(mytasklist)
local layout2 = wibox.layout.align.horizontal()
layout2:set_middle(mytasklist)
mywibox2:set_widget(layout2)

end

Last edited by xworld (2014-03-04 18:52:36)

Offline

#6 2014-03-05 03:12:41

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

I tried to find a way i can explain it, but i couldn't do it in english big_smile
If you haven't yet, have a look at this site, maybe this will clear things up a little http://awesome.naquadah.org/wiki/Beautiful

Offline

#7 2014-03-05 17:34:18

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

As per your link I tried this:

bg_mytasklist_widget = "#333333"
fg_mytasklist_widget = "#333333"

And added this into my rc.lua in the wibox.

    mytasklist:bar_properties_set({
      fg_mytasklist_widget = beautiful.fg_mytasklist_widget,
      bg_mytasklist_widget = beautiful.bg_mytasklist_widget
})

But it throws an error. I've also tried this:

theme.bg_normal     = theme.bg_systray
theme.bg_focus      = theme.bg_systray
theme.bg_urgent     = "#000000"
theme.bg_minimize   = "#000000"
theme.bg_systray    = "#333333"

Which actually does make both top and bottom wibox bars the same color, but no matter what I set theme.bg_systray to it keeps the color completely black. Perhaps it would help if I post the entire color part of my theme file.

theme.bg_normal     = "#333333"
theme.bg_focus      = "#333333"
theme.bg_urgent     = "#000000"
theme.bg_minimize   = "#000000"
theme.bg_systray    = "#333333"

theme.fg_normal     = "#bbbbbb"
theme.fg_focus      = "#8CEEFF"
theme.fg_urgent     = "#000000"
theme.fg_minimize   = "#000000"

theme.border_width  = 1
theme.border_normal = "#000000"
theme.border_focus  = "#66cccc"
theme.border_marked = "#000000"

Last edited by xworld (2014-03-05 17:39:38)

Offline

#8 2014-03-06 22:24:19

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

This part:

mytasklist:bar_properties_set({
fg_mytasklist_widget = beautiful.fg_mytasklist_widget,
bg_mytasklist_widget = beautiful.bg_mytasklist_widget
})

can't work because you have to set the variables that the widget-type is programmed to use for it's color's.
"fg_mytasklist_widget" seems to be a custom variable, which should have no use for the widget.

i think it should look like this (according to how i understand the naquadah wiki page, and supposed that you have declared "fg_mytasklist_widget"  and "bg_mytasklist_widget" in your theme.lua):

mytasklist:bar_properties_set({
fg = beautiful.fg_mytasklist_widget,
bg = beautiful.bg_mytasklist_widget
})

"fg" and "bg" are the variables that the widget looks up

Offline

#9 2014-03-07 20:51:33

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

Ok here's my theme.lua"

theme.bg_normal     = "#333333"
theme.bg_focus      = "#333333"
theme.bg_urgent     = "#000000"
theme.bg_minimize   = "#000000"
theme.bg_systray    = "#333333"

theme.fg_normal     = "#bbbbbb"
theme.fg_focus      = "#8ceeff"
theme.fg_urgent     = "#000000"
theme.fg_minimize   = "#000000"

theme.border_width  = 1
theme.border_normal = "#000000"
theme.border_focus  = "#66cccc"
theme.border_marked = "#000000"
theme.fg_mytasklist_widget = "#333333"
theme.bg_mytasklist_widget = "#333333"

The two declared theme elements are at the bottom. Here's what I put in rc.lua:

mywibox2 = awful.wibox({ position = "bottom" })


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({ 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
    mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)

mywibox2:set_widget(mytasklist)
mytasklist:bar_properties_set({
fg = beautiful.fg_mytasklist_widget,
bg = beautiful.bg_mytasklist_widget
})
local layout2 = wibox.layout.align.horizontal()
layout2:set_middle(mytasklist)
mywibox2:set_widget(layout2)

end

I tried placing the bar_properties_set chunk at different parts of rc.lua but I get this error no matter what:

/home/user/.config/awesome/rc.lua:536: attempt to call method 'bar_properties_set' (a nil value)

Offline

#10 2014-03-08 04:08:14

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

i have to admit that the official documentation is sometimes very outdated sad
maybe the method function has another name now, or things are handled differently
i looked in the documentation and i couldn't find a bar_properties_set function.
here: http://awesome.naquadah.org/doc/api/mod … klist.html
that's the page i mean. It seems that you can declare which theme variables should be overrided when initializing the object.

mytasklist = awful.widget.tasklist(
             s,
             awful.widget.tasklist.filter.currenttags, 
             mytasklist.buttons,
             { fg = beautiful.fg_mytasklist_widget, bg = beautiful.bg_mytasklist_widget }
              )
mywibox2:set_widget(mytasklist)

This should be the correct process if i understand the documentation correctly

Offline

#11 2014-03-08 04:27:47

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

Wow. This time, there is no errors, yet the wibox stays the same color as before. Nothing has changed.
rc.lua

mywibox2 = awful.wibox({ position = "bottom" })


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({ 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
mytasklist = awful.widget.tasklist(
             s,
             awful.widget.tasklist.filter.currenttags,
             mytasklist.buttons,
             { fg = beautiful.fg_mytasklist_widget, bg = beautiful.bg_mytasklist_widget }
              )

mywibox2:set_widget(mytasklist)
layout2 = wibox.layout.align.horizontal()
layout2:set_middle(mytasklist)
mywibox2:set_widget(layout2)

end

theme.lua

fg_mytasklist_widget = "#333333"
bg_mytasklist_widget = "#333333"

I've also tried putting: theme.fg_mytasklist_widget, in theme.lua with no results.

Alright. I can't in good conscience continue having you waste your time helping me like this. I suppose I'll just have to figure it out on my own and post back when I've found the solution. Thaks very much for your time.

Offline

#12 2014-03-09 06:33:39

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

I found the solution!
Sorry, i didn't mentioned it earlier, but just have a look at "/usr/share/awesome/lib/awful/widget/tasklist.lua".
there you can see the used variables.
In your case fg_normal and bg_normal.
In future if you have issues with awesome, your first look should go into the script files lying in there. i forgot that this time :D
In tasklist.lua you can also see how the mechanism is going on when initializing the theme-variables.
First it looks for arguments you give the function, then for the variable theme.tasklist_fg_normal, and if that's not given for theme.fg_normal.
If this whole separation of theming and functions seems too complicated to you, you can just put the color variables directly into your rc.lua, though i wouldn't recommend it. Here's how i changed the color for "normal" fields in the tasklist (clients that are not active), just to work out how it's working:

mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons,
                      { fg_normal = "#000000", bg_normal="#ffffff"})

And that's how I'd  recommend it:

In your rc.lua:

mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons,
                      { fg_normal = beautiful.tasklist_fg_normal, bg_normal = beautiful.tasklist_bg_normal})

And in your theme.lua (either lying in "/usr/share/awesome/themes/whatever/theme.lua",
or in "/home/user/.config/awesome/themes/whatever/theme.lua")

theme.tasklist_fg_normal = "#whatever"
theme.tasklist_bg_normal = "#whatever"

the theme.lua-mechanism just returns a table with all the variables to beautiful. it's called "theme". you can see this at the end of every theme.lua, when it says "return theme".
beautiful then takes this table and cares about a ton of other things like default values i think.
Then you can get your theme-variables by "beautiful.my_theme_variable".
Hope that clears this up.
Beware to initialize the right theme, and to have an eye on commas in your rc.lua (my personal top error source :D)

Like i mentioned a complete list of compatible theming variables for the awful.widget.tasklist module can be found at /usr/share/awesome/lib/awful/widget/tasklist.lua in the function called "tasklist_label" relatively at the beginning.

Good Luck! :)

By the way, it was not a lot of time i spent on this, no need to bother

Last edited by halimbo (2014-03-12 16:43:53)

Offline

#13 2014-03-14 01:35:42

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

Ok. I don't get it. I really don't. As per your instructions I did this:

rc.lua

mytasklist = awful.widget.tasklist( s,awful.widget.tasklist.filter.currenttags, mytasklist.buttons,
             { fg_normal = beautiful.tasklist_fg_normal, bg_normal = beautiful.tasklist_bg_normal }

mywibox2:set_widget(mytasklist)
layout2 = wibox.layout.align.horizontal()
layout2:set_middle(mytasklist)
mywibox2:set_widget(layout2)

theme.lua

theme.bg_normal     = "#333333"
theme.bg_focus      = "#333333"
theme.bg_urgent     = "#000000"
theme.bg_minimize   = "#000000"
theme.bg_systray    = "#333333"

theme.fg_normal     = "#bbbbbb"
theme.fg_focus      = "#8ceeff"
theme.fg_urgent     = "#000000"
theme.fg_minimize   = "#000000"

theme.border_width  = 1
theme.border_normal = "#000000"
theme.border_focus  = "#66cccc"

theme.tasklist_fg_normal = "#bbbbbb"  << variables I defined
theme.tasklist_bg_normal = "#333333" <<

No errors. Yet it remains completely, absolutely unchanged. The top bar which comes by default is colored #333333, and the bar on the bottom which I created stubbornly refuses to use any color other then one that is a few shades lighter then #333333.  I really just don't understand why this has to be so damn difficult.

Last edited by xworld (2014-03-14 01:46:15)

Offline

#14 2014-03-14 15:32:28

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

mywibox2:set_widget(mytasklist)
layout2 = wibox.layout.align.horizontal()
layout2:set_middle(mytasklist)
mywibox2:set_widget(layout2)

this makes no sense. with "set_widget" you put the tasklist in the wibox. then you put the same taskbar later in a layout which you put into the same wibox later again.

Offline

#15 2014-03-14 21:16:21

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

Seems you are right. I removed the bottom line, and nothing changed whatsoever so I guess I didn't need it. Still doesn't help the color though.

Offline

#16 2014-03-15 04:06:23

halimbo
Member
From: Krefeld, Germany
Registered: 2013-10-23
Posts: 74

Re: Wibox set_bg doesn't take effect

then try to initialize all possible variables with your desired color, not just fg_normal but also fg_focus, bg_focus and all the others mentioned in tasklist.lua

if the tasklist is the only thing you want to have in this specific wibox then a simple

mywibox2:set_widget(mytasklist)

should suffice.

Last edited by halimbo (2014-03-15 04:08:23)

Offline

#17 2014-03-15 04:47:16

xworld
Member
Registered: 2012-05-27
Posts: 153

Re: Wibox set_bg doesn't take effect

Wow. This is amazing. I really am blown away. Is this a problem with me not understanding lua or is this Awesome having a really weird way of configuring stuff?

Ok, so I realized something just now. Here's the relevant block in theme.lua:

theme.bg_normal     = "#333333"
theme.bg_focus      = "#333333"
theme.bg_urgent     = "#000000"
theme.bg_minimize   = "#66cccc"
theme.bg_systray    = "#333333"

Now, even though both the top and bottom bar are set(I thought) to bg_normal, the bottom one is a few shades lighter then bg_normal. On the other hand though, notice the field "theme.bg_minimize." That one IS applied to the bottom bar! When I minimize tasks they turn just the right color.

http://i.imgur.com/7KIDAiR.png

As you can see in the picture, the bottom left part of the bar is a little bit lighter then the top bar, yet the right side is the proper color(#66cccc). So, now I'm REALLY confused. Why would that one apply but not the others. I think we are going in the wrong direction here. I don't think it matters what I define here:

local mytasklist = awful.widget.tasklist(s,awful.widget.tasklist.filter.currenttags, mytasklist.buttons,
             { fg_normal = beautiful.tasklist_fg_normal, 
               bg_normal = beautiful.tasklist_bg_normal })

I've already tried others besides fg_normal and so on, but as I've said, I don't think that matters.

What the h*ll is going on here?

EDIT: Ok this just get's weirder. Here's my rc.lua:

local mytasklist = awful.widget.tasklist(s,awful.widget.tasklist.filter.currenttags, mytasklist.buttons,
             { fg_normal = "#bbbbbb", bg_normal = "#222222",
               fg_focus = "#8ceeff", bg_focus = "#222222",
               fg_urgent = "#000000", bg_urgent = "#000000",
               fg_minimize = "#000000", bg_minimize = "66cccc"
             })

Now, first of all. I made the bg fields a bit darker then they are normally in theme.lua. Now, there is an affect taking place. One thing I noticed is that the bottom bar is the same color as the top bar, when there is a window open. In other words, it will be whatever color I tell it to be in the rc.lua snippet above. That part DOES actually work. However, if I close all windows, then the bar goes back to it's lighter state again. I can't figure out how to fix this, but it must be possible, I've seen screenshots.

One other strange observation. If I open the awesome wm menu at the top of the screen, it is the same color as the top bar, yet if I open the menu at the bottom of the screen, it stays that same lighter color even if the bottom bar is darker! Also, even though in mine theme.lua I have the color #333333 as the basic bar color at the top, I have to make it a much darker color to try and match the top color. So the top bar doesn't seem to be actually using #333333.

More and more confusion....

Last edited by xworld (2014-03-15 05:32:42)

Offline

Board footer

Powered by FluxBB