You are not logged in.

#21 2016-06-12 03:59:03

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Move conky to taskbar

You're welcome.

mangstadt wrote:
TEXT
${color0}CPU:$color $cpu% ${tab 15} \
${color0}RAM:$color $mem  \
${color0}Swap:$color $swap  \
${color0}Wifi: ▲ $color${upspeed wlan0} ${color0}▼ $color${downspeed wlan0}

Not sure if I'm using the ${tab} variable correctly.  I'm trying to prevent it from jumping around when the CPU percentage goes from single digits to double digits.  Looks like it's working, but I don't really know why. xD Tried to do the same for the Wifi stats, but was having some trouble.

Depends on what you want it to look like.

For example:
the ${tab} output

CPU 5%   RAM
CPU 35%  RAM
CPU 100% RAM

Or more like a column of numbers might look:
using ${if_match}

CPU   5% RAM
CPU  35% RAM
CPU 100% RAM

Something else to be careful with: If you are not using a monofont 11% is 'thinner' than 33%
Not something to be worried about here though you are using a mono font - for future conkys.

tab (width, (start))
   Puts a tab of the specified width, starting from column 'start'.
   The unit is pixels for both arguments.

For ${tab} 'width' will depend on the font "character" widths as well and will change from one font to another.  The ${if_match} method adjusts for any 'mono' font correctly and automatically upon changing the font.

The code for both:

     CPU %
 0   1   2   3
${cpu cpu0}%${tab 14,3}${cpu cpu1}%${tab 14,17}${cpu cpu2}%${tab 14,31}${cpu cpu2}%
ñññ|ñññ|ñññ|ñññ <<-- to adjust spacing only
${if_match ${cpu cpu0} < 10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0} < 100} ${cpu cpu0}\
${else}${color9}${cpu cpu0}${color}${endif}${endif} \
${if_match ${cpu cpu1} < 10}  ${cpu cpu1}\
${else}${if_match ${cpu cpu1} < 100} ${cpu cpu1}\
${else}${color9}${cpu cpu1}${color}${endif}${endif} \
${if_match ${cpu cpu2} < 10}  ${cpu cpu2}\
${else}${if_match ${cpu cpu2} < 100} ${cpu cpu2}\
${else}${color9}${cpu cpu2}${color}${endif}${endif} \
${if_match ${cpu cpu3} < 10}  ${cpu cpu3}\
${else}${if_match ${cpu cpu3} < 100} ${cpu cpu3}\
${else}${color9}${cpu cpu3}${color}${endif}${endif}
or pad the output empty spaces with 0's
${if_match ${cpu cpu0} < 10}${color1}00${color}${cpu cpu0}\
${else}${if_match ${cpu cpu0} < 100}0${cpu cpu0}\
${else}${color9}${cpu cpu0}${color}${endif}${endif} \
${if_match ${cpu cpu1} < 10}${color1}00${color}${cpu cpu1}\
${else}${if_match ${cpu cpu1} < 100}0${cpu cpu1}\
${else}${color9}${cpu cpu1}${color}${endif}${endif} \
${if_match ${cpu cpu2} < 10}${color1}00${color}${cpu cpu2}\
${else}${if_match ${cpu cpu2} < 100}0${cpu cpu2}\
${else}${color9}${cpu cpu2}${color}${endif}${endif} \
${if_match ${cpu cpu3} < 10}${color1}00${color}${cpu cpu3}\
${else}${if_match ${cpu cpu3} < 100}0${cpu cpu3}\
${else}${color9}${cpu cpu3}${color}${endif}${endif}

and a picture or it doesn't work:
6b10c5488947517.jpg  Unrelated tid-bit: I was testing a Chess font when I started this.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#22 2016-06-12 14:59:28

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Move conky to taskbar

Sector11 wrote:
mangstadt wrote:

It would be nice if there was a way to keep it on top of all windows.  When I open a window that is not maximized, it can get covered up.


EDIT: Another problem is that, when I press "Meta+D" to show the desktop, it disappears. sad

own_window_hints skip_taskbar,skip_pager,undecorated,below,sticky

.... if you want the conky to show ALWAYS - even if you force a window over it change "below" to "above"

yes, that works.

Sector11 wrote:

