SEARCH

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

You are not logged in.

#7201 2014-03-22 17:00:45

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

Re: Conky v1.9 Thread

Last edited by Sector11 (2014-03-22 19:41:30)

Offline

Be excellent to each other!

#7202 2014-03-22 17:36:22

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

Re: Conky v1.9 Thread

Offline

#7203 2014-03-22 18:20:30

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Conky v1.9 Thread

Last edited by Joe90 (2014-03-22 18:21:28)

Offline

#7204 2014-03-22 18:40:59

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

require 'cairo'
run=1
count=1
function conky_main()
if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
--#########################################################################################################
--settings #####################################################
local folder="/home/mcdowall/Desktop/testfolder/"
local files={--enter text filenames in quotes, with comma following
"text1.txt",
"text2.txt",
"text3.txt",
}--closes table
local interval=10--conky updates before switching
--set positions
--x,y coordinates of bottom left of first word of text
local x1=30
local y1=50
--set gap in pixels between lines
local gap=15
--set wrap length
local wrap=50--set 0 for no wrap
--set text
local font="Sans"--name of font in brackets
local font_size=15
--setup rounded image border
local r=20--corner radius
local border_width=20
local imagepath={--enter image path and filenames in quotes, with comma following
"/home/mcdowall/Desktop/testfolder/pic1.png",
"/home/mcdowall/Desktop/testfolder/pic2.png",
"/home/mcdowall/Desktop/testfolder/pic3.png",
}--closes table
--end of settings
--CODE #######################################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %tonumber(interval))
if timer==0 or run==1 then
	if run==1 then count=1 end
	run=nil
	--textlines={}
	local file=folder..files[count]
	imageshow=imagepath[count]
	local f=io.open(file, "rb")
	local readtext=f:read("*all")
	f:close()
	textlines=readtext:split("\n")
	count=count+1
		if count==#files+1 then--reset count
		count=1
		end
end--timed section
--#########################################################################################################
		if border_width==0 then
		w=tonumber(conky_window.width)
		h=tonumber(conky_window.height)
		x=0
		y=0
		else
		w=tonumber(conky_window.width)-(border_width*2)
		h=tonumber(conky_window.height)-(border_width*2)
		x=border_width
		y=border_width
		end
	local xtl=x+r
	local ytl=y+r
	--top right mid circle
	local xtr=(x+r)+((w)-(2*r))
	local ytr=y+r
	--bottom right mid circle
	local xbr=(x+r)+((w)-(2*r))
	local ybr=(y+r)+((h)-(2*r))
	--bottom right mid circle
	local xbl=(x+r)
	local ybl=(y+r)+((h)-(2*r))
	-----------------------------
	cairo_move_to (cr,xtl,ytl-r)
	cairo_line_to (cr,xtr,ytr-r)
	cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
	cairo_line_to (cr,xbr+r,ybr)
	cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
	cairo_line_to (cr,xbl,ybl+r)
	cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
	cairo_line_to (cr,xtl-r,ytl)
	cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
	cairo_close_path(cr)
	cairo_clip (cr);
	cairo_new_path (cr); --/* path not consumed by clip()*/
	image = cairo_image_surface_create_from_png (imageshow);
	iw = cairo_image_surface_get_width (image);
	ih = cairo_image_surface_get_height (image);
	cairo_scale (cr, w/iw, h/ih);
	cairo_set_source_surface (cr, image, x, y);
	cairo_paint (cr);
	cairo_surface_destroy (image);
	ny=0
		for i=1,#textlines do
		y=y1+(gap*(i-1))+ny
		ny=out({x=x1,y=y,txt=textlines[i],wrap_len=wrap,wrap_gap=gap,f=font,fs=font_size})
		end--for loop
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function
function string:split(delimiter)--#########################################################################
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end--string split
function out(txj)--c,a,f,fs,face,x,y,txt,hj,vj,ro,sxo,syo,sfs,sface,sc,sa #########################################################
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
local function color(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local function justify(jtxt,x,hj,y,vj,f,face,fs)
	if face=="normal" then
	face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL}
	elseif face=="bold" then
	face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD}
	elseif face=="italic" then
	face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL}
	elseif face=="bolditalic" then
	face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD}
	else
	print ('face not set correctly - "normal","bold","italic","bolditalic"')
	end
	cairo_select_font_face (cr,face[1],face[2],face[3])
	cairo_set_font_size(cr,fs)
	cairo_text_extents(cr,jtxt,extents)
	local wx=extents.x_advance
	local wd=extents.width
	local hy=extents.height
	local bx=extents.x_bearing
	local by=extents.y_bearing+hy
	local tx=x
	local ty=y
	--set horizontal alignment - l, c, r
	if hj=="l" then
	x=x-bx
	rad=0
	nx=tx+wx
	elseif hj=="c" then
	x=x-((wx-bx)/2)-bx
	rad=(wx-bx)/2
	nx=tx+(wx/2)
	elseif hj=="r" then
	x=x-wx
	rad=wx-bx
	nx=tx
	else
	print ("hj not set correctly - l, c, r")
	end
	--vj. n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
	if vj=="n" then
	y=y
	rad2=0
	ry=by
	elseif vj=="nb" then
	y=y-by
	rad2=-by
	ry=by
	elseif vj=="m" then
	y=y+((hy-by)/2)
	rad2=((hy-by)/2)
	ry=((hy-by)/2)-by
	elseif vj=="mb" then
	y=y+(hy/2)-by
	rad2=(hy/2)-by
	ry=((hy-by)/2)-by
	elseif vj=="t" then
	y=y+hy-by
	rad2=hy-by
	ry=0+by
	else
	print ("vj not set correctly - n, nb, m, mb, t")
	end
