SEARCH

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

You are not logged in.

#6751 2013-11-25 22:42:21

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

Sector11 wrote:

Hmmmmmmmm maybe something like Mark did before conky could use images - a python app - check the image: Desktop Info App With Html Support (gtk-desktop-info)
It was actually quite neat and even looked like a conky - but with images.  It was setup so as to use any of his conkyXXXXX.py scripts.

kaivalagi wrote:

Intro

gtk-desktop-info is a python tool to display various pieces of information directly on the desktop, using plugins for html rendering, with html templates and css style sheets for formatting.

The application has been created off the back of existing python scripts used with Conky. The reason for it's creation is a simple one, Conky is great but formatting can suck sometimes...html seemed the obvious choice of formatting giving the user the ability to construct output in a variety of styles based on understood techniques.

Sadly he is no longer in the Linux world.  His new company which involves programming in Windows has stolen him from us.

Yes, a lot like that but with the ability to use more than just python.  I did a bzr checkout of the source and I'll be having a look through that for ideas, thanks.  There are several major differences between what I want to do and that.  The output won't be formatted html though I wouldn't discount that eventuality.  I won't be coding in gtk or qt, python, tcl/tk, wxwindows, fox, or any other dependent addon library.  We're after as close to X as we can get so as to not have to hack in workarounds for different desktops and window managers as well as not having dependencies the user has to install other than the toolkits and libraries they already have or want to use, that means C.  I told you this wasn't going to be easy, and I might add, be done very fast.  I'm after the X window system itself, below all other windows.  I know it's ambitious but so was gtk when the gimp folks wrote it.  Maybe a toolkit for drawing just on the root window?  The X windows source is rather complicated but who knows.

Offline

Help fund CrunchBang, donate to the project!

#6752 2013-11-26 00:11:19

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

Re: Conky v1.9 Thread

@ liquibyte

Just trying to brainstorm a bit ... there is so precious little I can help with but ideas are ideas.  big_smile


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

Offline

#6753 2013-11-26 01:10:53

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

Sector11 wrote:

@ liquibyte

Just trying to brainstorm a bit ... there is so precious little I can help with but ideas are ideas.  big_smile

No, don't get me wrong, I plan on looking at that code most definately.  Trust me when I say you've been a huge help not only to me but many others here as well.  I know I'm rather new to the forum but I've gleaned many an idea before my join date.  I think everyone does this.  I don't code in python because, in my opinion, python broke with v3 and I've always hated the strict whitespace rules.  Half of the things that I try that are coded in python won't even run for me.  I could probably fix that but I shouldn't have to.

Kind of related is how I think lua is also broken by not being what I would consider complete.  And to make this post even better for me.  I've finally worked out the last of the bugs in the clock I've been working on.  Well, the bugs I know about anyway.  Slight edit: I did notice that the word clock is about a second off of the hands but I just noticed that.  It's not my code so I'll see if I can figure out why it's doing that.  It really shouldn't be since it's using the same os.date functions as the hands.  Odd.  Have a go at configuring it and seeing if anything breaks.  I've put the code here but if you want the font that I used just click the pic and download the 7z at deviantart (link's on the right), the font is in the .conky folder.

superclock_by_liquibyte-d6thxdt.png
.conkyrc

own_window true
own_window_transparent true
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_type override
own_window_argb_visual true
update_interval 1.0
use_xft	true
draw_shades false
double_buffer true
minimum_size 400 400
maximum_width 400
alignment top_right
gap_X 0
gap_y 0
lua_load ~/.conky/scripts/superclock.lua
lua_draw_hook_pre draw_superclock
TEXT

superclock.lua

--[[DO NOT SET session.screen0.opaqueMove: false IN FLUXBOX.  The reason for this
is that it's the way Fluxbox manages the window drawing when moving windows with
opaque off and is part of Fluxbox and not a bug with conky, lua, cairo or this
script.  If you want this changed, you have to bug them and not me.  Anyway...
Some functions shamelessly lifted from 'abstract conky by mrpeachy 2010' @ this
thread: http://crunchbang.org/forums/viewtopic.php?pid=78796, clock_rings.lua
by londonali1010 @ http://mylittledesktop.blogspot.com, the Swiss railway clock
for conky @ https://github.com/jrk-/conky_clock and the pretty_time script @ http://askubuntu.com/questions/239838/is-it-possible-for-conky-to-display-time-in-words-and-not-in-numbers
which is based on the code from http://rosettacode.org/wiki/Number_names#Lua.
Updated, fixed and abused for our purposes.  I think enough of the math and functions
have changed that I could actually call this fairly original though the ideas came
from elsewhere. liquibyte - http://www.liquibyte.com & http://www.liquibyte.org]]--
require 'cairo'
words = {"one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine "}
levels = {"thousand ", "million ", "billion ", "trillion ", "quadrillion ", "quintillion ", "sextillion ", "septillion ", "octillion ", [0] = ""}
iwords = {"ten ", "twenty ", "thirty ", "forty ", "fifty ", "sixty ", "seventy ", "eighty ", "ninety "}
twords = {"eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen "}
local function digits(n)
  local i, ret = -1
  return function()
    i, ret = i + 1, n % 10
    if n > 0 then
      n = math.floor(n / 10)
      return i, ret
    end
  end
end
level = false
local function getname(pos, dig)
  level = level or pos % 3 == 0
  if(dig == 0) then return "" end
  local name = (pos % 3 == 1 and iwords[dig] or words[dig]) .. (pos % 3 == 2 and "hundred " or "")
  if(level) then name, level = name .. levels[math.floor(pos / 3)], false end
  return name
end
local function numberToWord(number)
    if(number == 0) then return "zero" end
    local vword = ""
    for i, v in digits(number) do
      vword = getname(i, v) .. vword
    end
    for i, v in ipairs(words) do
      vword = vword:gsub("ty " .. v, "ty-" .. v)
      vword = vword:gsub("ten " .. v, twords[i])
    end
    return vword
end
local function boringTime()
	hours = hours + 0
	mins = mins + 0
	hours = hours % 12
	if(hours == 0) then 
		hours, nextHourWord = 12, "one "
	else
		nextHourWord = numberToWord(hours+1)
	end
	local hourWord = numberToWord(hours)
	if(mins == 0) then 
		return hourWord .. "o'clock "
	elseif(mins < 10) then
		return numberToWord(hours) .. "oh " .. numberToWord(mins)
	else
		return numberToWord(hours) .. numberToWord(mins)
	end
end
local function awesomeTime()
    if(hours == 0) then 
        hours, nextHourWord = 12, "one " 
    else
        nextHourWord = numberToWord(hours+1)
    end
    local hourWord = numberToWord(hours)
    if(mins == 0 ) then 
        return hourWord .. "o'clock"
    elseif(mins == 30) then
        return "half past " .. hourWord
    elseif(mins == 15) then
        return "a quarter past " .. hourWord 
    elseif(mins == 45) then
        return "a quarter to " .. nextHourWord 
    else
        if(mins < 30) then
            return numberToWord(mins) .. "past " .. hourWord
        else
            return numberToWord(60-mins) .. "to " .. nextHourWord
        end
    end
end
local function getHourWord()
    return numberToWord(hours + 0)
end
local function getMinuteWord()
    return numberToWord(mins + 0)
end
local function draw_wordTime(co, across, down, font, slant, weight, text, size, wr, wg, wb, wa)
	local bt = boringTime(tostring)
	local at = awesomeTime(tostring)
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, wr, wg, wb, wa)
	cairo_select_font_face (cr, font, slant, weight);
	if text == boringTime then
		cairo_show_text (cr, bt)
	elseif text == awesomeTime then
		cairo_show_text (cr, at)
	end
	cairo_stroke (cr)
end
local function draw_ring(co, across, down, circrad, rlw, rstart, rend, rr, rg, rb, ra)
	local degrads = math.pi/180
	local start	= rstart*degrads-math.pi/2
	local finish = rend*degrads-math.pi/2
	local xring	= 0+circrad*(math.sin(degrads*rstart))
	local yring	= 0-circrad*(math.cos(degrads*rstart))
	cairo_move_to (cr, across+xring, down+yring)
	cairo_arc (cr, across, down, circrad, start, finish)
	cairo_set_line_width (cr, rlw)
	cairo_set_source_rgba (cr, rr, rg, rb, ra)
	cairo_stroke (cr)
end
local function draw_hand(co, across, down, circrad, hlw, hx, hy, hr, hg, hb, ha)
	xhours = 0+circrad*math.sin(hours_arc)
	yhours = 0-circrad*math.cos(hours_arc)
	xmins = 0+circrad*math.sin(mins_arc)
	ymins = 0-circrad*math.cos(mins_arc)
	xsecs = 0+circrad*math.sin(secs_arc)
	ysecs = 0-circrad*math.cos(secs_arc)
	xdsecs = 0+circrad*math.sin(dsecs_arc)
	ydsecs = 0-circrad*math.cos(dsecs_arc)
	cairo_move_to (cr, across, down)
	cairo_line_to (cr, across+hx, down+hy)
	cairo_set_line_width (cr, hlw)
	cairo_set_source_rgba (cr, hr, hg, hb, ha)
	cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT)
	cairo_stroke (cr)
end
local function draw_date(co, across, down, font, slant, weight, text, size, dr, dg, db, da)
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, dr, dg, db, da)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_show_text (cr, text)
	cairo_stroke (cr)