RE: Meta-D - that will always happen, conky, is an app just like others and if you want to show the desktop, it reacts as other apps.  To the best of my knowledge.

if you set own_window_type to desktop or override, it stays put even when you press meta-d.
but then you can't have it above.

Offline

#23 2016-06-12 19:14:00

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Move conky to taskbar

Hi ohnonot

I don't use 'desktop' - good thing I said:  To the best of my knowledge.  smile

own_window_hints wrote:

If own_window is yes, you may use these window manager hints to affect the way Conky displays. Notes: Use own_window_type desktop as another way to implement many of these hints implicitly. If you use own_window_type override, window manager hints have no meaning and are ignored.

The problem here is "implicit" means 'below' and the conky 'window' is lost to mouse clicks¹, moving and resizing.
Using override and the hints are useless.

own_window_type wrote:

If own_window is yes, you may specify type normal, desktop, dock, panel or override (default: normal).

Desktop windows are special windows that have no window decorations; are always visible on your desktop; do not appear in your pager or taskbar; and are sticky across all workspaces. Added by S11: and below other windows.

Panel windows reserve space along a desktop edge, just like panels and taskbars, preventing maximized windows from overlapping them. The edge is chosen based on the alignment option.

Override windows are not under the control of the window manager. Hints are ignored. This type of window can be useful for certain situations.

Using 'dock' and 'panel' I am not familiar with.

So I guess mangstadt has to make a decision as to which method.

He could always assign the starting/stopping of the conky to a bash script:
ssc-myconky

#!/bin/bash
## Original idea by: GrouchyGaijin
## This idea by: Stinkeye - Jan 2013
## With another tweak by: arclance
## click to start, click to stop
if
	pgrep -f "conky -q -c /full/path/to/conky_file"
then
	pkill -xf "conky -q -c /full/path/to/conky_file"
else
	conky -q -c "/full/path/to/conky_file"
fi

make it executable and run it from an OB Menu entry
- if the conky is running - it kills it - and only the one conky
- if it's not running it starts it.

--------------------
1. therefore dead space on the desktop.
- - right clicking on a conky to get OpenBox
2016-06-12_153739_Scrot11.th.jpg


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#24 2016-06-14 01:09:04

mangstadt
Member
Registered: 2016-05-28
Posts: 20

Re: Move conky to taskbar

Sector11 wrote:

So I guess mangstadt has to make a decision as to which method.

Thanks for your help.  I'm pretty happy with the current configuration.  I'd rather have it so that it always stays on top of all other windows.  Not that big a deal if "Meta-D" hides it.

Sector11 wrote:

He could always assign the starting/stopping of the conky to a bash script:

Since I copied my config to "~/.conkyrc", I can always reload it from the main menu (Preferences > Conky > Reload Conkys)

I used ${if_match} to add the spacing and to add some color. :3

#Note: Configure Openbox with a 20px bottom margin

background false

#SAMPLING
update_interval 2.0
cpu_avg_samples 2
net_avg_samples 2
no_buffers true

#POSITION
alignment bottom_left
gap_x 0
gap_y 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints skip_taskbar,skip_pager,undecorated,above,sticky

#FONT
default_color white
color0 grey
color1 orange
color2 red
font DejaVu Sans Mono:size=10
short_units yes
double_buffer yes

TEXT
${color0}CPU:$color \
${if_match $cpu < 10}  ${else}\
${if_match $cpu < 80} ${else}\
${if_match $cpu < 90}$color1 ${else}\
${if_match $cpu < 100}$color2 ${endif}${endif}${endif}${endif}\
$cpu% \
${color0}RAM:$color $mem  \
${color0}Swap:$color $swap  \
${color0}Wifi: ▲ $color${upspeed wlan0} ${color0}▼ $color${downspeed wlan0}

I ran into another problem.  The width of my conky window seems to have randomly shrunk on me.  No idea why.  Tried adding "minimum_width 600" and "minimum_size 600 600", but they didn't do anything.

Qa8T1RR.png

The window also seems to have increased in height even though the config file only has one line of text.  Setting "gap_y" to "-10" fixes this issue.

I don't know if copying my conky config to "~/.conkyrc" has anything to do with it.  I did this so that my conky file loads on startup.

Offline

#25 2016-06-14 01:36:55

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Move conky to taskbar