return face,fs,x,y,rad,rad2,tx,ty
end--justify local function #########################################################
--set variables
local c=txj.c 			or default_color		or 0xffffff
local a=txj.a 			or default_alpha		or 1
local f=txj.f 			or default_font			or "mono"
local fs=txj.fs 		or default_font_size		or 12
local x=txj.x 			or 100
local y=txj.y 			or 100
local txt=txj.txt 		or "set txt"
local hj=txj.hj 		or default_hj			or "l"
local vj=txj.vj 		or default_vj			or "n"
local ro=txj.ro			or defaukt_ro			or 0
local face=txj.face		or default_face			or "normal"
local wl=txj.wrap_len		or 0
local wrap_gap=txj.wrap_gap	or 15
--shadow
local shadow=txj.shadow 	or 0
local sxo=txj.sxo 		or default_sxo		or 2
local syo=txj.syo 		or default_syo 		or 2
local sc=txj.sc 		or defualt_sc		or 0x000000
local sa=txj.sa 		or default_sa		or 0.8
local sface=txj.sface		or default_sface	or face
local sfs=txj.sfs		or default_sfs		or fs
--print text ##################################################################
if wl>0 then--do wrap
	local tt={}
	local s=txt:gsub(" $","&|#"):gsub("  ","&|# "):gsub("  ","&|# ")
	for i in string.gmatch(s, "%S+") do --%S+matches words
	table.insert(tt,i)
	end
	local tl=#tt--gets length of table
	local sl=string.len(s)--overall length of text to be wrapped
	lines={}
	if sl<=wl or tl==1 then--if text is shorter or equal to wrap len or only 1 word
	table.insert(lines,s)
	else--text is longer and multiple words
		while sl>wl and tl>1 do
		local lt={}
			if string.len(tt[1])>=wl then
			line=tt[1]
			table.remove(tt,1)
			else
				local ll=0
				while ll+string.len(tt[1])<wl do
				table.insert(lt,tt[1])
				table.remove(tt,1)
				line=table.concat(lt," ")
				ll=string.len(line)
				tl=#tt
				end--while
			end
		table.insert(lines,line)
		lastline=table.concat(tt," ")
		sl=string.len(lastline)
		end--while
	table.insert(lines,lastline)
	end