end
local function draw_suffix(co, across, down, font, slant, weight, text, suffix, size, sr, sg, sb, sa)
	if days == 1 or days == 21 or days == 31 then
		suffix = 'st'
	elseif days == 2 or days == 22 then
		suffix = 'nd'
	elseif days == 3 or days == 23 then
		suffix = 'rd'
	else
		suffix = 'th'
	end
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, sr, sg, sb, sa)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_show_text (cr, text)
	cairo_show_text (cr, suffix)
	cairo_stroke (cr)
end
local function draw_desktop (co, across, down, font, slant, weight, desk, size, dskr, dskg, dskb, dska)
	local desk = tonumber(conky_parse("${desktop}"))
	for desk in tonumber do tonumber = desk end
	cairo_set_source_rgba (cr, dskr, dskg, dskb, dska)
	cairo_move_to (cr, across, down)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_set_font_size (cr, size)
	cairo_show_text (cr, desk)
end
dsecs = os.date("%S") --Define deciseconds as seconds (HAS TO BE GLOBAL OUTSIDE FUNCTION, DON'T MOVE)
function round(num)
	local floor = math.floor(num)
	local ceiling = math.ceil(num)
	if (num - floor) >= 0.5 then
		return ceiling
	end
	return floor
end
function conky_draw_superclock()
	if conky_window == nil then return end
	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)
--------SET HORIZONTAL AND VERTICAL POSITION RELATIVE TO CONKY WINDOW-----------
	across = 200
	down = 170
--------SET THE CLOCK RADIUS----------------------------------------------------
	circrad = 60
--------TURN ON AND OFF THE PARTS OF THE DATE-----------------------------------
	show_weekday	= true
	show_month		= true
	show_days		= true
	show_year		= true
--------TURN ON AND OFF SMOOTH TICKS FOR THE SECONDS HAND-----------------------
	show_smooth		= true
--------TURN ON AND OFF THE SECOND HAND FOR THE CLOCK---------------------------
	show_seconds	= true
--------TURN ON AND OFF THE CLOCK HANDS-----------------------------------------
	show_hands		= true
--------TURN ON AND OFF AM OR PM------------------------------------------------
	show_ampm		= true
--------TURN ON AND OFF WORD TIME-----------------------------------------------
	show_wordtime	= true
--------TURN ON AND OFF THE PIPS------------------------------------------------
	show_pips		= true
--------TURN ON AND OFF THE SOLID RINGS-----------------------------------------
	show_rings		= true
--------TURN ON AND OFF THE MOVING RINGS----------------------------------------
	show_moving		= true
--------TURN ON AND OFF THE DESKTOP INDICATOR-----------------------------------
	show_desk		= true
--------DEFINE THE DATE AND TIME------------------------------------------------
	local update_interval = conky_set_update_interval(0.1)
	secs = os.date("%S")
    mins = os.date("%M")
    hours = os.date("%I")
    local ampm = os.date("%p")
	local weekday = os.date("%A")
	local days = os.date("%e")
	local month = os.date("%B")
	local year = os.date("%Y")
--------MAKE DECISECONDS BEHAVE-------------------------------------------------
	if dsecs ~= secs then
		round(dsecs)
		dsecs = dsecs + 0.1
		if dsecs >= 60 then
			dsecs = 0
		elseif dsecs <= 0 then
			dsecs = 0
			dsecs = dsecs+60
		end
	end
	--print(dsecs) --Turn this on if you want to debug dsecs in a terminal
--------DEFINE THE ARCS---------------------------------------------------------
	dsecs_arc = (2*math.pi/60)*dsecs
    secs_arc = (2*math.pi/60)*secs
    mins_arc = (2*math.pi/60)*mins+secs_arc/60
    hours_arc = (2*math.pi/12)*hours+mins_arc/12
    dsecsperc = ((dsecs/60)*100)*(360/100)
	secsperc = ((secs/60)*100)*(360/100)
	minsperc = ((mins/60)*100)*(360/100)+secs_arc
	hoursperc	= ((hours/12)*100)*(360/100)+mins_arc*4.75 --this seems to be a hack but it works
--------HOURS HAND--------------------------------------------------------------
	if show_hands then
		draw_hand(0, across, down, circrad+30+6, 6, xhours, yhours, 0.4, 0.4, 0.4, 0.5)
	end
--------HOURS RINGS-------------------------------------------------------------
	if show_rings then
		draw_ring(0, across, down, circrad+30, 8, 0, 360, 0.4, 0.4, 0.4, 0.5)
	end
	if show_moving then
		draw_ring(0, across, down, circrad+30, 8, hours_arc-(hoursperc/60), hoursperc, 0.4, 0.4, 0.4, 0.5)
	end
--------HOURS PIP---------------------------------------------------------------
	if show_pips then
		draw_ring(0, across, down, circrad+30, 8, hoursperc-1.1, hoursperc+1.1, 0.5, 0.5, 1.0, 1.0)
	end
--------MINUTES HAND------------------------------------------------------------
	if show_hands then
		draw_hand(0, across, down, circrad+40+6, 4, xmins, ymins, 0.5, 0.5, 0.5, 0.5)
	end
--------MINUTES RINGS-----------------------------------------------------------
	if show_rings then
		draw_ring(0, across, down, circrad+40, 8, 0, 360, 0.5, 0.5, 0.5, 0.5)
	end
	if show_moving then
		draw_ring(0, across, down, circrad+40, 8, mins_arc-(minsperc/60), minsperc, 0.5, 0.5, 0.5, 0.5)
	end
--------MINUTES PIP-------------------------------------------------------------
	if show_pips then
		draw_ring(0, across, down, circrad+40, 8, minsperc-0.7, minsperc+0.7, 0.5, 1.0, 0.5, 1.0)
	end
--------SECONDS HAND------------------------------------------------------------
	if show_seconds then
		if show_hands then
			if show_smooth then
				draw_hand(0, across, down, circrad+50-24, 2, xdsecs, ydsecs, 0.6, 0.6, 0.6, 0.5)
			end
			if not show_smooth then
				draw_hand(0, across, down, circrad+50-24, 2, xsecs, ysecs, 0.6, 0.6, 0.6, 0.5)
			end
		end
--------SECONDS RINGS-----------------------------------------------------------
		if show_rings then
			draw_ring(0, across, down, circrad+50, 8, 0, 360, 0.6, 0.6, 0.6, 0.5)
		end
		if show_moving then
			if show_smooth then
				draw_ring(0, across, down, circrad+50, 8, dsecs_arc-(dsecsperc/60), dsecsperc, 0.6, 0.6, 0.6, 0.5)
			end
			if not show_smooth then
				draw_ring(0, across, down, circrad+50, 8, secs_arc-(secsperc/60), secsperc, 0.6, 0.6, 0.6, 0.5)
			end
		end
--------SECONDS PIP-------------------------------------------------------------
		if show_pips then
			if show_smooth then
				draw_ring(0, across, down, circrad+50, 8, dsecsperc-0.3, dsecsperc+0.3, 1.0, 0.5, 0.5, 1.0)
			end
			if not show_smooth then
				draw_ring(0, across, down, circrad+50, 8, secsperc-0.3, secsperc+0.3, 1.0, 0.5, 0.5, 1.0)
			end
		end
	end
--------DAY OF THE WEEK---------------------------------------------------------
	if show_weekday then
		draw_date(0, across-185, down-120, "virgo01", 0, 0, weekday, 34, 0.4, 0.4, 0.4, 0.8)
	end
--------MONTH-------------------------------------------------------------------
	if show_month then
		draw_date(0, across-185, down+200, "virgo01", 0, 0, month, 34, 0.5, 0.5, 0.5, 0.8)
	end
--------DAY---------------------------------------------------------------------
	if show_days then
		draw_suffix(0, across, down+240, "virgo01", 0, 0, days, suffix, 34, 0.5, 0.5, 0.5, 0.8)
	end
--------YEAR--------------------------------------------------------------------
	if show_year then
		draw_date(0, across-185, down+240, "virgo01", 0, 0, year, 34, 0.6, 0.6, 0.6, 0.8)
	end
--------WORD TIME---------------------------------------------------------------
	if show_wordtime then --valid values are boringTime and awesomeTime 
		draw_wordTime(0, across-185, down+140, "virgo01", 0, 0, boringTime, 20, 0.6, 0.6, 0.6, 0.8)
	end
--------AM / PM-----------------------------------------------------------------
	if show_ampm then
		draw_date(0, across-185, down+165, "virgo01", 0, 0, ampm, 20, 0.6, 0.6, 0.6, 0.8)
	end
--------DESKTOP INDICATOR-------------------------------------------------------
	if show_desk then
		draw_desktop (0, across-10, down+10, "virgo01", 0, 0, desk, 32, 0.6, 0.6, 0.6, 1.0)
	end
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
end

Last edited by liquibyte (2013-11-26 01:23:32)

Offline

#6754 2013-11-26 03:24:48

dk75
#! Junkie
Registered: 2012-06-14
Posts: 250

Re: Conky v1.9 Thread

liquibyte wrote:

I don't think any compositor is going to be an issue as the drawing is going to be at the root and as far as I know all compositors sit above that layer and work on the children.  I could be wrong about this and may be horribly so when it comes to kde.  From what I've read, they do things so differently the only way to detect the window is by size if the comments in the code are still valid.  I'll have to look into this deeper because things may or may not have changed.  I haven't even looked at wayland yet because I've not seen it in the wild.

First thing I'm going to look at is detection of the root window and basic drawing.  Once I have that code cleaned up and properly doing garbage collection I'll have a look at compositing.  Probably going to need some testers for that.