Not sure why it grew in height but the shrunk in width bit 'might' have something to do with your wireless going off line - I say: might -

Add these two lines to see if it fixes the width and sets a minimum of 0 height .. that way the font itself of your one line will set the height.

minimum_size 420 0
maximum_width 420

Your new code is working perfect here - except I changed wlan0 for eth0.

Copying your conky to ~/.conkyrc will have no adverse affects on the conky and as you say, it's now fired up on startup, that's a plus.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#26 2016-06-14 01:58:14

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Move conky to taskbar

mangstadt wrote:

...
I don't know if copying my conky config to "~/.conkyrc" has anything to do with it.  I did this so that my conky file loads on startup.

No need to copy it. In BunsenLabs you can set one or more conkys to run from a session file, which is started from autostart by 'bl-conky-session'. See 'Menu -> Preferences -> Conky -> Conky Manager Help".

Or you can explicity set it in autostart with

conky -c /path/to/conkyrc &

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#27 2016-06-14 13:33:39

mangstadt
Member
Registered: 2016-05-28
Posts: 20

Re: Move conky to taskbar

Sector11 wrote:

Not sure why it grew in height but the shrunk in width bit 'might' have something to do with your wireless going off line - I say: might -

I was browsing websites while testing, so my wireless was functional.

Sector11 wrote:

Add these two lines to see if it fixes the width and sets a minimum of 0 height .. that way the font itself of your one line will set the height.

minimum_size 420 0
maximum_width 420

No change.

I tried running the configuration script stand-alone via the command line, and it worked fine.  I didn't have any problem with the width.

damo wrote:

No need to copy it. In BunsenLabs you can set one or more conkys to run from a session file, which is started from autostart by 'bl-conky-session'

Thanks for the tip.  I edited "~/.config/conky/conky-sessionfile" to run my own conky config and that seems to have worked.  I have no idea why.  All I did to this file was replace the path to "~/.conkyrc" with the path to my own config script.  Both files contain the same contents (at least, I think so), so that shouldn't have made a difference.

I wonder if there's some sort of race condition in the Linux startup sequence, which is sometimes causing conky to run before other operations and which prevents conky from initializing correctly.

Also, does anyone know how I can use ${if_match} with $mem, $swap, and $upspeed?  The problem is that these variables are not integers...they are appended with "B", "M", etc.  Is there a variable that returns the length of a string?  Thanks. smile

Offline

#28 2016-06-14 13:57:58

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Move conky to taskbar

mangstadt wrote:
Sector11 wrote:

Not sure why it grew in height but the shrunk in width bit 'might' have something to do with your wireless going off line - I say: might -

I was browsing websites while testing, so my wireless was functional.

mangstadt wrote:
Sector11 wrote:

Add these two lines

No change.

Well, there goes those theories.  I'll keep looking for an answer.

mangstadt wrote:

I wonder if there's some sort of race condition in the Linux startup sequence, which is sometimes causing conky to run before other operations and which prevents conky from initializing correctly.

Try a 'sleep command' or use conly's built in pause command:

conky -p5 -c /media/5/Conky/test.conky &

pause for 5 seconds

mangstadt wrote:

Also, does anyone know how I can use ${if_match} with $mem, $swap, and $upspeed?  The problem is that these variables are not integers...they are appended with "B", "M", etc.  Is there a variable that returns the length of a string?  Thanks. smile

That could be tough, since they are alpha numeric outputs.  This might be a better place to use ${tab}.  If the conkys were 'vertical' you could line up the "B" "M" or "G"'s

OH WAIT:  here - length of a variable - hope that helps.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#29 2016-06-19 14:09:00

mangstadt
Member
Registered: 2016-05-28
Posts: 20

Re: Move conky to taskbar

Sector11 wrote:

Try a 'sleep command' or use conly's built in pause command:

conky -p5 -c /media/5/Conky/test.conky &

pause for 5 seconds

Here is the content of my "~/.config/conky/conky-sessionfile" file:

conky -c /home/michael/.conkyrc & sleep 1s

My conky is working fine today.  I will try increasing the sleep value if I have trouble in the future.

Sector11 wrote:

OH WAIT:  here - length of a variable - hope that helps.