end--if wrap
--output type
if wl>0 then--wrapped text
	for i=1,#lines do
		local txt=string.gsub(lines[i],"&|#"," ")
		if shadow==1 then
			local face,fs,x,y=justify(txt,x+sxo,hj,y+syo,vj,f,sface,sfs)
			cairo_select_font_face (cr,face[1],face[2],face[3])
			cairo_set_font_size(cr,fs)
			cairo_move_to (cr,x,y+(wrap_gap*(i-1)))
			cairo_set_source_rgba (cr,color(sc,sa))
			cairo_show_text (cr,txt)
			cairo_stroke (cr)
		end--if shadow
		local face,fs,x,y=justify(txt,x,hj,y,vj,f,face,fs)
		cairo_select_font_face (cr,face[1],face[2],face[3])
		cairo_set_font_size(cr,fs)
		cairo_move_to (cr,x,y+(wrap_gap*(i-1)))
		cairo_set_source_rgba (cr,color(c,a))
		cairo_show_text (cr,txt)
		cairo_stroke (cr)
	end--for i=1,#lines
	if #lines>1 then
	return #lines*wrap_gap
	else
	return 0
	end
elseif wl==0 then--regular text
	--draw shadow first
	if shadow==1 then
	local face,fs,x,y=justify(txt,x+sxo,hj,y+syo,vj,f,sface,sfs)
	cairo_select_font_face (cr,face[1],face[2],face[3])
	cairo_set_font_size(cr,fs)
	cairo_move_to (cr,x,y)
	cairo_set_source_rgba (cr,color(sc,sa))
	cairo_show_text (cr,txt)
	cairo_stroke (cr)
	end--if shadow
	local face,fs,x,y=justify(txt,x,hj,y,vj,f,face,fs)
	cairo_select_font_face (cr,face[1],face[2],face[3])
	cairo_set_font_size(cr,fs)
	cairo_move_to (cr,x,y)
	cairo_set_source_rgba (cr,color(c,a))
	cairo_show_text (cr,txt)
	cairo_stroke (cr)
	return nx
end--output type
end--function out

Last edited by mrpeachy (2014-03-22 20:08:23)

Offline

#7205 2014-03-22 19:47:53

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i really like this rounded corners. does this only work with png-files?

Offline

#7206 2014-03-22 19:54:08

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

Offline

#7207 2014-03-22 19:54:36

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

Re: Conky v1.9 Thread

Offline

#7208 2014-03-22 19:56:42

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

Re: Conky v1.9 Thread

Offline

#7209 2014-03-22 20:29:29

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

Re: Conky v1.9 Thread

${goto 20}${color6}SU MO ${color5}${time %b %Y}${color6} FR SA
${goto 20}${color}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color}/' | sed ':a;N;$!ba;s/\n/\n${goto 20}/g'}

Offline

#7210 2014-03-23 08:32:53

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2012-03-22
Posts: 1,026
Website

Re: Conky v1.9 Thread

^You are welcome Sector.

I'm jealous, now your calendars looks so much nicer than mine smile

BTW, nice touch with '$LAR' variable!

Offline

#7211 2014-03-23 12:48:51

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

Re: Conky v1.9 Thread

 23 Mar 14 | 09:02:03 ~
    $ ftxt DJS /media/5/conky
/media/5/conky/met/conkyrc
129:${font Liberation Mono:size=8}${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color1}'"$DJS"'${color}'/}

Last edited by Sector11 (2014-03-23 12:59:57)

Offline

#7212 2014-03-23 15:19:06

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Conky v1.9 Thread

mogrify -format jpg *.png

Offline

