Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-21 13:12:17

mzsade wrote:

Another thing that bugs me about conky is the way it computes the "mem" and the discrepancy with the free -m output (See Screenshot). I take pride in the "tweakiness" of my configuration and it's a bit of a letdown when conky shows i am using 138Mb on boot against the free -m output of 79Mb.  wink

There is a bug report about this that was started recently.
It turns out that free, htop, and conky all calculate this differently so the developer is going to research which is correct before making any changes.

Snap wrote:

Is if_running still broken? And what about if_match? Broken too?

No but a pull request of if ${if_running} is waiting to be merged.
I don't know about ${if_match}.
I don't use it and I don't remember hearing anything about it either way.

#2 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-07 16:41:06

^ Okay then post the full text of all three lua scripts and your .conkyrc as they are now so we can see if there is something wrong in the way you changed them.

#3 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-09-06 15:25:23

ghorvath wrote:

The recovery partition that has spaces in its name is /dev/sda1. I actually tried writing /dev/sda1 everyhere, and it did not work, either.

Everything there is "{fs_x}" type objects which do not accept /dev/sda1 type paths they accept paths to mount points in user space like "/media/whateverinamedit".
I mentioned this in my last post.

arclance wrote:

"${fs_used}", "${fs_size}", and "${fs_free}" only want the path to the mount point of the drive I believe and should accept "/run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/" if that is the mount point and the tools conky uses to get this data actually work on samba shares.

These conky objects have been improved in what paths they work with in conky v1.10.0 but as I said before I have no idea if they work with samba shares because I don't use samba.

One thing you should try with your samba share is mounting it manually with the samba command line tools to a directory you create in a less strange place than "/run/usr" like "/media/".
I have no idea what the commands to do that are since I don't use samba.
I use NFS instead since I don't need Windows compatibility on my network drives.

#4 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-09-06 02:38:51

ghorvath wrote:

Adding \ in front of spaces does not work. I cannot (do not want to) rename it, because it is some kind of a recovery partition that came with the laptop. Not that big deal, I do not usually mount it anyway. However, there is another samba drive which I usually mount via gigolo, and it is mounted to /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/ 
I would be interested in knowing how to find this with conky.

What conky object are you actually trying to use here?
"${diskio}" and the others like it only work with "sda1" part of the /dev/sda1 type drive designations in conky v1.9.1 (other path types are supported in v1.10.0).

diskio   (device)   Displays current disk IO. Device is optional, and takes the form of sda for /dev/sda. Individual partitions are allowed.

Conky does not need to be run as root for this because conky is just using this to know which drive you want data about.

"${fs_used}", "${fs_size}", and "${fs_free}" only want the path to the mount point of the drive I believe and should accept "/run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/" if that is the mount point and the tools conky uses to get this data actually work on samba shares.