I'm not a programmer, but IMO implementing your own mini WM into program and not using toolkits for that is a mistake.
You say compositor should be not a problem? New GNOME draw background images not to root window but to layer above, so Conky without compositor interface isn't transparent, but because it uses it's own code to draw everything, it's compositor interface is buggy and imlib2 images are semi transparent too with "argb_visuals".

I thought that if you use some high layer toolkit code (gtk, Qt, ...), you could make window for drawing that would be independent from graphics system and work same whatever it run in X11 or Wyland environment.

PS: XWindow will be obsolete in 2-3 years. I plan to hop to Wayland as soon as KDE will be running it natively. Or maybe will try to live without DE but with Wayland for sure. I don't plan to use program that draw to XWindow root window. I don't plan to use XWindow at all.


Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop

Offline

#6755 2013-11-26 14:29:23

martinlowe
New Member
Registered: 2013-11-26
Posts: 1

Re: Conky v1.9 Thread

Hey guys!

I'm just getting into conky(And loving it!), but I've run into a snag. For some reason, I can't seem to get a todo list running on my desktop, even though it seems like such a simple code. I just seem to not be getting it hmm

Any help would be appreciated greatly!

# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
# http://crunchbanglinux.org/forums/topic/2047/conky-help/
#
# Enjoy! :)
##############################################
# Settings
##############################################
background yes
use_xft yes
xftfont Liberation Sans:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
#own_window_argb_visual yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 240
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color fef6c5
default_shade_color 000000
default_outline_color 828282
alignment bottom_right
gap_x 12
gap_y 56
no_buffers no
uppercase no
cpu_avg_samples 2
override_utf8_locale no
##############################################
#  Output
##############################################
TEXT




S Y S T E M    I N F O
${hr}
Host:$alignr$nodename
Kernel:  ${alignr}${kernel}
Uptime:$alignr$uptime
Disk usage:$alignr${fs_used /}/${fs_size /}
RAM:$alignr$mem/$memmax
${membar}
CPU usage:$alignr${cpu cpu0}%
${cpubar cpu0}

N E T W O R K
${hr}${if_existing /proc/net/route eth0}
     Ethernet
Up:          ${upspeed eth0}      ${alignr}${upspeedgraph eth0 16,70 bd573e fef6c5}
Down:     ${downspeed eth0}  ${alignr}${downspeedgraph eth0 16,70 bd573e fef6c5}
Upload:   ${alignr}${totalup eth0}
Download: ${alignr}${totaldown eth0}
IP Address: ${alignr}${addr eth0}${else}
${if_existing /proc/net/route wlan0}
# If statements example in CONKY, to see if and which interfaces on NIC are in use.
    Wireless
Up:          ${upspeed wlan0}      ${alignr}${upspeedgraph wlan0 12,70 bd573e fef6c5}
Down:     ${downspeed wlan0}  ${alignr}${downspeedgraph wlan0 12,70 bd573e fef6c5}
Upload:   ${alignr}${totalup wlan0}
Download: ${alignr}${totaldown wlan0}
IP Address: ${alignr}${addr wlan0}${endif}

T O   D O
${hr}
${execi 900 ~/home/martin/TODO.txt | wrap -w40} 

Screenshot_261113_09_21_58_AM.jpg

Offline

#6756 2013-11-26 14:57:28

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

^ Hello Martinlowe!

try telling conky what to do with your *.txt file

${execi 900 cat ~/home/martin/TODO.txt | wrap -w40} 

greetz -naik


*kaum macht man es richtig, funktioniert es sofort*

Offline

#6757 2013-11-26 15:45:20

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

dk75 wrote:

I'm not a programmer, but IMO implementing your own mini WM into program and not using toolkits for that is a mistake.

I didn't say I was iimplementing a mini WM, I said drawing straight to X without using anybody's toolkit.

dk75 wrote:

You say compositor should be not a problem? New GNOME draw background images not to root window but to layer above, so Conky without compositor interface isn't transparent, but because it uses it's own code to draw everything, it's compositor interface is buggy and imlib2 images are semi transparent too with "argb_visuals".

This is why I was looking at root-tail's code.  Here's an excerpt from the beginning as a comment by the dev:

/* Since xpenguins version 2.1, the ToonGetRootWindow() function
 * attempts to find the window IDs of
 *
 * 1) The background window that is behind the toplevel client
 *    windows; this is the window that we draw the toons on.
 *
 * 2) The parent window of the toplevel client windows; this is used
 *    by ToonLocateWindows() to build up a map of the space that the
 *    toons can occupy.
 * 
 * In simple (sensible?) window managers (e.g. blackbox, sawfish, fvwm
 * and countless others), both of these are the root window. The other
 * more complex scenarios that ToonGetRootWindow() attempts to cope
 * with are:
 *
 * Some `virtual' window managers (e.g. amiwm, swm and tvtwm) that
 * reparent all client windows to a desktop window that sits on top of
 * the root window. This desktop window is easy to find - we just look
 * for a property __SWM_VROOT in the immediate children of the root
 * window that contains the window ID of this desktop window. The
 * desktop plays both roles (1 and 2 above). This functionality was
 * detected in xpenguins 1.x with the vroot.h header file.
 *
 * Enlightenment (0.16) can have a number of desktops with different
 * backgrounds; client windows on these are reparented, except for
 * Desktop 0 which is the root window. Therefore versions less than
 * 2.1 of xpenguins worked on Desktop 0 but not on any others. To fix
 * this we look for a root-window property _WIN_WORKSPACE which
 * contains the numerical index of the currently active desktop. The
 * active desktop is then simply the immediate child of the root
 * window that has a property ENLIGHTENMENT_DESKTOP set to this value.
 *
 * KDE 2.0: Oh dear. The kdesktop is a program separate from the
 * window manager that launches a window which sits behind all the
 * other client windows and has all the icons on it. Thus the other
 * client windows are still children of the root window, but we want
 * to draw to the uppermost window of the kdesktop. This is difficult
 * to find - it is the great-great-grandchild of the root window and
 * in KDE 2.0 has nothing to identify it from its siblings other than
 * its size. KDE 2.1+ usefully implements the __SWM_VROOT property in
 * a child of the root window, but the client windows are still
 * children of the root window. A problem is that the penguins erase
 * the desktop icons when they walk which is a bit messy. The icons
 * are not lost - they reappear when the desktop window gets an expose
 * event (i.e. move some windows over where they were and back again).
 *
 * Nautilus (GNOME 1.4+): Creates a background window to draw icons
 * on, but does not reparent the client windows. The toplevel window
 * of the desktop is indicated by the root window property
 * NAUTILUS_DESKTOP_WINDOW_ID, but then we must descend down the tree
 * from this toplevel window looking for subwindows that are the same
 * size as the screen. The bottom one is the one to draw to. Hopefully
 * one day Nautilus will implement __SWM_VROOT in exactly the same way
 * as KDE 2.1+.
 *
 * Other cases: CDE, the common desktop environment. This is a
 * commercial product that has been packaged with Sun (and other)
 * workstations. It typically implements four virtual desktops but
 * provides NO properties at all for apps such as xpenguins to use to
 * work out where to draw to. Seeing as Sun are moving over to GNOME,
 * CDE use is on the decline so I don't have any current plans to try
 * and get xpenguins to work with it.
 *
 * As a note to developers of window managers and big screen hoggers
 * like kdesktop, please visit www.freedesktop.org and implement their
 * Extended Window Manager Hints spec that help pagers and apps like
 * xpenguins and xearth to find their way around. In particular,
 * please use the _NET_CURRENT_DESKTOP and _NET_VIRTUAL_ROOTS
 * properties if you reparent any windows (e.g. Enlightenment). Since
 * no window managers that I know yet use these particular hints, I
 * haven't yet added any code to parse them.  */
dk75 wrote:

I thought that if you use some high layer toolkit code (gtk, Qt, ...), you could make window for drawing that would be independent from graphics system and work same whatever it run in X11 or Wayland environment.

A toolkit is by its nature a drawing system that sits above the root layer.  Not necessarily so, but still, that's what they're designed to do.

dk75 wrote:

PS: XWindow will be obsolete in 2-3 years. I plan to hop to Wayland as soon as KDE will be running it natively. Or maybe will try to live without DE but with Wayland for sure. I don't plan to use program that draw to XWindow root window. I don't plan to use XWindow at all.

This is the one I'll jump in on the most.  People have been saying X is obsolete for a long time.  Remember the fork fiasco?  I agree that what Wayland is would be wonderful but:

  1. KDE has never listened to it's users

  2. Gnome has never listened to it's users

  3. Most distros have never listened to their users

I seriously doubt that things will go as wonderfully as you hope and I imagine that the first adopters will find bugs that will make downgrades, or concurrent systems, very popular topics that will get scraped by google.  I've been listening to the talk of "Gnome and/or KDE is going to eliminate the competition with their new version" for ten years.  What happened?  The devs made choices that not only broke things but broke them so horribly that it forced users to discover the possibilities of window managers vs. desktops.  Fluxbox, Openbox, Blackbox, FVWM, Sawfish, WindowMaker, Enlightenment, which do I choose?  Linux has, over the last ten years, moved away from what it started as to just another vehicle for advertisement.  I'll bet money that Ubuntu had paid devs sitting in both KDE and Gnome development and I'll bet they won't listen to you or me.[/rant]

If and when Wayland becomes a viable choice and if I can actually develop and implement this program, I will port it accordingly.  Personally I'd like to see it become a reality as well.  Having said that, I'll get the source and have a look to see what kinds of differences I'll be facing.  The one thing I don't want to do is have to support multiple versions.  Wayland and Weston are already in extra and community for arch so I could probably play with it now.

Slight edit from Wayland:

Why duplicate all this work?