#7213 2014-03-23 15:40:59

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Conky v1.9 Thread

Offline

#7214 2014-03-23 16:21:00

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

Re: Conky v1.9 Thread

mogrify -format jpg *.png

Offline

#7215 2014-03-23 16:48:51

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

Re: Conky v1.9 Thread

# conky -c /media/5/conky/7_months_h.conky &
# pkill -xf "conky -c /media/5/conky/7_months_h.conky" &

# OS: ${pre_exec lsb_release -sd}

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
#own_window_hints skip_taskbar,skip_pager
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title Seven Months

# 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

### 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 255

minimum_size 1454 0 # w|h
maximum_width 1454

gap_x 0	# l|r
gap_y 3	# u|d

alignment tm
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont monofur:bold:size=12
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1.0

#font monofur:size=9

# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades yes ##yes
default_shade_color 000000
draw_outline no
default_outline_color 000000

#default_color DCDCDC #220 220 220	Gainsboro
#default_color C0C0C0 #192 192 192 Silver
default_color B0E0E6 #176 224 230 PowderBlue
#default_color D8BFD8 #216 191 216 Thistle
color0 8FBC8F #DarkSeaGreen
color1 C0C0C0 # Silver
#color1 D3D3D3 #LightGrey
#color1 778899 #LightSlateGray
color2 F5F5DC #Beige
color3 87CEFA #LightSkyBlue
#color3 87CEFA #E0FFFF #LightCyan
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 B0E0E6 #PowderBlue
#color7 5F9EA0 #CadetBlue
#color8 FFFFE0 #LightYellow
color8 FFD700 #Gold
#color8 F0E68C #Khaki
color9 FFA07A #LightSalmon
#color9 CD5C5C #IndianRed
#color9 FF0000 #Red
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 05
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 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 th0e image cache.
imlib_cache_size 0

default_bar_size 590 13

#   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  ###
###  LUA Settings  ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.2}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
#--------------------------------
#lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 0 0 0 0 0 0x000000 0.25
#lua_draw_hook_post draw_bg 10 0 0 0 0 0x000000 0.5
#
# TEXT
# ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}

update_interval 1
TEXT
${image /media/5/Conky/images/7_months.png}
${goto 30}SU MO ${pre_exec date --date="-3 month" | awk '{print $2" "$6}'} FR SA
${goto 30}${color3}${execpi 86400 ncal -bh -m `date +%m` -A-3 -B3 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 30}/g'}${color}
 ${voffset -112.5}${goto 235}SU MO ${pre_exec date --date="-2 month" | awk '{print $2" "$6}'} FR SA
 ${goto 235}${color3}${execpi 86400 ncal -bh -m `date +%m` -A-2 -B2 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 235}/g'}${color}${voffset 112.5}
  ${voffset -224.5}${goto 443}SU MO ${pre_exec date --date="-1 month" | awk '{print $2" "$6}'} FR SA
  ${goto 443}${color3}${execpi 86400 ncal -bh -m `date +%m` -A-1 -B1 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 443}/g'}${color}${voffset 224.5}
   ${voffset -336.5}${goto 652}SU MO ${color5}${time %b %Y}${color} FR SA
   ${goto 652}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 652}/g'}${color}${voffset 336.5}
    ${voffset -448.5}${goto 860}SU MO ${pre_exec date --date="1 month" | awk '{print $2" "$6}'} FR SA
    ${goto 860}${color3}${execpi 86400 ncal -bh -m `date +%m` -A1 -B-1 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 860}/g'}${color}${voffset 448.5}
     ${voffset -560.5}${goto 1070}SU MO ${pre_exec date --date="2 month" | awk '{print $2" "$6}'} FR SA
     ${goto 1070}${color3}${execpi 86400 ncal -bh -m `date +%m` -A2 -B-2 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 1070}/g'}${color}${voffset 560.5}
      ${voffset -672.5}${goto 1277}SU MO ${pre_exec date --date="3 month" | awk '{print $2" "$6}'} FR SA
      ${goto 1277}${color3}${execpi 86400 ncal -bh -m `date +%m` -A3 -B-3 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 1277}/g'}${color}${voffset 15}