All of this does not work very well in conky v1.9.1 since the /dev/sda1 type mount point can change between reboots in certain situations and may not cover things like samba shares (never looked into those so I can't say).
For those situations you need to write something yourself to work with whatever situation you run into.

#5 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-09-06 00:43:59

ghorvath wrote:

One is that somehow update_interval_on_battery does not have any effect when I disconnect the laptop from the charger.

This only works if conky correctly detects that you are on battery power.
If this works is dependent on what hardware is in your laptop since the work to detect things like this has not been done (or can't be depending on how it was made) for all hardware.
Also last I heard conky is hardcoded to check BAT0 for this.
If your laptop uses something else it won't work unless you change the source code to read from the correct place on your laptop and then build conky yourself.

ghorvath wrote:

The other is that I have a partition mounted to a path which contains space. Is there any way to have some escape character for space in conky? I cannot use /dev/sda1 (even though that is the partition), because that is only readable by root, even if the user mounts it via, say, Thunar.

I believe you just need to add a "\" in front of the space to escape it but I have never tried it.
I would recommend changing the drive label to eliminate the space anyway since many things don't handle spaces like this correctly (don't do this if it is your root partition however).

ghorvath wrote:

I have just checked Disk IO by Conky, and for several conky updates, Disk IO stayed 0. Also checked with iotop, same result (no disk read or write).

You can try to change the "diskio_avg_samples" configuration option in conky to a lower number (like 1) to get more real time data displays.
You may see some more extreme spikes in the data without averaging however.
I also see you are using a update interval of three seconds, you could easily miss a write that happens during the three seconds it is not updating and see things like this because of it.

#6 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-09-05 14:22:40

ghorvath wrote:

However, I have an SSD drive, and I would not like to have my SSD read in every 3 seconds, especially when I am on battery. Does anyone have any idea how I could make it happen that I only read /var/log/messages for the date when the machine wakes up, stores it somehow in the memory, and ready it from the memory every after?

Mount your /tmp directory in ram and write what you need to file there.

tmpfs    /tmp   tmpfs   defaults,noatime,mode=1777,size=1g  0   0

"size=" is the maximum amount of ram your /tmp will be able to use though it will only use as much as is needed at any one time.
You need to set "size=" to a reasonable number for how much ram you have though less than 512mb might run into problems.
I recommend "size=1g" if you have at least 4GiB of ram.

${pre_exec} only runs once at conky startup not every update so the script would not be able to calculate the time since last hibernate/suspend every update that way.
It was also removed from conky v1.10 so I would not rely on it anyway.

#7 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-04 12:27:24

Did you kill and restart the conky after you did that?

#8 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-02 16:35:25

^ If you do it the way I suggested you can load as many lua scripts in the "widget.lua" as long as they don't have any duplicate function names after you rename things.
You will likely run into problems if you "dofile" load multiple lua files that all have a conky_main function in them.
I don't know exactly what will happen since I have not tested anything but I would guess that either the latest loaded version of a function name would overwrite the last loaded version or it would not work at all.

Nothing is stopping someone from doing what you suggested as well as what I suggested though.

#9 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-02 15:45:28

ragamatrix wrote:

thanks for the compliment  smile

Is it possible that that might cause problems?

For me no...  big_smile
I think it's the "main" function of the lua script called... But I'm sure of nothing...

It is possible that it could cause problems.
You should probably rename the "conky_main" in "ChronoClear.lua" to something else and then call that in your "widget.lua" script.

#10 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-09-02 12:34:51

^ I don't know of anything that tracks time since last suspend or hibernate.
uptime and uprecords tracks real uptime (the time since last boot) but that is not what you want.

#11 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-01 21:13:26

iami wrote:

It works fine here is how i have used it:

What I have heard is that it sometimes works but not always.
I don't think it works on templates anyway since they need to have characters escaped differently in the new format.

Here is a quote from 2012 (convert.lua was last updated in 2010) to show where I have heard about it not working though.

Sector11 wrote:

Guess it boils down to personal choice at the moment though.  Since 'convert.lua' isn't converting any of my daily conkys I'd have to say it will be an enormous job to do them manually.

I'll play with it though, I have the deb here and going back and forth between the two versions isn't all that hard.

Thanks dk75.

iami wrote:

Warning: this overwrites the given conky file, take a backup before converting!

It accepts two arguments with the second being the new file to create instead of overwriting the old one.

Altough you can use this script with only 1 arg and let it overwrite the old
config, it's suggested to use 2 args so that the new config is written in a new
file (so that you have backup if something went wrong).
iami wrote:
arclance wrote:

Note that you need to remove the "," after the last entry that you had or it won't work.

Currently i'm not doing this and i have no issues, convert.lua does also include an "," after the last entry. But i guess removing it won't hurt either.

Maybe it works in Lua but in many programing languages it would fail because there is no entry after the last "," and it expects something to be there.
I have never actually made a table with a dangling "," like that in Lua so I assumed that like most programing languages it would yell at you if you do that.

#12 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-01 15:10:35

ragamatrix wrote:

I tried to use the convert.lua script to convert the conkyrc in the good "sentence" "format" but it doesn't work well.

Never tried that myself but I heard it does not work before.
I forgot it existed so I also forgot to tell you not to use it.

ragamatrix wrote:

I also tried manually but I don't knox how to call the lua script in that new way...

That is the only way to do it that actually works I know of.
This is the format for the lua setup.

lua_load = "/path/lua_script.lua",
lua_draw_hook_pre = "main",
lua_startup_hook = "start_xdotool",
lua_shutdown_hook = "stop_xdotool"

Yours would end up like this

	lua_load = "~/.conky/ConkyChronoClear/draw_bg.lua",
	lua_load = "~/.conky/ConkyChronoClear/ChronoClear.lua",
	lua_draw_hook_pre = "main"

Note that you need to remove the "," after the last entry that you had or it won't work.
You may also need to replace the "~" in you config with your "/home/username" to get the full path to your lua files.
I have never tested if that kind of path works correctly in the new version of conky.

#13 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-09-01 13:32:21

ragamatrix wrote:

Thanks a lot if someone can help wink

The first thing to do is update your .conkyrc to the new format.
The new conky kind of supports the old format but not everything works right.

#14 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-24 12:46:02

^ You probably need to set a larger "text_buffer_size" so the whole fortune is printed.
Try changing "#text_buffer_size 6144" to "text_buffer_size 6144" and see what happens.

#15 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-21 22:55:41

^ Try moving the "imlib_context_set_blend(0)" to here instead.

	local buffer = create_clock(theme, arc_s, arc_m, arc_h)

		x-w/2, y-w/2, w, w)

