You are not logged in.

#1 2013-01-02 16:16:17

lynix
Member
From: Karlsruhe, Germany
Registered: 2008-04-23
Posts: 225

awesome 3.5: widget margins and textbox width

Porting my awesome config from 3.4 to 3.5, I have two problems left:

1st) widget margins

I tried the following to have a graph widget vertically centered, using the awesome.layout.margin widget:

stats_cpu_graph = awful.widget.graph()
stats_cpu_graph:set_height(13)
stats_cpu_graph:set_width(40)
stats_cpu_graph_margin = wibox.layout.margin()
stats_cpu_graph_margin:set_top(3)
stats_cpu_graph_margin:set_bottom(3)
stats_cpu_graph_margin:set_left(2)
stats_cpu_graph_margin:set_widget(stats_cpu_graph)

Unfortunately the graph widget keeps using all the available vertical space (17px).


2nd) textbox widget width

I used to have a textbox with of fixed width and right alignment for widgets that contain values which change their text width dynamically (e.g. cpu usage in percent).
Problem is that I did not find a possibility to set the width of wibox.widget.textbox widgets.


Any advice? smile  I read all awesome docs I could find, but the examples in the wiki do not reflect the api changes in 3.5 yet.

To illustrate my situation better, here are some screenshots:

desired look: awc-desired6qei8.png  current look: awc-currentmoch0.png

Offline

#2 2013-01-02 18:18:38

NougatRillettes
Member
From: Paris/France
Registered: 2012-12-30
Posts: 3

Re: awesome 3.5: widget margins and textbox width

You have to use a margin layout widget :
for example if you want to set a margin of top : 5, bottom : 4; right :3, left : 2 do

local layout_name = wibox.layout.margin(yourgraph,3,2,5,4)

and then add layout_name to the right or left wibox (as if it were a widget itself)

Offline

#3 2013-01-02 18:54:16

lynix
Member
From: Karlsruhe, Germany
Registered: 2008-04-23
Posts: 225

Re: awesome 3.5: widget margins and textbox width

NougatRillettes wrote:

You have to use a margin layout widget :
for example if you want to set a margin of top : 5, bottom : 4; right :3, left : 2 do

local layout_name = wibox.layout.margin(yourgraph,3,2,5,4)

and then add layout_name to the right or left wibox (as if it were a widget itself)

This is what I tried to do in the code I posted above. But thanks, I'll try your suggestion (maybe one has to use the constructor). smile

Offline

#4 2013-01-02 19:36:16

WaiXan
Member
Registered: 2013-01-02
Posts: 1

Re: awesome 3.5: widget margins and textbox width

I think it's insane that they released 3.5 but didn't write all documentation and/or examples on the wiki..
I'm having big troubles with my config and my widgets is not even usable, I'm also trying to add some margin but to the clock..

Offline

#5 2013-01-02 23:15:58

lynix
Member
From: Karlsruhe, Germany
Registered: 2008-04-23
Posts: 225

Re: awesome 3.5: widget margins and textbox width

WaiXan wrote:

I think it's insane that they released 3.5 but didn't write all documentation and/or examples on the wiki..
I'm having big troubles with my config and my widgets is not even usable, I'm also trying to add some margin but to the clock..

Maybe they think any awesome-wm-user will read the code to get the usage wink

I had big trouble, too. Finally copied the default config from /etc/xdg/awesome/rc.lua and started to modify it to my needs...

Offline

#6 2013-01-03 09:31:08

lynix
Member
From: Karlsruhe, Germany
Registered: 2008-04-23
Posts: 225

Re: awesome 3.5: widget margins and textbox width

@NougatRillettes: thanks, I tested the code you suggested and it works smile
(I forgot to add the margin layout widget to the wibox and added the widget itself instead.)

So the only thing left to do is setting width of textbox widgets...

Offline

#7 2013-01-03 14:17:12

NougatRillettes
Member
From: Paris/France
Registered: 2012-12-30
Posts: 3

Re: awesome 3.5: widget margins and textbox width

Well concerning the textbox, a sloppy workaround may be to use a function to print the text that add the requested number of spaces :

if between 0% and 9%, add two spaces
if between 10% and 99% add one
if equal to 100%, add none

the text would so be aligned as you wish.

One last thing, feel free to ask for help on the irc chan : #awesome@irc.oftc.net

Last edited by NougatRillettes (2013-01-03 14:19:34)

Offline

#8 2013-01-03 18:15:23

lynix
Member
From: Karlsruhe, Germany
Registered: 2008-04-23
Posts: 225

Re: awesome 3.5: widget margins and textbox width

NougatRillettes wrote:

Well concerning the textbox, a sloppy workaround may be to use a function to print the text that add the requested number of spaces :

if between 0% and 9%, add two spaces
if between 10% and 99% add one
if equal to 100%, add none

the text would so be aligned as you wish.

Already thought of that, but as I'm using a non-monotype font this won't work.

NougatRillettes wrote:

One last thing, feel free to ask for help on the irc chan : #awesome@irc.oftc.net

You're right, I should try to ask for support on IRC or the awesome mailing lists.

Offline

Board footer

Powered by FluxBB