Wayland is not really duplicating much work. Where possible, Wayland reuses existing drivers and infrastructure. One of the reasons this project is feasible at all is that Wayland reuses the DRI drivers, the kernel side GEM scheduler and kernel mode setting. Wayland doesn't have to compete with other projects for drivers and driver developers, it lives within the X.org, mesa and drm community and benefits from all the hardware enablement and driver development happening there.

What is the drawing API?

"Whatever you want it to be, honey". Wayland doesn't render on behalf of the clients, it expects the clients to use whatever means they prefer to render into a shareable buffer. When the client is done, it informs the Wayland server of the new contents. The current test clients use either cairo software rendering, cairo on OpenGL or hardware accelerated OpenGL directly. As long as you have a userspace driver library that will let you render into a sharable buffer, you're good to go.

Last edited by liquibyte (2013-11-26 16:55:54)

Offline

#6758 2013-11-26 17:04:46

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

me again with a slide show with conky.
Easier to put the script with the same folder of pictures resized in 318x200 better for cpu usage and convert.
diapo2.jpg
slideshowquad.sh:

#!/bin/bash
 
##########################################################################
##               conky slideshow by Alessandro Roncone                  ##
##                               v 0.2 			                ##
##				 v 0.3 modified by ragamatrix           ##
##                          GNU GPLv3 2012                              ##
##########################################################################
 
##########################################################################
# Settings
##########################################################################
# Directory containing the script and the pictures
directory="$HOME/.conky/slide-show-conky-images"
# Dimension of the slideshow (either "small", "medium" or "big")
dim="big"
recbg=$HOME/.conky/slide-show-conky-images/recbg.png
temp1=$HOME/.conky/slide-show-conky-images/temp1.png
temp2=$HOME/.conky/slide-show-conky-images/temp2.png
finale=$HOME/.conky/slide-show-conky-images/finale.png
################################################################################
#									       
# 
################################################################################

# Manage dimension flag
if [ $dim == "small" ]; then
  geometry="158x100"
  #pos="155,214"
elif [ $dim == "medium" ]; then
  geometry="238x148"
  #pos="85,175"
elif [ $dim == "big" ]; then
  geometry="318x200"
  #pos="0,119"
fi
 