I don't know exactly at what point in the script it needs to be set and can't test it here because I don't use a compositor.

#16 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-21 20:48:12

fuzamaru wrote:

i ve tried using your code and this is the screenshot:

and i dont know why your code still have same transparency problem
i change argb value to 250, the black color is shown again like test  1 screenshot

any ideas? sad

The transparency problem comes from the way the lua script draws images using imlib2.

Adding this line to the script "imlib_context_set_blend(0)" like this may make it work when using a compositor.

	-- combine the clock
	local buffer = imlib_create_image(w_img, h_img)

Setting "imlib_context_set_blend(0)" when using argb transparency (using a compositor) is the fix for this that was used in conky v1.10.
It does not work correctly when set to "1" which is the default in conky v1.9.1 when using argb transparency.

#17 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-08-21 20:22:09

^ No, but I know a reason it might not work depending on how you wrote your Lua script.

I have seen some peoples Lua scripts where each of their different types of "Draw_X_With_Cairo()" functions creates (and hopefully destroys) a new cairo surface every time it is called.

	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
	local cr = cairo_create(cs)
	"Draw Stuff Here"

I don't think playing with most of those options will do anything unless you are drawing multiple things to the same cairo surface though I have not tested it to make sure.

You can make one cairo surface in your main thread and draw things to it using functions like this.

function draw_shaded_text(CR, text, xpos, ypos, COLOR, shade_color)
	cairo_set_source_rgba (CR,shade_color[1],shade_color[2],shade_color[3],shade_color[4]) --# set shade color
	cairo_move_to (CR,(xpos + 1),(ypos + 1))
	cairo_show_text (CR,text)
	cairo_stroke (CR)
	cairo_set_source_rgba (CR,COLOR[1],COLOR[2],COLOR[3],COLOR[4]) --# set font color
	cairo_move_to (CR,xpos,ypos)
	cairo_show_text (CR,text)
	cairo_stroke (CR)
	return CR
end --# function cr = draw_shaded_text(cr, )

#18 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-21 14:30:15

BraxnerM wrote:

The only concern that remains to me, is the best way to control my update depending data-collection, i.e. how best to avoid multiple entires due to, say, GUI-triggered updates. Is 'buffering' the update-readout from conky the most sensible way?

I do this to protect collected data in my lua scripts.

--#### Setup Global Variables ####
if tonumber(conky_parse('${updates}')) < 2 then --# don't reset these global variables when changes are made to the lua script
	previousEpoch = os.time() --# initialize previous epoch (use to prevent graph tables from being screwed up when other windows are moved across the conky window)