Thank you for the suggestion.  I don't know how I would use this in a conky file.  I tried the code below, but it doesn't work.  Plus, the documentation says you shouldn't use "exec" because it significantly impacts performance.

${color0}Wifi: ▲ $color${exec foo=${upspeed wlan0}; echo ${#foo} } ${color0}▼ $color${downspeed wlan0}

Offline

#30 2016-06-19 15:47:11

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Move conky to taskbar

mangstadt wrote:

Here is the content of my "~/.config/conky/conky-sessionfile" file:

conky -c /home/michael/.conkyrc & sleep 1s

That's doing nothing, except pausing the exiting terminal prompt, if doing it in a terminal ... do a test in terminal to see:

$ echo Hello there && sleep 5s

and a second one:

$ sleep 5s && echo Hello there

The "sleep" must come first to be effective.

With the built in conky 'pause' command it can come right after 'conky' or at the end of the line, just not between the "-c /path/to/conkyrc" element:

conky -p5 -q -c /media/5/Conky/test.conky &
conky -q -p5 -c /media/5/Conky/test.conky &
conky -p5 -c /media/5/Conky/test.conky &
conky -c /media/5/Conky/test.conky -p5 &
conky -q -c /media/5/Conky/test.conky -p5 &

Not that you 'shouldn't' use execi but that it uses more resources.  That notice was from the days when cpus weren't what they are today.  But still something to be aware of if using lots of them.
What the ${exec foo} stuff?

I run 13 conkys everyday all day I use ${execi xxx ...} a LOT! and right now with my browser open, a terminal open, medit and claws-mail and a 14th conky (the test conky as seen above) my cpu usage is sitting at 3% average
2016_06_19_12_54_02_Scrot11.jpg

${exec ...} updates everytime your conky updates use the interval option ${execpi xxx ...}

Last edited by Sector11 (2016-06-19 16:00:27)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#31 2016-06-19 16:03:12

mangstadt
Member
Registered: 2016-05-28
Posts: 20

Re: Move conky to taskbar

Sector11 wrote:
mangstadt wrote:

Here is the content of my "~/.config/conky/conky-sessionfile" file:

conky -c /home/michael/.conkyrc & sleep 1s

That's doing nothing, except pausing the exiting terminal prompt

FYI that's what the file originally looked like when I installed BunsenLabs. :-P

Sector11 wrote:

With the built in conky 'pause' command it can come right after 'conky' or at the end of the line, just not between the "-c /path/to/conkyrc" element:

Thanks for the tip. smile

Offline

#32 2016-06-19 16:09:45

mangstadt
Member
Registered: 2016-05-28
Posts: 20

Re: Move conky to taskbar

Sector11 wrote:

What the ${exec foo} stuff?

The SO question you linked to used environment variables to determine the length of a string.  For instance, the following example outputs the length of the string "test 1 2 3".

> mystring="test 1 2 3"
> echo ${#mystring}

This is what I was trying to do in my conky.  I was trying to assign the value of "${upspeed wlan0}" to an environment variable, and then output the length of the string back into the conky using "echo", all within a conky "exec" variable.

Good to hear that you don't have performance problems with "exec".

Last edited by mangstadt (2016-06-19 16:11:08)

Offline

#33 2016-06-19 16:37:25

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Move conky to taskbar

mangstadt wrote:
Sector11 wrote:
mangstadt wrote:

Here is the content of my "~/.config/conky/conky-sessionfile" file:

conky -c /home/michael/.conkyrc & sleep 1s

That's doing nothing, except pausing the exiting terminal prompt

FYI that's what the file originally looked like when I installed BunsenLabs. :-P

When the startup script is run it means that there is a 1s pause before the next command starts (if there is one), or the script exits. If you read ".config/openbox/autostart" you will see:

## Start the Conky session (the default conkyrc will run if no sessions have been set)
(sleep 2s; bl-conky-session --autostart) &

This says to pause 2s, then run the conky sessionfile, if there is one. So either adjust this value if you start the conky(s) via autostart, or use @Sector11's suggestions if you are starting it some other way.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#34 2016-06-25 12:39:09

mangstadt
Member
Registered: 2016-05-28
Posts: 20

Re: Move conky to taskbar

damo wrote:

snip

Thank you. smile

Offline

Board footer

Powered by FluxBB