# Pick a random file from all pictures
files=($directory/*.*)
let r="$RANDOM % ${#files[*]}"
randomfile=${files[$r]}
 
# Sets picture for conky to use
# rectangle 1px de moins sur la taille
L=$(echo $geometry|cut -d x -f1);L=$((L - 1))
H=$(echo $geometry|cut -d x -f2);H=$((H - 1))
convert -size $geometry xc:none -fill none -strokewidth 2 -stroke silver -draw "roundrectangle 2,2 $L,$H 7,7" $recbg
convert $randomfile -resize $geometry\! $temp1
convert $temp1 -alpha set -virtual-pixel transparent -channel A -blur 0x7  -threshold 50% +channel $temp2
convert $recbg $temp2 -geometry +1+1 -composite $finale
convert $finale $recbg -composite $finale
convert $finale -bordercolor None -border 10x10 \( +clone -background black -shadow 100x3 \) -compose DstOver -composite -compose Over $finale
#echo "\${image result.png -p $pos}"
exit
0

ConkyPhoto:

# -- Paramètres Conky -- #
# Text alignment, other possible values are commented
alignment tm
#alignment top_right
#alignment bottom_left
#alignment bottom_right
# -- Conky settings -- #
	background yes
	update_interval 1
	cpu_avg_samples 2
	net_avg_samples 2
	override_utf8_locale yes
	double_buffer yes
	no_buffers yes
	text_buffer_size 2048
	imlib_cache_size 0
	# -- Window specifications -- #
	own_window yes
	own_window_type normal
	own_window_transparent yes
	own_window_hints undecorate,skip_taskbar,skip_pager,below,sticky
	show_graph_range no
	show_graph_scale no
	short_units yes
	own_window_class Conky
	border_inner_margin 0
	border_outer_margin 0
# -- Graphics settings -- #
	draw_shades no
	draw_outline no
	draw_borders no
	draw_graph_borders yes
# -- Couleurs -- #
default_color 645D5D
#color1 3B6702
#color2 645D5D
    color0 Cornsilk1#FFD700#GOLD#3b6702 # vert
    color1 black
    color2 white
    color3 EFEFEF # argile
    color4 LightGoldenrod3#vert_spring#645d5d # gris foncé
    color5 7FDD4C # vert clair
    color6 CC0000 # rouge
    color7 884DA7 # mauve
    color8 6892C6 # bleu ciel 2                                      
    color9 443AFF # bleu marine
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 0
gap_y 35
# Minimum size of text area
minimum_size 320 205  #Taille minimum (px) ; largeur / hauteur
maximum_width 320  #Largeur maximum (px)
#out_to_console no
# Force UTF8? note that UTF8 support required XFT
#override_utf8_locale yes
# Stippled borders?
#stippled_borders 0
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
#total_run_times 0
# set to yes if you want all text to be in uppercase
uppercase no
# Add spaces to keep things from moving about?  This only affects certain objects.
#use_spacer no
# -- Text settings -- #
# Use Xft?
use_xft yes
xftalpha 0.8 #0.4
xftfont caviar dreams:style=Bold:size=9 #Helvetica LT Std:size=10 #MaiandraGD:size=10

TEXT

${execi 30 $HOME/.conky/slide-show-conky-images/slideshowquad.sh}
${image $HOME/.conky/slide-show-conky-images/finale.png -p 0,0 -s 318x200}

We can also use another convert effect for example -raise:
-raise

Last edited by ragamatrix (2013-11-26 17:05:55)

Offline

#6759 2013-11-26 17:30:58

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

Re: Conky v1.9 Thread

@ Martinlowe & Naik

First off ...  Welcome to #! Martinlowe.

next ... as naik said ...

try telling conky what to do with your *.txt file

Recently, in this form I believe, it was pointed out to me that 'cat' can be eliminated in situations like this. Can't remember who or I'd give credit for the tip.

man pages suggest why:

  • cat - concatenate files and print on the standard output

  • head - output the first part of files

  • tail - output the last part of files

so I stopped using cat and use:

${execi 3600 head /media/5/Conky/Days/all.txt -n 31}

since I'm not really 'joining' (concatenate) files.

@ Naik - did you mean | fold -w40 ?
However it's a good idea, maybe with an -s in there to brake at spaces and not in the middle of words.  :D

2013_11_26_14_20_17_202x1053_Sector11.jpg
I keep my text less than the dashed lines and the file no longer than 31 lines.  :D


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

Offline

#6760 2013-11-26 17:33:14

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

Re: Conky v1.9 Thread

ragamatrix wrote:

me again with a slide show with conky.

Nice stuff!!!!


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

Offline

#6761 2013-11-26 17:42:29

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

Re: Conky v1.9 Thread

liquibyte wrote:
Sector11 wrote:

@ liquibyte

Just trying to brainstorm a bit ... there is so precious little I can help with but ideas are ideas.  big_smile

No, don't get me wrong, I plan on looking at that code most definately.

Never entered my mind ... I don't know python but I have read where it is 'crazy' about spacing.

I guess if anything I'd look at getting into bash ... I have so many of them and at least I can tweak some of them.  big_smile


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

Offline

#6762 2013-11-26 20:46:47

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

Sector11 wrote:

Never entered my mind ... I don't know python but I have read where it is 'crazy' about spacing.

I guess if anything I'd look at getting into bash ... I have so many of them and at least I can tweak some of them.  big_smile

I think all languages, whether compiled or scripted, should ignore whitespace unless explicitly told not to with the exception of quoted strings.  Bash is always useful for getting things done.  There are very few programs that don't have a command line interface.  Those that don't have a graphical equivalent are usually the most useful and powerful.

While I was sitting here typing I had a thought about what ragamatrix just posted and bash scripting.  Wouldn't it be cool to do the same thing not with a slideshow and images but with a movie.  I'm working out a lua/cairo wordclock right now but might have a go at it and see what might be done, after all, mplayer and vlc both have non-graphical interfaces.  Makes me wonder if the flashplugin could be made to behave in this manner for youtube videos and such.  These are the things I think about that could be made to "plug in" to the program I've been talking about coding.

Offline

#6763 2013-11-27 01:13:32

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

Re: Conky v1.9 Thread

Conky Anonymous

Step 1 - Admitted that we were powerless over conky - and love it!

Desktop 1, 2 & 3 - My general area of work.
d_1.jpg d_2.jpg d_3.jpg
#3 is usually empty, but there are a couple of conkys there under development.

Desktop #4 - my wife's area, with her weather open in a window:
d_4.jpg

That's it normally ... today I opened Desktops 5, 6 & 7 and put the conkys in there that I have an OB menu entry to start.
d_5.jpg d_6.jpg  d_7.jpg
There are a 'few' more but ... ... ...


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

Offline

#6764 2013-11-27 01:35:02

jserink
New Member
Registered: 2013-11-27
Posts: 6

Re: Conky v1.9 Thread

Manipulating Conky object output

Mistake post, sorry.

Last edited by jserink (2013-11-27 01:38:50)

Offline

#6765 2013-11-27 01:37:59

jserink
New Member
Registered: 2013-11-27
Posts: 6

Re: Conky v1.9 Thread

Hi All:

I have this line:
${if_up enp0s25}${color yellow}enp0s25 $color${addrs enp0s25}
and it outputs this:
enp0s25 192.168.111.199, 10.3.36.217

What I want to do is:
Remove the comma,
line feed and insert 8 spaces before the "10.3.36.217" address.

Any tips on how that might be done?

Cheers,
John

Offline

#6766 2013-11-27 02:53:10

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

jserink wrote:

Hi All:

I have this line:
${if_up enp0s25}${color yellow}enp0s25 $color${addrs enp0s25}
and it outputs this:
enp0s25 192.168.111.199, 10.3.36.217

What I want to do is:
Remove the comma,
line feed and insert 8 spaces before the "10.3.36.217" address.

Any tips on how that might be done?

Cheers,
John

All it outputs for me is:

enp0s25 192.168.x.x

  Can you post the whole conkyrc?  Yes, I also have a net named enp, mine is just enp3s0.

Last edited by liquibyte (2013-11-27 02:58:16)

Offline

#6767 2013-11-27 03:48:15

jserink
New Member
Registered: 2013-11-27
Posts: 6

Re: Conky v1.9 Thread

liquibyte wrote:
jserink wrote:

Hi All:

I have this line:
${if_up enp0s25}${color yellow}enp0s25 $color${addrs enp0s25}
and it outputs this:
enp0s25 192.168.111.199, 10.3.36.217

What I want to do is:
Remove the comma,
line feed and insert 8 spaces before the "10.3.36.217" address.

Any tips on how that might be done?

Cheers,
John

All it outputs for me is:

enp0s25 192.168.x.x

  Can you post the whole conkyrc?  Yes, I also have a net named enp, mine is just enp3s0.

Here's my conkyrc file:
alignment bottom_right
background no
border_width 1
cpu_avg_samples 2
default_color green
default_outline_color yellow
default_shade_color green
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=8
gap_x 5
gap_y 5
minimum_size 5 5
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
#window bits that make conky fully transparent
#own_window yes
#own_window_class Conky
#own_window_type override
#own_window_transparent yes
#window bits for semi transparent
own_window yes
own_window_transparent no
own_window_argb_visual yes
own_window_argb_value 110
own_window_class Conky
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#Finish window bits
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer right
show_graph_scale no
show_graph_range no
double_buffer yes
pad_percents 3
maximum_width 162

TEXT
#${scroll 16 $nodename - $sysname $kernel on $machine | }
${color yellow}$nodename
$sysname $kernel
$hr
${color yellow}Uptime:$color $uptime
${color yellow}Localtime:
$color$time
$hr
${color yellow}CPU1:$color ${freq_g 1} GHz ${execi 10 sensors | grep "Core 0" | cut -c17-24}
      ${cpu cpu1}% ${cpugraph cpu1 11,85}
${color yellow}CPU2:$color ${freq_g 2} GHz ${execi 10 sensors | grep "Core 0" | cut -c17-24}
      ${cpu cpu2}% ${cpugraph cpu2 11,85}
${color yellow}CPU3:$color ${freq_g 3} GHz ${execi 10 sensors | grep "Core 1" | cut -c17-24}
      ${cpu cpu3}% ${cpugraph cpu3 11,85}
${color yellow}CPU4:$color ${freq_g 4} GHz ${execi 10 sensors | grep "Core 1" | cut -c17-24}
      ${cpu cpu4}% ${cpugraph cpu4 11,85}
${color yellow}CPU5:$color ${freq_g 5} GHz ${execi 10 sensors | grep "Core 2" | cut -c17-24}
      ${cpu cpu5}% ${cpugraph cpu5 11,85}
${color yellow}CPU6:$color ${freq_g 6} GHz ${execi 10 sensors | grep "Core 2" | cut -c17-24}
      ${cpu cpu6}% ${cpugraph cpu6 11,85}
${color yellow}CPU7:$color ${freq_g 7} GHz ${execi 10 sensors | grep "Core 3" | cut -c17-24}
      ${cpu cpu7}% ${cpugraph cpu7 11,85}
${color yellow}CPU8:$color ${freq_g 8} GHz ${execi 10 sensors | grep "Core 3" | cut -c17-24}
      ${cpu cpu8}% ${cpugraph cpu8 11,85}
${color yellow}RAM :$color $mem  $memmax   
      $memperc% ${membar 4,85}
${color yellow}Swap:$color $swap/$swapmax
      $swapperc% ${swapbar 4,85}
${color yellow}CPU :$color $cpu% ${cpubar 4}
${color yellow}Processes:$color $processes
${color yellow}Running  :$color $running_processes
${color yellow}Theads   :$color $threads
$hr
${color yellow}Networking
${if_up wlp3s0}wlp3s0  $color${addrs wlp3s0}
${color yellow}Up:$color ${upspeed wlp3s0} ${upspeedgraph wlp3s0 11,70}
        ${color yellow}Dn:$color ${downspeed wlp3s0} ${downspeedgraph wlp3s0 11,70}${endif}
${if_up enp0s25}${color yellow}enp0s25 $color${addrs enp0s25}
${color yellow}Up:$color ${upspeed enp0s25} ${upspeedgraph enp0s25 11,70}
${color yellow}Dn:$color ${downspeed enp0s25} ${downspeedgraph enp0s25 11,70}${endif}
${if_up tap0}${color yellow}tap0    $color${addrs tap0}
${color yellow}Up:$color ${upspeed tap0} ${upspeedgraph tap0 11,70}
${color yellow}Dn:$color ${downspeed tap0} ${downspeedgraph tap0 11,70}${endif}
${if_up ppp0}${color yellow}ppp0    Up:$color ${upspeed ppp0} ${upspeedgraph ppp0 11,23}
        ${color yellow}Dn:$color ${downspeed ppp0} ${downspeedgraph ppp0 11,23}${endif}
${if_up ppp1}${color yellow}ppp1    Up:$color ${upspeed ppp1} ${upspeedgraph ppp1 11,23}
        ${color yellow}Dn:$color ${downspeed ppp1} ${downspeedgraph ppp1 11,23}${endif}
${if_up wlp3s0}$hr${color yellow}Wireless Information:
${color yellow}AP     : $color${wireless_essid wlp3s0}
${color yellow}Bitrate: $color${wireless_bitrate wlp3s0}
${color yellow}Link   : $color${wireless_link_qual_perc wlp3s0}%
${endif}
$hr
${color yellow}Temperatures
${color yellow}HDD:${color} +${hddtemp /dev/sda} °C
${color yellow}ATI:${color} ${execi 5 sensors | grep -v "(crit = +10" | grep -m 2 'temp1'|cut -c15-22}
${color yellow}CPU:${color} ${execi 5 sensors | grep "Physical id 0:  "|cut -c17-24}
$hr
${color yellow}Power
${color yellow}AC Adapter: ${color}${acpiacadapter}
${color yellow}Battery   : ${color}${battery_percent}%
$hr
${color yellow}sda  wrt:$color ${diskio_write /dev/sda} ${diskiograph /dev/sda 12,35} ${color yellow}
      rd:$color ${diskio_read /dev/sda} ${diskiograph_read /dev/sda 11,35}
#${color yellow}sdb  write:$color ${diskio_write /dev/sdb} ${diskiograph /dev/sdb 12,35} ${color yellow} read:$color ${diskio_read /dev/sdb} ${diskiograph_read /dev/sdb 11,35}

Offline

#6768 2013-11-27 04:41:40

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

jserink wrote:
liquibyte wrote:
jserink wrote:

Hi All:

I have this line:
${if_up enp0s25}${color yellow}enp0s25 $color${addrs enp0s25}
and it outputs this:
enp0s25 192.168.111.199, 10.3.36.217

What I want to do is:
Remove the comma,
line feed and insert 8 spaces before the "10.3.36.217" address.

Any tips on how that might be done?

Cheers,
John

All it outputs for me is:

enp0s25 192.168.x.x

  Can you post the whole conkyrc?  Yes, I also have a net named enp, mine is just enp3s0.

Here's my conkyrc file:

alignment bottom_right
background no
border_width 1
cpu_avg_samples 2
default_color green
default_outline_color yellow
default_shade_color green
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=8
gap_x 5
gap_y 5
minimum_size 5 5
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
#window bits that make conky fully transparent
#own_window yes
#own_window_class Conky
#own_window_type override
#own_window_transparent yes
#window bits for semi transparent
own_window yes
own_window_transparent no
own_window_argb_visual yes
own_window_argb_value 110
own_window_class Conky
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#Finish window bits
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer right
show_graph_scale no
show_graph_range no
double_buffer yes
pad_percents 3
maximum_width 162 

TEXT
#${scroll 16 $nodename - $sysname $kernel on $machine | }
${color yellow}$nodename
$sysname $kernel
$hr
${color yellow}Uptime:$color $uptime 
${color yellow}Localtime:
$color$time
$hr
${color yellow}CPU1:$color ${freq_g 1} GHz ${execi 10 sensors | grep "Core 0" | cut -c17-24} 
      ${cpu cpu1}% ${cpugraph cpu1 11,85}
${color yellow}CPU2:$color ${freq_g 2} GHz ${execi 10 sensors | grep "Core 0" | cut -c17-24}
      ${cpu cpu2}% ${cpugraph cpu2 11,85}
${color yellow}CPU3:$color ${freq_g 3} GHz ${execi 10 sensors | grep "Core 1" | cut -c17-24}
      ${cpu cpu3}% ${cpugraph cpu3 11,85}
${color yellow}CPU4:$color ${freq_g 4} GHz ${execi 10 sensors | grep "Core 1" | cut -c17-24}
      ${cpu cpu4}% ${cpugraph cpu4 11,85}
${color yellow}CPU5:$color ${freq_g 5} GHz ${execi 10 sensors | grep "Core 2" | cut -c17-24}
      ${cpu cpu5}% ${cpugraph cpu5 11,85}
${color yellow}CPU6:$color ${freq_g 6} GHz ${execi 10 sensors | grep "Core 2" | cut -c17-24}
      ${cpu cpu6}% ${cpugraph cpu6 11,85}
${color yellow}CPU7:$color ${freq_g 7} GHz ${execi 10 sensors | grep "Core 3" | cut -c17-24}
      ${cpu cpu7}% ${cpugraph cpu7 11,85}
${color yellow}CPU8:$color ${freq_g 8} GHz ${execi 10 sensors | grep "Core 3" | cut -c17-24}
      ${cpu cpu8}% ${cpugraph cpu8 11,85}
${color yellow}RAM :$color $mem  $memmax   
      $memperc% ${membar 4,85}
${color yellow}Swap:$color $swap/$swapmax
      $swapperc% ${swapbar 4,85}
${color yellow}CPU :$color $cpu% ${cpubar 4}
${color yellow}Processes:$color $processes 
${color yellow}Running  :$color $running_processes 
${color yellow}Theads   :$color $threads
$hr
${color yellow}Networking
${if_up wlp3s0}wlp3s0  $color${addrs wlp3s0}
${color yellow}Up:$color ${upspeed wlp3s0} ${upspeedgraph wlp3s0 11,70}
        ${color yellow}Dn:$color ${downspeed wlp3s0} ${downspeedgraph wlp3s0 11,70}${endif}
${if_up enp0s25}${color yellow}enp0s25 $color${addrs enp0s25}
${color yellow}Up:$color ${upspeed enp0s25} ${upspeedgraph enp0s25 11,70}
${color yellow}Dn:$color ${downspeed enp0s25} ${downspeedgraph enp0s25 11,70}${endif}
${if_up tap0}${color yellow}tap0    $color${addrs tap0}
${color yellow}Up:$color ${upspeed tap0} ${upspeedgraph tap0 11,70} 
${color yellow}Dn:$color ${downspeed tap0} ${downspeedgraph tap0 11,70}${endif}
${if_up ppp0}${color yellow}ppp0    Up:$color ${upspeed ppp0} ${upspeedgraph ppp0 11,23} 
        ${color yellow}Dn:$color ${downspeed ppp0} ${downspeedgraph ppp0 11,23}${endif}
${if_up ppp1}${color yellow}ppp1    Up:$color ${upspeed ppp1} ${upspeedgraph ppp1 11,23} 
        ${color yellow}Dn:$color ${downspeed ppp1} ${downspeedgraph ppp1 11,23}${endif}
${if_up wlp3s0}$hr${color yellow}Wireless Information:
${color yellow}AP     : $color${wireless_essid wlp3s0}
${color yellow}Bitrate: $color${wireless_bitrate wlp3s0}
${color yellow}Link   : $color${wireless_link_qual_perc wlp3s0}%
${endif}
$hr
${color yellow}Temperatures
${color yellow}HDD:${color} +${hddtemp /dev/sda} °C 
${color yellow}ATI:${color} ${execi 5 sensors | grep -v "(crit = +10" | grep -m 2 'temp1'|cut -c15-22}
${color yellow}CPU:${color} ${execi 5 sensors | grep "Physical id 0:  "|cut -c17-24}
$hr
${color yellow}Power
${color yellow}AC Adapter: ${color}${acpiacadapter}
${color yellow}Battery   : ${color}${battery_percent}%
$hr
${color yellow}sda  wrt:$color ${diskio_write /dev/sda} ${diskiograph /dev/sda 12,35} ${color yellow} 
      rd:$color ${diskio_read /dev/sda} ${diskiograph_read /dev/sda 11,35}
#${color yellow}sdb  write:$color ${diskio_write /dev/sdb} ${diskiograph /dev/sdb 12,35} ${color yellow} read:$color ${diskio_read /dev/sdb} ${diskiograph_read /dev/sdb 11,35}

Ok, first off, it makes it easier to read if you put it in code tags.  I'm also assuming that you aren't running an 8 core system because you have core0 through core3 twice.  Did you get this from somewhere and are trying to adapt it to your computer?  All the spacing is really messed up for me.  I think the whitespace got messed up when you posted this without code tags.  Conky loves its whitespace and you have to be careful with it.  Sector11, want to have a go at this one?  I've never even used IP tunnelling so I can't help you with that bit.  The alignment is all off for me, can you post a screenshot of how it looks on your system.  I feel like I'm looking at a green hornet comic.  tongue

Offline

#6769 2013-11-27 05:17:12

jserink
New Member
Registered: 2013-11-27
Posts: 6

Re: Conky v1.9 Thread

Ok, first off, it makes it easier to read if you put it in code tags.
[JS] Not sure what that has to do with splitting the output of addrs, but ok.

I'm also assuming that you aren't running an 8 core system because you have core0 through core3 twice.
[JS] Not sure what that has to do with splitting the output of addrs, but ok. As you know, (well, maybe you don't) a virtual core has the same temperature as the physical core it comes from. Is that enough of an explanation? Its an i7.

Did you get this from somewhere and are trying to adapt it to your computer?
[JS] what's the difference? I wrote it from scratch based on the default profile after I emerged conky...but again, what the hell does that have to do with splitting the addrs output?

All the spacing is really messed up for me.
[JS] Its isn't for me. But again, what does this have to do with splitting the output of addrs?

I think the whitespace got messed up when you posted this without code tags.
[JS] that that helps us figure out the splitting of the output of addrs how?

Conky loves its whitespace and you have to be careful with it.
[JS] I don't remember asking about that, but ok.

Sector11, want to have a go at this one?  I've never even used IP tunnelling so I can't help you with that bit.
[JS] IP tunneling? What are you talking about? I asked how to split the output from the addrs object and you're all over the place about formatting, code tags, tunneling.... Who said anything about tunneling? I have an interface with more than one IP address and I want to split the output from the object addrs. You've written gobs of stuff that have NOTHING to do with what I asked.

The alignment is all off for me, can you post a screenshot of how it looks on your system.  I feel like I'm looking at a green hornet comic.
[JS] You feel like you're looking at a green hornet comic? WHO CARES? Not to seem cold or anything but I didn't get on to this forum to find out how you felt.

Once again, with feeling, this is my question:
I'm doing this:
${addrs enp0s25},
its spits out the answer like this:
192.168.111.199, 10.3.36.217

I would like to replace the comma and the space with a new line a few more spaces. Does anyone know how to do that?

Screen shot is attached.conky photo

John

Offline

#6770 2013-11-27 05:56:44

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

jserink wrote:

Ok, first off, it makes it easier to read if you put it in code tags.
[JS] Not sure what that has to do with splitting the output of addrs, but ok.

Because I can't see what your seeing because your formatting is messed up with the way you posted your code.

jserink wrote:

I'm also assuming that you aren't running an 8 core system because you have core0 through core3 twice.
[JS] Not sure what that has to do with splitting the output of addrs, but ok. As you know, (well, maybe you don't) a virtual core has the same temperature as the physical core it comes from. Is that enough of an explanation? Its an i7.

Don't be condescending, that won't get you help.  You're not going to get a different temp from a virtual core than a real core because the virtual thermistor hasn't been invented yet.  I code embedded for fun.

jserink wrote:

Did you get this from somewhere and are trying to adapt it to your computer?
[JS] what's the difference? I wrote it from scratch based on the default profile after I emerged conky...but again, what the hell does that have to do with splitting the addrs output?

If you wrote it, you should understand it.

jserink wrote:

All the spacing is really messed up for me.
[JS] Its isn't for me. But again, what does this have to do with splitting the output of addrs?

Because I'm not getting the two IP addresses you are.

jserink wrote:

I think the whitespace got messed up when you posted this without code tags.
[JS] that that helps us figure out the splitting of the output of addrs how?

Because I'm not seeing what your seeing.  See my first comment and below for a screenshot

jserink wrote:

Conky loves its whitespace and you have to be careful with it.
[JS] I don't remember asking about that, but ok.

You really are going down a path to nowhere for help with this kind of stuff.  I was just trying to have a conversation to get friendly and help you with this.

jserink wrote:

Sector11, want to have a go at this one?  I've never even used IP tunnelling so I can't help you with that bit.
[JS] IP tunneling? What are you talking about? I asked how to split the output from the addrs object and you're all over the place about formatting, code tags, tunneling.... Who said anything about tunneling? I have an interface with more than one IP address and I want to split the output from the object addrs. You've written gobs of stuff that have NOTHING to do with what I asked.

tap0 == http://vtun.sourceforge.net/tun/faq.html, I thought you said you wrote this.

jserink wrote:

The alignment is all off for me, can you post a screenshot of how it looks on your system.  I feel like I'm looking at a green hornet comic.
[JS] You feel like you're looking at a green hornet comic? WHO CARES? Not to seem cold or anything but I didn't get on to this forum to find out how you felt.

You might get more help if you were less of a jerk.  Perhaps my sense of humor displeases you.

jserink wrote:

Once again, with feeling, this is my question:
I'm doing this:
${addrs enp0s25},
its spits out the answer like this:
192.168.111.199, 10.3.36.217

I would like to replace the comma and the space with a new line a few more spaces. Does anyone know how to do that?

Screen shot is attached.http://i41.tinypic.com/r0cui0.jpg

John

And just for your FYI, this is how it looks on my system.  I'll let others help you with this one, I don't like you.  You seem to think the world owes you something for some odd reason.
qnsi.png

Offline

#6771 2013-11-27 08:48:17

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

liquidbyte wrote:

I'll let others help you with this one, I don't like you.  You seem to think the world owes you something for some odd reason.

seconding...
Anyways, as far as i know, you won`t be able to work at a conky object (like $addrs) directly.
go ahead, grep the information elswhere and do what you want with it in an externel script which you can call inside conky afterwards.


*kaum macht man es richtig, funktioniert es sofort*

Offline

#6772 2013-11-27 09:16:41

jserink
New Member
Registered: 2013-11-27
Posts: 6

Re: Conky v1.9 Thread

And just for your FYI, this is how it looks on my system.  I'll let others help you with this one, I don't like you.  You seem to think the world owes you something for some odd reason.
http://img30.imageshack.us/img30/9074/qnsi.png

The world doesn't owe me anything but coding style, the numbers of cores I have, white spaces, where i got the config is immaterial to my question.
You can't see the second interface for several reasons:
1. If you don't have 2 IPs assigned to your NIC, you won't see two IPS,
2. If your NIC is not named enp0s25, you won't see anything,
3. If you you have 2 IPs assigned to your NIC and you have edited the code so that it will show your NIC, whatever its name is, then you won't see the second NIC's IP because its cutoff by this, "maximum_width 162". If you want to see the second IP, you need to set that to 300 or so. I don't want to do that because then half the data is behind my Windows 7 VM. That is why I want to know how to insert the line feed and keep conky inside 162 pixels.

I know I could script something to parse the "ip addr show dev enp0s25" output but I'd rather keep things inside conky to try and minimize CPU load. In the end I may have to do that if there is no way to parse the output from ${addrs enp0s25}.

The tap0 interface is used for connecting my VM to virtual Ethernet switch which is masqueraded with iptables to my main interface.

Make sense?

John

Offline

#6773 2013-11-27 13:20:11

dk75
#! Junkie
Registered: 2012-06-14
Posts: 250

Re: Conky v1.9 Thread

Conky object are Conky objects and you can't format them as you please. You can change font style or start point of printing but that's it. Nothing else can be done inside Conky - that's why scripting for Conky and LUA come to life.
Bare Conky is...
I'm using inside Conky object for simple temperatures display only, rest in LUA or BASH.


Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop

Offline

#6774 2013-11-27 13:55:21

liquibyte
#! Member
From: N42°34'30.2664",W71°59'
Registered: 2013-11-04
Posts: 67
Website

Re: Conky v1.9 Thread

A small update to the clock script.  It now has hour ticks and second/minute ticks.  It's kind of hard to see in the image but I didn't want to post anything larger.  I'm working on the word clock part of it to make it more versatile and also split it off from the graphical clock.  You can easily rip out the desktop indicator instead of turning it off if you want.  I like knowing where I am in the scheme of things though.  As usual the picture is the link to the whole thing including the font I used for it.

vevn.png

require 'cairo'
words = {"one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine "}
levels = {"thousand ", "million ", "billion ", "trillion ", "quadrillion ", "quintillion ", "sextillion ", "septillion ", "octillion ", [0] = ""}
iwords = {"ten ", "twenty ", "thirty ", "forty ", "fifty ", "sixty ", "seventy ", "eighty ", "ninety "}
twords = {"eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen "}
local function digits(n)
  local i, ret = -1
  return function()
    i, ret = i + 1, n % 10
    if n > 0 then
      n = math.floor(n / 10)
      return i, ret
    end
  end
end
level = false
local function getname(pos, dig)
  level = level or pos % 3 == 0
  if(dig == 0) then return "" end
  local name = (pos % 3 == 1 and iwords[dig] or words[dig]) .. (pos % 3 == 2 and "hundred " or "")
  if(level) then name, level = name .. levels[math.floor(pos / 3)], false end
  return name
end
local function numberToWord(number)
    if(number == 0) then return "zero" end
    local vword = ""
    for i, v in digits(number) do
      vword = getname(i, v) .. vword
    end
    for i, v in ipairs(words) do
      vword = vword:gsub("ty " .. v, "ty-" .. v)
      vword = vword:gsub("ten " .. v, twords[i])
    end
    return vword
end
local function boringTime()
	hours = tonumber(os.date("%I"))
	mins = tonumber(os.date("%M"))
	--mins = mins + 0
	hours = hours % 12
	if(hours == 0) then 
		hours, nextHourWord = 12, "one "
	else
		nextHourWord = numberToWord(hours+1)
	end
	local hourWord = numberToWord(hours)
	if(mins == 0) then 
		return hourWord .. "o'clock "
	elseif(mins < 10) then
		return numberToWord(hours) .. "oh " .. numberToWord(mins)
	else
		return numberToWord(hours) .. numberToWord(mins)
	end
end
local function awesomeTime()
    if(hours == 0) then 
        hours, nextHourWord = 12, "one " 
    else
        nextHourWord = numberToWord(hours+1)
    end
    local hourWord = numberToWord(hours)
    if(mins == 0 ) then 
        return hourWord .. "o'clock"
    elseif(mins == 30) then
        return "half past " .. hourWord
    elseif(mins == 15) then
        return "a quarter past " .. hourWord 
    elseif(mins == 45) then
        return "a quarter to " .. nextHourWord 
    else
        if(mins < 30) then
            return numberToWord(mins) .. "past " .. hourWord
        else
            return numberToWord(60-mins) .. "to " .. nextHourWord
        end
    end
end
local function getHourWord()
    return numberToWord(hours)
end
local function getMinuteWord()
    return numberToWord(mins)
end
local function draw_wordTime(co, across, down, font, slant, weight, text, size, wr, wg, wb, wa)
	local bt = boringTime(tostring)
	local at = awesomeTime(tostring)
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, wr, wg, wb, wa)
	cairo_select_font_face (cr, font, slant, weight);
	if text == boringTime then
		cairo_show_text (cr, bt)
	elseif text == awesomeTime then
		cairo_show_text (cr, at)
	end
	cairo_stroke (cr)
end
local function draw_date(co, across, down, font, slant, weight, text, size, dr, dg, db, da)
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, dr, dg, db, da)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_show_text (cr, text)
	cairo_stroke (cr)
end
local function draw_suffix(co, across, down, font, slant, weight, text, suffix, size, sr, sg, sb, sa)
	if days == 1 or days == 21 or days == 31 then
		suffix = 'st'
	elseif days == 2 or days == 22 then
		suffix = 'nd'
	elseif days == 3 or days == 23 then
		suffix = 'rd'
	else
		suffix = 'th'
	end
	cairo_move_to (cr, across, down)
	cairo_set_font_size (cr, size)
	cairo_set_source_rgba (cr, sr, sg, sb, sa)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_show_text (cr, text)
	cairo_show_text (cr, suffix)
	cairo_stroke (cr)
end
local function draw_ring(co, across, down, circrad, rlw, rstart, rend, rr, rg, rb, ra)
	local degrads = math.pi/180
	local start	= rstart*degrads-math.pi/2
	local finish = rend*degrads-math.pi/2
	local xring	= 0+circrad*(math.sin(degrads*rstart))
	local yring	= 0-circrad*(math.cos(degrads*rstart))
	cairo_move_to (cr, across+xring, down+yring)
	cairo_arc (cr, across, down, circrad, start, finish)
	cairo_set_line_width (cr, rlw)
	cairo_set_source_rgba (cr, rr, rg, rb, ra)
	cairo_stroke (cr)
end
local function draw_hand(co, across, down, circrad, hlw, hx, hy, hr, hg, hb, ha)
	xhours = 0+circrad*math.sin(hours_arc)
	yhours = 0-circrad*math.cos(hours_arc)
	xmins = 0+circrad*math.sin(mins_arc)
	ymins = 0-circrad*math.cos(mins_arc)
	xsecs = 0+circrad*math.sin(secs_arc)
	ysecs = 0-circrad*math.cos(secs_arc)
	xdsecs = 0+circrad*math.sin(dsecs_arc)
	ydsecs = 0-circrad*math.cos(dsecs_arc)
	cairo_move_to (cr, across, down)
	cairo_line_to (cr, across+hx, down+hy)
	cairo_set_line_width (cr, hlw)
	cairo_set_source_rgba (cr, hr, hg, hb, ha)
	cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT)
	cairo_stroke (cr)
end
local function draw_ticks(co, across, down, circrad, rstart, rend, angle, tlw, tr, tg, tb, ta)
	local i = 0
	local ticks = rend / angle
	local degrads = math.pi/180
	local start	= rstart*degrads-math.pi/2
	local finish = rend*degrads-math.pi/2
	local xtick	= 0+circrad*(math.sin(degrads*rstart))
	local ytick	= 0-circrad*(math.cos(degrads*rstart))
	cairo_move_to (cr, across+xtick, down+ytick)
	while i < ticks do
		cairo_arc (cr, across, down, circrad, (((angle * i)-(tlw/4))*(2*math.pi/360))-(math.pi/2), (((angle * i)+(tlw/4))*(2*math.pi/360))-(math.pi/2))
		i = i + 1
--[[An odd side effect if you move the following line outside of the next end is
that the tick marks will turn into lines instead of dots]]
		cairo_set_line_width (cr, tlw)
		cairo_set_source_rgba (cr, tr, tg, tb, ta)
		cairo_stroke (cr)
	end
end
local function draw_desktop (co, across, down, font, slant, weight, desk, size, dskr, dskg, dskb, dska)
	local desk = tonumber(conky_parse("${desktop}"))
	for desk in tonumber do tonumber = desk end
	cairo_set_source_rgba (cr, dskr, dskg, dskb, dska)
	cairo_move_to (cr, across, down)
	cairo_select_font_face (cr, font, slant, weight);
	cairo_set_font_size (cr, size)
	cairo_show_text (cr, desk)
end
dsecs = os.date("%S") --Define deciseconds as seconds (HAS TO BE GLOBAL OUTSIDE FUNCTION, DON'T MOVE)
function round(num)
	local floor = math.floor(num)
	local ceiling = math.ceil(num)
	if (num - floor) >= 0.5 then
		return ceiling
	end
	return floor
end
function conky_draw_superclock()
	if conky_window == nil then return end
	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)
--------SET HORIZONTAL AND VERTICAL POSITION RELATIVE TO CONKY WINDOW-----------
	across = 200
	down = 200
--------SET THE CLOCK RADIUS----------------------------------------------------
	circrad = 60
--------TURN ON AND OFF THE PARTS OF THE DATE-----------------------------------
	show_weekday	= true
	show_month		= true
	show_days		= true
	show_year		= true
--------TURN ON AND OFF SMOOTH TICKS FOR THE SECONDS HAND-----------------------
	show_smooth		= true
--------TURN ON AND OFF THE SECOND HAND FOR THE CLOCK---------------------------
	show_seconds	= true
--------TURN ON AND OFF THE CLOCK HANDS-----------------------------------------
	show_hands		= true
--------TURN ON AND OFF AM OR PM------------------------------------------------
	show_ampm		= true
--------TURN ON AND OFF WORD TIME-----------------------------------------------
	show_wordtime	= true
--------TURN ON AND OFF THE PIPS------------------------------------------------
	show_pips		= true
--------TURN ON AND OFF THE SOLID RINGS-----------------------------------------
	show_rings		= true
--------TURN ON AND OFF THE MOVING RINGS----------------------------------------
	show_moving		= true
--------TURN ON AND OFF THE DESKTOP INDICATOR-----------------------------------
	show_desk		= true
--------TURN ON AND OFF THE CLOCKS HOURS TICK MARKS-----------------------------
	show_hticks		= true
--------TURN ON AND OFF THE CLOCKS SECONDS TICK MARKS---------------------------
	show_sticks		= true
--------DEFINE THE DATE AND TIME------------------------------------------------
	local update_interval = conky_set_update_interval(0.1)
	local secs = os.date("%S")
    local mins = os.date("%M")
    local hours = os.date("%l")
    local ampm = os.date("%p")
	local weekday = os.date("%A")
	local days = os.date("%e")
	local month = os.date("%B")
	local year = os.date("%Y")
--------MAKE DECISECONDS BEHAVE-------------------------------------------------
	if dsecs ~= secs then
		round(dsecs)
		dsecs = dsecs + 0.1
		if dsecs >= 60 then
			dsecs = 0
		elseif dsecs <= 0 then
			dsecs = 0
			dsecs = dsecs+60
		end
	end
	print(dsecs) --Turn this on if you want to debug dsecs in a terminal
--------DEFINE THE ARCS---------------------------------------------------------
	dsecs_arc = (2*math.pi/60)*dsecs
    secs_arc = (2*math.pi/60)*secs
    mins_arc = (2*math.pi/60)*mins+secs_arc/60
    hours_arc = (2*math.pi/12)*hours+mins_arc/12
    dsecsperc = ((dsecs/60)*100)*(360/100)
	secsperc = ((secs/60)*100)*(360/100)
	minsperc = ((mins/60)*100)*(360/100)+secs_arc
	hoursperc	= ((hours/12)*100)*(360/100)+mins_arc*4.75 --this seems to be a hack but it works
--------HOURS HAND--------------------------------------------------------------
	if show_hands then
		draw_hand(0, across, down, circrad+30+6, 6, xhours, yhours, 0.4, 0.4, 0.4, 0.5)
	end
--------HOURS RINGS-------------------------------------------------------------
	if show_rings then
		draw_ring(0, across, down, circrad+30, 8, 0, 360, 0.4, 0.4, 0.4, 0.5)
	end
	if show_moving then
		draw_ring(0, across, down, circrad+30, 8, hours_arc-(hoursperc/60), hoursperc, 0.4, 0.4, 0.4, 0.5)
	end
--------HOURS PIP---------------------------------------------------------------
	if show_pips then
		draw_ring(0, across, down, circrad+30, 8, hoursperc-1.1, hoursperc+1.1, 0.5, 0.5, 1.0, 1.0)
	end
--------MINUTES HAND------------------------------------------------------------
	if show_hands then
		draw_hand(0, across, down, circrad+40+6, 4, xmins, ymins, 0.5, 0.5, 0.5, 0.5)
	end
--------MINUTES RINGS-----------------------------------------------------------
	if show_rings then
		draw_ring(0, across, down, circrad+40, 8, 0, 360, 0.5, 0.5, 0.5, 0.5)
	end
	if show_moving then
		draw_ring(0, across, down, circrad+40, 8, mins_arc-(minsperc/60), minsperc, 0.5, 0.5, 0.5, 0.5)
	end
--------MINUTES PIP-------------------------------------------------------------
	if show_pips then
		draw_ring(0, across, down, circrad+40, 8, minsperc-0.7, minsperc+0.7, 0.5, 1.0, 0.5, 1.0)
	end
--------SECONDS HAND------------------------------------------------------------
	if show_seconds then
		if show_hands then
			if show_smooth then
				draw_hand(0, across, down, circrad+50-24, 2, xdsecs, ydsecs, 0.6, 0.6, 0.6, 0.5)
			end
			if not show_smooth then
				draw_hand(0, across, down, circrad+50-24, 2, xsecs, ysecs, 0.6, 0.6, 0.6, 0.5)
			end
		end
--------SECONDS RINGS-----------------------------------------------------------
		if show_rings then
			draw_ring(0, across, down, circrad+50, 8, 0, 360, 0.6, 0.6, 0.6, 0.5)
		end
		if show_moving then
			if show_smooth then
				draw_ring(0, across, down, circrad+50, 8, dsecs_arc-(dsecsperc/60), dsecsperc, 0.6, 0.6, 0.6, 0.5)
			end
			if not show_smooth then
				draw_ring(0, across, down, circrad+50, 8, secs_arc-(secsperc/60), secsperc, 0.6, 0.6, 0.6, 0.5)
			end
		end
--------SECONDS PIP-------------------------------------------------------------
		if show_pips then
			if show_smooth then
				draw_ring(0, across, down, circrad+50, 8, dsecsperc-0.3, dsecsperc+0.3, 1.0, 0.5, 0.5, 1.0)
			end
			if not show_smooth then
				draw_ring(0, across, down, circrad+50, 8, secsperc-0.3, secsperc+0.3, 1.0, 0.5, 0.5, 1.0)
			end
		end
	end
--------SECOND TICK MARKS-------------------------------------------------------
	if show_sticks then
		draw_ticks(0, across, down, circrad+70, 0, 360, 6, 1, 1.0, 1.0, 1.0, 1.0)
	end
--------HOUR TICK MARKS---------------------------------------------------------
	if show_hticks then
		draw_ticks(0, across, down, circrad+70, 0, 360, 30, 2, 1.0, 1.0, 1.0, 0.7)
	end
--------DESKTOP INDICATOR-------------------------------------------------------
	if show_desk then
		draw_desktop (0, across-10, down+10, "virgo01", 0, 0, desk, 32, 0.6, 0.6, 0.6, 1.0)
	end
--------DAY OF THE WEEK---------------------------------------------------------
	if show_weekday then
		draw_date(0, across-185, down-140, "virgo01", 0, 0, weekday, 34, 0.4, 0.4, 0.4, 0.8)
	end
--------MONTH-------------------------------------------------------------------
	if show_month then
		draw_date(0, across-185, down+215, "virgo01", 0, 0, month, 34, 0.5, 0.5, 0.5, 0.8)
	end
--------DAY---------------------------------------------------------------------
	if show_days then
		draw_suffix(0, across, down+255, "virgo01", 0, 0, days, suffix, 34, 0.5, 0.5, 0.5, 0.8)
	end
--------YEAR--------------------------------------------------------------------
	if show_year then
		draw_date(0, across-185, down+255, "virgo01", 0, 0, year, 34, 0.6, 0.6, 0.6, 0.8)
	end
--------WORD TIME---------------------------------------------------------------
	if show_wordtime then --valid values are boringTime and awesomeTime 
		draw_wordTime(0, across-185, down+155, "virgo01", 0, 0, boringTime, 20, 0.6, 0.6, 0.6, 0.8)
	end
--------AM / PM-----------------------------------------------------------------
	if show_ampm then
		draw_date(0, across-185, down+180, "virgo01", 0, 0, ampm, 20, 0.6, 0.6, 0.6, 0.8)
	end
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
end
Sector11 wrote:

Conky Anonymous

Step 1 - Admitted that we were powerless over conky - and love it!

How does all that affect your cpu and memory usage?  That's the one thing I'm always trying to be mindful of with my code.  I still feel like the clock uses more than it should but I've managed to keep it between 2-3% cpu and it generally stays at 0.7% in the ram area.

Last edited by liquibyte (2013-11-27 14:08:31)

Offline

Help fund CrunchBang, donate to the project!

#6775 2013-11-27 20:27:28

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

Re: Conky v1.9 Thread

liquibyte wrote:

Sector11, want to have a go at this one?

I would if I could but I can't so I won't ... I'm sitting here with just an old fashioned "eth0" and haven't a clue what that other stuff is.

Besides:

dk75 wrote:

Conky object are Conky objects and you can't format them as you please.

... bend fold and mutilate it in a script maybe but not a raw conky command output.

Agree with Naik.

EDIT:  ^ Really NICE clock!

Last edited by Sector11 (2013-11-27 20:29:01)


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

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