SEARCH

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

You are not logged in.

#8726 2015-08-21 22:47:22

fuzamaru
New Member
Registered: 2015-08-21
Posts: 2

Re: Conky v1.9 Thread

arclance wrote:

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)
	imlib_context_set_image(buffer)
	imlib_image_set_has_alpha(1)
	imlib_image_clear()
	imlib_context_set_blend(0)
	imlib_blend_image_onto_image(

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.

thanks
i tried that but fail like this
1494k74.png

This is the lua script with added "context_set_blend" line

require 'imlib2'

image_path = os.getenv ('HOME')..'/.conky/just_another_clock/images/'

function fFreeImage (image)
	imlib_context_set_image(image)
	imlib_free_image ()
end

function fRotateImage (image, arc)
	imlib_context_set_image(image)
	return imlib_create_rotated_image(arc)
end

function fGetImageSize(image)
	imlib_context_set_image(image)
	return imlib_image_get_width(), imlib_image_get_height()
end

function create_clock(theme, arc_s, arc_m, arc_h)

	-- load images and rotate if necessary
	local imgBase =  imlib_load_image(image_path..theme..'/base.png')
	local w_img, h_img = fGetImageSize(imgBase)

	local imgH =  imlib_load_image(image_path..theme..'/h.png')
	local imgHR = fRotateImage (imgH, arc_h)
	local w_imgH, h_imgH = fGetImageSize(imgHR)

	local imgM =  imlib_load_image(image_path..theme..'/m.png')
	local imgMR = fRotateImage (imgM, arc_m)
	local w_imgM, h_imgM = fGetImageSize(imgMR)

	local imgS =  imlib_load_image(image_path..theme..'/s.png')
	local imgSR = fRotateImage (imgS, arc_s)
	local w_imgS, h_imgS = fGetImageSize(imgSR)

	local imgGlass =  imlib_load_image(image_path..theme..'/glass.png')

	-- combine the clock
	local buffer = imlib_create_image(w_img, h_img)
	imlib_context_set_image(buffer)
	imlib_image_set_has_alpha(1)
	imlib_image_clear()
	imlib_context_set_blend(0)
	imlib_blend_image_onto_image(
		imgBase, 1,
		0, 0, w_img, h_img,
		0, 0, w_img, h_img )

	imlib_blend_image_onto_image(
		imgHR, 0,
		0, 0, w_imgH, h_imgH,
		w_img/2-w_imgH/2, h_img/2-h_imgH/2, w_imgH, h_imgH )

	imlib_blend_image_onto_image(
		imgMR, 0,
		0, 0, w_imgM, h_imgM,
		w_img/2-w_imgM/2, h_img/2-h_imgM/2, w_imgM, h_imgM )

	imlib_blend_image_onto_image(
		imgSR, 0,
		0, 0, w_imgS, h_imgS,
		w_img/2-w_imgS/2-1, h_img/2-h_imgS/2-1, w_imgS, h_imgS )

	imlib_blend_image_onto_image(
		imgGlass, 1,
		0, 0, w_img, h_img,
		0, 0, w_img, h_img )

	fFreeImage (imgBase)
	fFreeImage (imgH)
	fFreeImage (imgHR)
	fFreeImage (imgM)
	fFreeImage (imgMR)
	fFreeImage (imgS)
	fFreeImage (imgSR)
	fFreeImage (imgGlass)

	return buffer

end

function conky_imlib_clock(theme,w,x,y)

	if conky_window==nil then return ' ' end

	local w = w or 200
	local x = x or conky_window.width / 2
	local y = y or conky_window.height / 2

	local arc_s = (2 * math.pi / 60) * os.date("%S")
	local arc_m = (2 * math.pi / 60) * os.date("%M") + arc_s / 60
	local arc_h = (2 * math.pi / 12) * os.date("%I") + arc_m / 12

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

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

	fFreeImage (buffer)

	return ' '
end

Offline

Help fund CrunchBang, donate to the project!

#8727 2015-08-21 22:55:41

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

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

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

	imlib_context_set_blend(0)
	imlib_render_image_on_drawable_at_size(
		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.

Offline

#8728 2015-08-23 09:33:32

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

So,

I am trying to create a conky to run fortune in the upper-ish left hand corner of my screen. My LCD is 1440x900.

I found this code:

${execi 60 fortune -sn 300 | fold -s -w 80}

Could someone explain the -sn and what it does?

What about piping to to fold? what are those switches?

Ideally I am trying to create a "text box" to display fortunes in. I'd like the text to wrap around if it exceeds the width of the conky. In this case I specified a width of 350.

Here's the conky I'm using now. Mostly copied the stuff from one of the built in BunsenLabs conky's, then copied in the code I found on the web.

###  Begin Window Settings  #####################
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
own_window_colour 000000
own_window_class Conky
own_window_title Bunsen Labs Left Conky

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes # Options: yes or no

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 50

minimum_size 350 600 width | height
maximum_width 350

gap_x 20	# l|r
gap_y 45	# u|d

alignment tl
#######################  End Window Settings  ###
###  Font Settings  #############################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Liberation Mono:bold:size=9
xftfont Liberation Sans:size=10

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
#########################  End Font Settings  ###
###  Colour Settings  ###########################
draw_shades no #yes
default_shade_color 000000

draw_outline no # amplifies text if yes
default_outline_color 000000

#default_color 656667 # Waldorf original colour
#default_color 7a7a7a # Flame  & Bunsen Grey
#default_color 929292 # Labs Grey
default_color C0C0C0 # Silver
color0 B0E0E6 # PowderBlue
color1 778899 # LightSlateGray
color2 D8BFD8 # Thistle
color3 9ACD32 # YellowGreen
color4 FFA07A # LightSalmon
color5 FFDEAD # NavajoWhite
color6 00BFFF # DeepSkyBlue
color7 5F9EA0 # CadetBlue
color8 BDB76B # DarkKhaki
color9 CD5C5C # IndianRed
#######################  End Colour Settings  ###
###  Borders Section  ###########################
draw_borders no
# Stippled borders?
stippled_borders 5
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 2
# graph borders
draw_graph_borders yes #no
#default_graph_size 15yes 40
########################  End Borders Secton  ###
###  Miscellaneous Section  #####################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 needs more for single commands that
# "call" a lot of text IE: bash scripts
#text_buffer_size 6144

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable the image cache.
imlib_cache_size 0

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit

#################  End Miscellaneous Section  ###

update_interval 1

TEXT
${font Mono:size=12}
${execi 60 fortune -sn 300 | fold -s -w 80}
${font}

Here's a screenshot of it running:

2015_08_23_02_40_04_scrot.jpg

As you can see i'd like the text, say 5 pixels in from the edge of the orange in my wallpaper.

Some fortunes are short and display just fine, as they are usually only a few words. But some are about a paragraph in length. So I figure a box with a width of 350 pixels and height of 600 should do the trick. Any help would be appreciated.

Thanks!

Last edited by Temetka (2015-08-23 09:44:47)

Offline

#8729 2015-08-23 14:46:44

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

${execi 60 fortune -sn 300 | fold -s -w 80}
man fortune
man fold

From the "man fortune" page

       -n length
              Set the longest fortune length (in characters) considered to be ``short'' (the default is 160).
              All  fortunes longer than this are considered ``long''.  Be careful!  If you set the length too
              short and ask for short fortunes, or too long and ask  for  long  ones,  fortune  goes  into  a
              never-ending thrash loop.
       -s     Short apothegms only.  See -n on which fortunes are considered ``short''.

Your code sets the "short" length to be 300 so "fortunes" with a length almost double the default 160 default can be used.

From the "man page" for fold

       -s, --spaces
              break at spaces

       -w, --width=WIDTH
              use WIDTH columns instead of 80

80 is the default and -s will break the line at the space just before the 80th character

Most fortunes are set at 80 characters anyway so folding them there is an overkill IMHO.

Now your "box size" with your font

minimum_size 350 600 width | height
maximum_width 350
xftfont mono:size=12

only allows for about 35 characters you will run into fortunes you can't read properly.

Here's what I'm using for this example:

minimum_size 550 1000 width | height
maximum_width 550
xftfont mono:size=9

TEXT
 ${time %T}${alignr}${time %x}
${alignc}UTC ${tztime UTC  %H:%M:%S}
${alignc}${uptime}
${color9}${membar 0}${color}
123456789|123456789|123456789|123456789|123456789|123456789|123456789|123456789|
${execi 60 fortune -c | fold -sw 80}
${color9}${membar 0}${color}
123456789|123456789|123456789|123456789|123456789|123456789|123456789|123456789|
${execi 60 fortune -c | fold -sw 80}
${color9}${membar 0}${color}
A green hunting cap squeezed the top of the fleshy balloon of a head.  The
green earflaps, full of large ears and uncut hair and the fine bristles that
grew in the ears themselvse, stuck out on either side like turn signals
indicating two directions at once.  Full, pursed lips protruded beneath the
bushy black moustache and, at their corners, sank into little folds filled
with disapproval and potato chip crumbs.  In the shadow under the green visor
of the cap Ignatius J. Reilly's supercilious blue and yellow eyes looked down
upon the other people waiting under the clock at the D. H. Holmes department
store, studying the crowd of people for signs of bad taste in dress.  Several
of the outfits, Ignatius noticed, were new enough and expensive enough to be
properly considered offenses against taste and decency.  Possession of
anything new or expensive only reflected a person's lack of theology and
geometry; it could even cast doubts upon one's soul.
		-- John Kennedy Toole, "Confederacy of Dunces"
${color9}${membar 0}${color}
${execi 60 cat /media/5/conky/green.txt | fold -sw 78}

The text: "A green hunting cap squ ....." comes from
/usr/share/games/fortunes/people
and I copied it to a file to show the folds function as well

The hard coded line breaks in the fortune files seems to be between 78 and 80 so "fold" isn't really needed and folded at 50 for the last one looks weird and broken.
2015_08_23_11_39_39_Scrot11.jpg
What you have to do is set a font size and window width that will display 80 across that your are comfortable with.

===================

minimum_size 550 0 width | height
maximum_width 550
xftfont mono:size=9
TEXT
 ${time %T}${alignr}${time %x}
${alignc}UTC ${tztime UTC  %H:%M:%S}
${alignc}${uptime}
${color9}${membar 0}${color}
${execi 60 fortune}
${color9}${membar 0}${color}

2015_08_23_11_50_17_Scrot11.jpg 2015_08_23_11_54_12_Scrot11.jpg 2015_08_23_11_53_37_Scrot11.jpg
2015_08_23_11_53_16_Scrot11.jpg 2015_08_23_11_56_00_Scrot11.jpg 2015_08_23_11_56_14_Scrot11.jpg


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8730 2015-08-24 05:31:16

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

Weird, I'm still getting text cutoff at the bottom. I'll keep playing with it.

Thanks for you help.

Offline

#8731 2015-08-24 12:46:02

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

^ 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.

Offline

#8732 2015-08-26 00:49:03

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

I saw this site early this morning, 3Quarks » Set Theory Clock, and thought Conky can do that ... and mixed up with life today I did it.  No LUA, no bash, just conky!
The number in the corner is Average CPU usage
Berlin Clock 19:44 - round one on top, on/off every second.
2015_08_25_19_30_25_Scrot11.png 2015_08_25_19_31_17_Scrot11.png 2015_08_25_19_32_29_Scrot11.png
only fbpanel running - 13 other conkys running -  and added iceweasel.

How it functions

The Set Theory Clock, also known as the Berlin Clock, makes use of the principle of set theory to depict the time. The time of day is displayed in a 24-hour format and can be determined by simply adding and multiplying the glowing lights.

The first, uppermost row consists of 4 red lights, whereby each of these lights stands for 5 full hours. The 4 red lights in the second row display one full hour apiece. For example, if the first 2 lights in the uppermost row and all 4 lights in the second row are lit up, that represents 1400 hours, or 2 p.m. (2 × 5 + 4 hours). The third row is composed of 11 lights: 3 red and 8 yellow. Each light in this row stands for 5 elapsed minutes. The 3 red lights have been assigned to mark the quarters of an hour and are intended to make reading the clock easier. Last of all, the yellow row at the very bottom displays units of single minutes.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8733 2015-08-30 00:21:30

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

Thanks for the help. It's working OK for now.

What I need to do is figure out how many pixels each character takes to display. So for my LCD which has a resolution of 1440x1050, see here for conversion:

http://www.unitconversion.org/typograph … rsion.html

So for 80 characters as you suggest, I would need a width of 640 pixels. That's huge.

I understand that "fold" will handle the line break / wrap around. I am using a centered wallpaper and I do not want the fortune to overlap the wallpaper. So I did some basic checking by adding a line of X's to the conky. For my purposes I would like a window width of 58 characters.

I think this works:

minimum_size 400 750 width | height
maximum_width 400
xftfont mono:size=9

For folding at the 58th character, I think I should actually do the fold at 57 to account for spaces? So the command for that would be:

${execi 60 fortune | fold -s -w 57}

I do get some formatting issues, but considering the artificial constraints I am placing on the system (height, width) I think it works ok. Check this out:

2015_08_29_17_19_23_scrot.jpg

And the conky:

# Text alignment, other possible values are commented
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right

# Create own window instead of using desktop
own_window yes
own_window_hints undecorated,below,sticky,skip_pager,skip_taskbar
# normal, desktop, override
own_window_type normal

# Use pseudo transparency with own_window?
own_window_transparent yes

# If own_window_transparent is set to no, you can set the background colour here
#own_window_colour black

background no

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer yes

# Use Xft?
use_xft yes
text_buffer_size 6144
minimum_size 400 750 width | height
maximum_width 400
xftfont mono:size=9

TEXT
${color orange}${execi 60 fortune | fold -s -w 57}${color}

I chose orange for the text color to match the wallpaper somewhat.

Offline

#8734 2015-08-30 00:40:42

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Temetka wrote:

For folding at the 58th character, I think I should actually do the fold at 57 to account for spaces? So the command for that would be:

${execi 60 fortune | fold -s -w 57}

I do get some formatting issues, but considering the artificial constraints I am placing on the system (height, width) I think it works ok. Check this out

Like you said: "but considering the artificial constraints I am placing on the system" I thinks that's quite reasonable.

The -s in the fold command takes care of the spaces.  "fold -sw 58" should work just as well and give you that extra character ar times.
Thanks for the link - keeper.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8735 2015-08-30 02:41:07

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

I will add that switch.

Thanks for all the help. smile

Offline

#8736 2015-09-02 07:51:43

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: Conky v1.9 Thread

I am not sure if this is the right thread or not. I am running bunsenlabs, conky-all is v1.9.0.6. I am wondering if anyone has figured out how to show the real uptime in conky. That is, the uptime from the last suspend and/or hibernation. I am running laptop-mode-tools, but I think the suspends and hibernations are done via systemd. Anyone with any ideas?

Offline

#8737 2015-09-02 12:34:51

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

^ 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.

Last edited by arclance (2015-09-02 15:42:28)

Offline

#8738 2015-09-02 12:42:31

PackRat
#! Die Hard
From: USA
Registered: 2011-03-03
Posts: 1,572

Re: Conky v1.9 Thread

Do you want something like this?

If any of those commands or scripts work for you- or you have written your own- , you can use them in your .conkyrc.


"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe

Offline

#8739 2015-09-02 21:12:33

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: Conky v1.9 Thread

Yes, thank you, I was looking for exactly that!

Offline

#8740 2015-09-02 22:23:24

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

PackRat - that's awesome!


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8741 2015-09-05 11:38:03

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: Conky v1.9 Thread

As a follow-up, I have now the following script:

#!/bin/bash
WAKEUPTIME=$(grep "PM: resume of devices complete" /var/log/messages | tail -1 $
let SECONDS=(`date +%s`-`date +%s -d "$WAKEUPTIME"`)
if [[ $SECONDS -ge 86400 ]]
then
    echo $((SECONDS/86400))"d" 
fi
echo $(date -d "1970-01-01 + $SECONDS seconds" "+%kh %Mm %Ss")

I use $exec in conkyrc and it gives me the real uptime. That is, it works exactly as it is intended:

Uptime:${alignr}${uptime}
Resume:${alignr}${exec ~/bin/lastwakeup}

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?

Thank you.

Edit: I just realized that the above code does not work well if the machine has been rebooted but not has been suspended since. It is easy to remedy that by altering the script, but then both Uptime and Resume would be the same and then only one would be needed. That is, in such a situation the line with "Resume" should not be shown. Is it possible to do this?

Thank you.

Last edited by ghorvath (2015-09-05 13:16:29)

Offline

#8742 2015-09-05 13:29:45

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

I don't use hibernate or suspend and scripts are not my forte.

Maybe:

pre_exec     shell command     Executes a shell command one time before conky displays anything and puts output as text.

Uptime:${alignr}${uptime}
Resume:${alignr}${pre_exec ~/bin/lastwakeup}

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8743 2015-09-05 14:22:40

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

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.

@Sector11
${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.

Last edited by arclance (2015-09-05 14:44:24)

Offline

#8744 2015-09-05 14:39:54

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

I think I will be staying with conky v1.9 for as long as I can then, plus I'm LUA illiterate.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8745 2015-09-05 15:26:58

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: Conky v1.9 Thread

arclance wrote:

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

Ah, yes, I could do that. Or create a RAMDisk. Good idea.

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). Could this mean that the file is cached in the memory anyway, and therefore the optimization is already taken care of?

Offline

#8746 2015-09-06 00:21:39

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: Conky v1.9 Thread

I have two more problems:

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

update_interval_on_battery 6.0
update_interval 3.0

TEXT
${color}${alignc}S Y S T E M    I N F O
${hr}
Host:${alignr}${nodename}
$sysname $kernel $machine
Uptime:${alignr}${uptime}
Resume:${alignr}${exec ~/.config/conky/scripts/lastwakeup}

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.

Thanks for any help.

Offline

#8747 2015-09-06 00:43:59

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

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.

Last edited by arclance (2015-09-06 00:55:48)

Offline

#8748 2015-09-06 01:44:22

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: Conky v1.9 Thread

arclance wrote:
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.

My laptop is a Samsung Series 9 NPC900X3C. acpi detects Battery 0, so I guess something else must be going on....

arclance wrote:
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).

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.

arclance wrote:
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.

I checked it with iotop, as well, but you are right, I probably should check it with conky, as well, with a much smaller update interval.

Thank you for the help.

Offline

#8749 2015-09-06 02:38:51

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

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.

Offline

Be excellent to each other!

#8750 2015-09-06 14:57:09

ghorvath
#! Member
Registered: 2015-05-20
Posts: 53

Re: Conky v1.9 Thread

arclance wrote:

What conky object are you actually trying to use here?

Here is what I use for the mounted partitions:

${if_mounted /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}
Z${goto 60}${fs_used /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}${goto 120}\
${if_match ${fs_used_perc /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}<10}\
  ${fs_used_perc /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}%\
${else}${if_match ${fs_used_perc /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}<70}\
 ${fs_used_perc /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}%\
${else}${if_match ${fs_used_perc /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}<100}\
 $color9${fs_used_perc /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}%$color\
${else}
${endif}${endif}${endif}\
${alignr}${fs_size /run/user/1000/gvfs/smb-share:server=raspberrypi,share=usbhdd1/}${endif}\

The process I do is the following: I go to Thunar, then to Network on the left, then I browse the network, find the raspberrypi, and then I click on usbhdd1, it asks for my password, I give it, and then the /run/user..... folder becomes existing. There is no fstab entry (nor do I want one, because I want that different users mount it with different rights, and Thunar just does it automatically), but it always will be in this particular directory. I even have a symlink in my home directory to this one, which works when I do the above process with Thunar first. I tried to change the above code with the symlink, no change. One thing might be important to note, though. The command df does not show the samba mount.

arclance wrote:

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.

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.

Offline

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