Offline

#7216 2014-03-23 17:57:16

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

${swapperc}%

Offline

#7217 2014-03-23 18:07:15

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2012-03-22
Posts: 1,026
Website

Re: Conky v1.9 Thread

$ free -h

Offline

#7218 2014-03-23 18:40:21

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

$ free -h

Last edited by Nili (2014-03-23 18:41:21)

Offline

#7219 2014-03-23 18:53:35

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2012-03-22
Posts: 1,026
Website

Re: Conky v1.9 Thread

nili@crunchbang:~$ free -h
             total       used       free     shared    buffers     cached
Mem:          2.0G       1.7G       262M       101M       214M       839M
-/+ buffers/cache:       696M       1.3G
Swap:         4.0G       2.4M       4.0G
nili@crunchbang:~$

Last edited by iMBeCil (2014-03-23 18:55:15)

Offline

#7220 2014-03-23 18:58:26

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Conky v1.9 Thread

Last edited by Joe90 (2014-03-23 21:26:00)

Offline

#7221 2014-03-23 19:08:18

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

nili@crunchbang:~$ free -h
             total       used       free     shared    buffers     cached
Mem:          2.0G       1.7G       262M       101M       214M       839M
-/+ buffers/cache:       696M       1.3G
Swap:         4.0G       2.4M       4.0G # <<<<<<<< this is the swap
nili@crunchbang:~$

Offline

#7222 2014-03-23 19:14:44

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2012-03-22
Posts: 1,026
Website

Re: Conky v1.9 Thread

^You're welcome Nili. Glad I could help.

Offline

#7223 2014-03-23 23:22:54

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

Offline

#7224 2014-03-24 00:51:11

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Conky v1.9 Thread

@ Mr Peachy

I have written a little bash script to randomise filenames (both png and txt), to go with your image display script in lua/conky. I have done it in bash as I cannot even begin to pretend I fully understand what is going on in the lua script !

Assumes:
You have pumped all the files you want into the lua script
All the png and txt files are in the same directory as the bash script
You have created a subfolder called "temp" which is writeable/readable
No other files with the .txt or png extension are in the directory
You are happy for your png & txt files to be sequentially numbered
You will either run this manually, add it to a conky-start script, or create a cronjob to run it periodically
You want randomised files appearing wink

Will handle as many files as you put in, no arguments required

#!/bin/bash

##############################################################
#requires that all png and txt files have a numerical filename
#requires a /temp sub folder
##############################################################

shopt -s extglob

#count number of png files (and of course same number of txt files)
nofiles=$(ls *.png | wc -l)
echo $nofiles

#create txt file containing randomised filenames for png files to use
for i in $(seq -f "%02g" 1 "$nofiles" | shuf)
do
echo $i.png >> png.list
echo $i.txt >> txt.list
done

#renames all png files, using intermediate rename
let count=1
mysub="./temp/"
for newname in $(cat png.list)
do
if [ $count -lt 10 ]; then
mv "0$count.png" "$mysub$newname"
else
mv "$count.png" "$mysub$newname"
fi
let "count++"
done

#renames all txt files, using intermediate rename
let count=1
for newname in $(cat txt.list)
do
if [ $count -lt 10 ]; then
mv "0$count.txt" "$mysub$newname"
else
mv "$count.txt" "$mysub$newname"
fi
let "count++"
done

mv ./temp/* .

rm png.list
rm txt.list

smile

Last edited by Joe90 (2014-03-25 22:22:05)

Offline

Be excellent to each other!

#7225 2014-03-24 14:52:17

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

Re: Conky v1.9 Thread

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: bleh

Debian Logo