end --# if tonumber(conky_parse('${updates}')) < 2 then

function conky_main() --# main function controls everything else
	local newEpoch = os.time()
	if previousEpoch < newEpoch then
		"Collect Data in Global Variables Here"
	end --# if previousEpoch < newEpoch then
	if previousEpoch < newEpoch then
		previousEpoch = newEpoch
		print("error: epoch check warning old:"..previousEpoch.." new:"..newEpoch)
	end --# if previousEpoch < newEpoch then
end-- end main function

It compares the current output of "os.time()" (the epoch time in seconds) to the value in "previousEpoch".
If the current time is greater than "previousEpoch" is collects and records a new data point otherwise it does nothing.
This checks the time using a Lua function so it does not depend on any of conkys internal update tracking being accurate.

Since Lua does not report epoch time more accurately than one second resolution this won't work for update intervals less than one second.

#19 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-20 16:29:09

iami wrote:

- Running the configs with an own window does not trigger the additional updates aside from the double at the start

I believe this double run at the start is to seed the "${cpu_X}" variables with data if they are used in a conky so they don't return blank values on the first run like they used to.
The extra run still happens even if you don't call them but does nothing in that case.

iami wrote:

I do not have an explanation for the difference in counter and updates for the windowed instances, this needs further investigation (maybe forced window updates?). When not having the own window the behaviour of conky just seems wrong as we found out earlier.

If you mean you are using "own_window no" (you don't specify what "not having the[ir] own window" means setting wise here) I believe this will cause all conkys using that setting to share the same window (possibly the root window).
Since the Lua scripts in conkys drawing to that window run every time the window is redrawn and every time any conky updates that window it causes a redraw of that window all the "own_window no" conkys Lua scripts would run every time any of the conkys updates.

#21 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-18 18:43:37

BraxnerM wrote:

Ensuring proper data handling would thus necessitate an in-function check on the origin of the update, and that is something that I have not seen routinely done in any hooked functions I have come across.

I do it in my scripts because dragging windows across the conky windows triggers updates.
It is very obvious what must be happening looking at a CPU graph done completely with LUA while dragging the window.

Are you two loading the same lua file in each conky?
Try making a copy of it with a different name for each conky you start.
If that changes nothing also try doing that and change the name of the function you call in conky to something different for conky.

#22 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-18 12:42:36

@iami & BraxnerM
Certain things can trigger a conky update other than it being "on time".
Two I know of are dragging a window across a conky (this forces updates as the window manager needs to redraw constantly) and changing workspaces in some window managers.
If any of your conky windows overlap it might be something related to the dragging thing.
I have three conky windows on one computer that don't overlap and never had anything like this happen with v1.9.1 except the previously mentioned "draw_shades yes" bug.

#23 Re: Tips, Tricks & Scripts » Conky v1.9 Thread » 2015-08-18 03:24:44

iami wrote:

As for the bug fix from 1.9 -> 1.9.1 (double calling) i've only found this commit which is related to the issue: Commit since it's filed by arclance (which is active on this forum), he might want to way in on this issue.

This is the bug report associated with that commit.
I don't know much about the language but I believe that the fix was just to move the code that runs the Lua part of conky out of "static void draw_text(void)".
Since the shaded text in conky is made by drawing the text twice (once in the shade color offset by a certain number and then again in the normal color at the normal position) putting it there caused it to run twice when "draw_shades yes" is set.

#24 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-07-28 18:35:18

^ You can read the values from a single text file into your Lua script periodically but it is only worth doing that if you change the colors very often (more than once a day?).
If you don't change them very often it would be less work to just change the scripts manually.

#25 Re: Tips, Tricks & Scripts » Conky v1.10 Thread » 2015-07-28 17:56:45

^ I don't believe so.
You can create a global variable in your Lua script to store the color you use for color0 and just call that variable every time you want to use that color.
I can post an example when I get home from work if you need one.

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo