SEARCH

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

You are not logged in.

#3151 2012-09-30 18:12:43

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Conky v1.9 Thread

Ha! I have the bar graphs on! Will mutate them tonight and show the results! Cheers!

Edit: Does mean I have to restart tint2 after restart though, will have a go at sorting that...

Last edited by dura (2012-09-30 18:19:18)

Offline

Be excellent to each other!

#3152 2012-09-30 18:35:11

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

Sector11 wrote:

Cool, I like that!  Nice change lw!

Thanks big_smile Im not sure what else it needs but Im  not quite happy with it........ but am I ever? tongue

Offline

#3153 2012-09-30 18:41:20

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

EDIT - Murphy's law at work on this one... the very day I ask for assistance on something that has been bugging me for a year, an update came through today that now fixes IceWeasel to have the correct Windows Title (instead of firefox-bin)... Issue solved..

@mobilediesel and all the other script experts...

In this thread you helped out yuh_learn with wmctrl and current active IW windows.

I have a launch bash script I use for both Tint2 panels and Xfce panels that is similar

launch

#!/bin/bash
# This script acts as a launcher for apps that observes the following rules:
#   1. If the app is not running, then start it up
#   2. If the app is running, don't start a second instance, instead:
#     2a. If the app does not have focus, give it focus
#     2b. If the app has focus, minimize it
# Reference link: http://forum.xfce.org/viewtopic.php?id=6168&p=1

# there has to be at least one parameter, the name of the file to execute
if [ $# -lt 1 ]
then
  echo "Usage: `basename $0` {executable_name parameters}"
  exit 1
fi

BNAME=`basename $1`

# test to see if program is already running
if [ "`wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME`" ]; then 
    # means it must already be running
    ACTIV_WIN=$(xdotool getactivewindow getwindowpid)
    LAUNCH_WIN=$(ps -ef | grep "$BNAME" | grep -v grep | tr -s ' ' | cut -d' ' -f2 | head -n 1)

    if [ "$ACTIV_WIN" == "$LAUNCH_WIN" ]; then
        # launched app is currently in focus, so minimize
        xdotool getactivewindow windowminimize
    else
        # launched app is not in focus, so raise and bring to focus
        for win in `wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME | cut -d' ' -f1`
        do
            wmctrl -i -a $win
        done
    fi
    exit

else
    # start it up
    $*&
fi

exit 0

Specifically, all it does is launch whatever app is on the panel, checking to see if it is running first and runs it or if it is running it will either Iconify or De-Iconify it.

It works great for everything except Iceweasel which uses firefox-bin as the executable but is not the PID, which then makes the launch bash script run a new instance of IceWeasel every time it is clicked. 

I am trying to get it to work with iceweasel/firefox-bin the same it does for every other app.

---- Everything below here is your scripts from that thread for ease of use and reference

if [ -z "$(pgrep firefox-bin)" ]; then
    echo ""
else
    id=$(xlsclients -al|grep "Command:  firefox-bin" -A1 -B4|head -n1|cut -d ' ' -f 2|tr -d ':')
    id=${id:2:5}
    title=$(wmctrl -l|grep "$id"|awk -F 'steamroller' '{print $2}')
    title=${title%%' - Iceweasel'}
    
    echo "${title:1:100}"
fi

It only gets the first instance of IW, which seems to be the window that was opened first. This is better for me since I want the title to be printed on a single line.


if pid=$(pgrep -o firefox-bin); then
    title=$(wmctrl -lp | awk -F "$(uname -n) " '/'$pid'/ {sub(/ - Iceweasel/,"");print $2}')
    echo "  ~  ${title:0:90}"
else
    echo ""
fi

The -o after pgrep makes it only show the oldest PID that matches. -n would show the newest.
For the current active window title:

Name=$(uname -n)
Window=$(xprop _NET_ACTIVE_WINDOW -root)
Window=${Window/0x/0x0}
Current_Active_Title=$(wmctrl -l | awk -F "$Name " '/'${Window##* }'/ {print $2}')
echo "  ~ $Current_Active_Title"

VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#3154 2012-09-30 21:54:26

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Conky v1.9 Thread

Bodged the graphs back together.

tZnBjcA

Conky (less than respectful to original...):

# To use #! in a conky use: ${exec echo '#!'}
# ${font DS\-Digital:bold:size=24}
# OS: ${pre_exec lsb_release -d | cut -c 14-50}
# killall conky && conky -c ~/conky/test271.iso_bars.conky &

#conky performance settings
  use_xft yes
  xftalpha 0.1
  update_interval 1
  total_run_times 0
  cpu_avg_samples 4
  no_buffers no
  double_buffer yes
  override_utf8_locale yes

#overall position of conky window
  alignment bottom_right
  gap_x 10
  gap_y 30
  minimum_size 500 400
  maximum_width 400

#overall appearance of conky window
  own_window yes
  own_window_type desktop
  own_window_transparent yes
  own_window_hints undecorated,below,skip_taskbar,skip_pager
  draw_borders no

#default text apperance
  xftfont Liberation Mono:size=5
  draw_shades no
  draw_outline no
  default_shade_color white
  default_outline_color black
  uppercase no

#border around graphs
  draw_graph_borders yes

###  Color Settings  #########################################################
draw_shades no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

default_color DCDCDC #220 220 220    Gainsboro
color0 8FBC8F #143 188 143    DarkSeaGreen
color1 778899 #119 136 153    LightSlateGray
color2 FF8C00 #255 140   0    DarkOrange
color3 7FFF00 #127 255   0    Chartreuse
color4 FFA07A #255 160 122    LightSalmon
color5 FFDEAD #255 222 173    NavajoWhite
color6 00BFFF #  0 191 255    DeepSkyBlueconky -c ~/conky/test267.PetroDawg_2.conky &
color7 00FFFF #  0 255 255    Cyan
color8 FFFF00 #255 255   0    Yellow
color9 B22222 #178  34  34    FireBrick
#####################################################  End Color Settings

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

### When ARGB visuals are enabled, this use this to modify the alpha value
own_window_type desktop
own_window_transparent yes
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
own_window_argb_value 25

text_buffer_size 1024

###  LUA Settings  #############################################################
 lua_load /home/crunchbang/documents/Software,Scripts,Configs/isometric_bars.lua
 lua_draw_hook_pre draw_shape

lua_load /home/crunchbang/documents/Software,Scripts,Configs/draw-bg.lua
lua_draw_hook_post draw_bg 20 0 0 0 0 0x000000 0.3
#######################################################  End LUA Settings  ###


TEXT    
          
             #${fs_free_perc /}%${goto 125}${fs_free_perc /home}%${goto 195}${fs_free_perc /media/5}%























       #${fs_used_perc /}%${goto 125}${fs_used_perc /home}%${goto 195}${fs_used_perc /media/5}%${goto 265}${memperc}%














       #${cpu cpu0}%${goto 125}${cpu cpu1}%${goto 195}${cpu cpu2}%${goto 265}${cpu cpu3}%

Lua (again, not a touch on the original...):

--[[ the post: http://crunchbanglinux.org/forums/post/55927/#p55927
this one was easy (or i thought it was going to be)
http://omploader.org/tM2x0bg
Going to be a work in progress until i set up all the variables properly... and get my titles right smile
UPDATE- now you can change line thickness without messing it up.  Getting the lines right has made things alot less easy smile
also you can set font, font size and title position
    -- end the post
isometric bars by mrpeachy (2010)
bodged by d!
--]]

require 'cairo'
function bar3d(conkyobject, linethick, width, barheight, linered, linegreen, lineblue, linealpha, facered, facegreen, faceblue, facealpha, across, down, title, framelines, font, fontsize, txtacross, txtdown)
--line 1 settings end
local a_num1=tonumber(conkyobject) or 0
local a_num=(height/100)*a_num1

if framelines == 1 then
cairo_set_source_rgba (cr, linered, linegreen, lineblue, linealpha);
cairo_set_line_width (cr, linethick)
cairo_translate (cr, across, down)
cairo_move_to (cr, width*0.5, -width*0.5)
cairo_rel_line_to (cr, 0, -height)
cairo_stroke (cr)
cairo_translate (cr, -across, -down)
end
--line 1 indicator front face
cairo_translate (cr, across, down)
cairo_move_to (cr, 0, 0);
cairo_rectangle (cr, 0, 0, width, -a_num);
cairo_set_source_rgba (cr, facered, facegreen, faceblue, facealpha);
cairo_fill (cr)
cairo_translate (cr, -across, -down)
--line 1 indicator side face
cairo_translate (cr, across, down)
cairo_move_to (cr, 0, (linethick*0.1));
cairo_rel_line_to (cr, 0, -a_num)
cairo_rel_line_to (cr, -1*(width*0.5), -1*(width*0.5))
cairo_rel_line_to (cr, 0, a_num)
cairo_rel_line_to (cr, (width*0.5), (width*0.5))
cairo_close_path (cr)
cairo_set_source_rgba (cr, facered, facegreen, faceblue, facealpha);
cairo_fill (cr)
cairo_translate (cr, -across, -down)
--line 1 indicator top face
cairo_translate (cr, across, down)
cairo_move_to (cr, 0, -a_num);
cairo_rel_line_to (cr, width, 0)
cairo_rel_line_to (cr, -1*(width*0.5), -1*(width*0.5))
cairo_rel_line_to (cr, -width, 0)
cairo_rel_line_to (cr, (width*0.5), (width*0.5))
cairo_close_path (cr)
cairo_set_source_rgba (cr, facered, facegreen, faceblue, facealpha);
cairo_fill (cr)
cairo_translate (cr, -across, -down)

--line 1 indicator lines
cairo_set_line_width (cr, linethick);
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, linered, linegreen, lineblue, linealpha);
--vertical, middle
cairo_move_to (cr, 0, 1*(linethick*0.9));
cairo_rel_line_to (cr, 0, -a_num-(linethick*0.9))
cairo_stroke (cr)
--vertical right
cairo_move_to (cr, width, 1*(linethick*0.9));
cairo_rel_line_to (cr, 0, -a_num-(linethick*0.9))
cairo_stroke (cr)
--left line
cairo_move_to (cr, -1*(width*0.5), (-1*(width*0.5))+(linethick));
cairo_rel_line_to (cr, 0, -a_num)
cairo_stroke (cr)
--bottom line
cairo_move_to (cr, -1*(linethick*0.9), (linethick*0.9))
cairo_rel_line_to (cr, width+linethick, 0)
cairo_stroke (cr)
--top of indicator
cairo_move_to (cr, 0, -a_num+(linethick*0.9))
cairo_rel_line_to (cr, width, 0)
cairo_stroke (cr)
--bottom diagonal
cairo_move_to (cr, -1*(linethick*0.15), (linethick*0.65))
cairo_rel_line_to (cr, (-1*(width*0.5)), (-1*(width*0.5)))
cairo_stroke (cr)
--topline
cairo_move_to (cr, (-1*(width*0.5))-(linethick*0.9), ((-1*(width*0.5))-a_num)+(linethick*0.9))
cairo_rel_line_to (cr, width+linethick, 0)
cairo_stroke (cr)
--top left diagonal
cairo_move_to (cr, 0, -a_num+(linethick*0.9))
cairo_rel_line_to (cr, (-1*(width*0.5)), (-1*(width*0.5)))
cairo_stroke (cr)
--top right diagonal
cairo_move_to (cr, width+(linethick*0.15), -a_num+(linethick*0.35))
cairo_rel_line_to (cr, (-1*(width*0.5)), (-1*(width*0.5)))
cairo_stroke (cr)
cairo_translate (cr, -across, -down)
--title
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fontsize);
cairo_set_source_rgba (cr, linered, linegreen, lineblue, linealpha);
cairo_translate (cr, txtacross, txtdown)
cairo_move_to (cr, 0, 0)
cairo_show_text (cr, title)
cairo_translate (cr, -txtacross, -txtdown)

if framelines == 1 then
--frame lines
cairo_set_line_width (cr, linethick);
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, linered, linegreen, lineblue, linealpha);
--vertical, middle
cairo_move_to (cr, 0, 1*(linethick*0.9));
cairo_rel_line_to (cr, 0, -height-(linethick*0.9))
cairo_stroke (cr)
--vertical right
cairo_move_to (cr, width, 1*(linethick*0.9));
cairo_rel_line_to (cr, 0, -height-(linethick*0.9))
cairo_stroke (cr)
--left line
cairo_move_to (cr, -1*(width*0.5), (-1*(width*0.5))+(linethick));
cairo_rel_line_to (cr, 0, -height)
cairo_stroke (cr)
--bottom line
cairo_move_to (cr, -1*(linethick*0.9), (linethick*0.9))
cairo_rel_line_to (cr, width+linethick, 0)
cairo_stroke (cr)
--top of indicator
cairo_move_to (cr, 0, -height+(linethick*0.9))
cairo_rel_line_to (cr, width, 0)
cairo_stroke (cr)
--bottom diagonal
cairo_move_to (cr, -1*(linethick*0.15), (linethick*0.65))
cairo_rel_line_to (cr, (-1*(width*0.5)), (-1*(width*0.5)))
cairo_stroke (cr)
--topline
cairo_move_to (cr, (-1*(width*0.5))-(linethick*0.9), ((-1*(width*0.5))-height)+(linethick*0.9))
cairo_rel_line_to (cr, width+linethick, 0)
cairo_stroke (cr)
--top left diagonal
cairo_move_to (cr, 0, -height+(linethick*0.9))
cairo_rel_line_to (cr, (-1*(width*0.5)), (-1*(width*0.5)))
cairo_stroke (cr)
--top right diagopnal
cairo_move_to (cr, width+(linethick*0.15), -height+(linethick*0.35))
cairo_rel_line_to (cr, (-1*(width*0.5)), (-1*(width*0.5)))
cairo_stroke (cr)
cairo_translate (cr, -across, -down)
end
end

function conky_draw_shape ()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)

-- ROOT
--conkyobject=conky_parse('${fs_used_perc /}')
linethick=0.25  --1.5
width=10
height=40
linered=1
linegreen=1
lineblue=1
linealpha=0.5
facered=0
facegreen=0
faceblue=1
facealpha=0.1
across=310
down=400
title="root"
font="Liberation Mono"
fontsize=7
txtacross=307
txtdown=410
--1 for framelines, 0 for none
framelines=1
bar3d(conkyobject, linethick, width, height, linered, linegreen, lineblue, linealpha, facered, facegreen, faceblue, facealpha, across, down, title, framelines, font, fontsize, txtacross, txtdown)

-- HOME
conkyobject=conky_parse('${fs_used_perc /home}')
linethick=0.25  --1.5
width=10
height=40
linered=1
linegreen=1
lineblue=1
linealpha=0.5
facered=0
facegreen=0
faceblue=1
facealpha=0.1
across=340
down=400
title="h"
font="Liberation Mono"
fontsize=7
txtacross=345
txtdown=410
--1 for framelines, 0 for none
framelines=1
bar3d(conkyobject, linethick, width, height, linered, linegreen, lineblue, linealpha, facered, facegreen, faceblue, facealpha, across, down, title, framelines, font, fontsize, txtacross, txtdown)

-- MEMORY
conkyobject=conky_parse('${memperc}')
linethick=0.25 --1.5
width=10
height=40
linered=1
linegreen=1
lineblue=1
linealpha=0.5
facered=0
facegreen=0
faceblue=1
facealpha=0.1
across=400
down=400
title="ram"
font="Liberation Mono"
fontsize=7
txtacross=395
txtdown=410
--1 for framelines, 0 for none
framelines=1
bar3d(conkyobject, linethick, width, height, linered, linegreen, lineblue, linealpha, facered, facegreen, faceblue, facealpha, across, down, title, framelines, font, fontsize, txtacross, txtdown)


-- CPU O (Average of all)
conkyobject=conky_parse('${cpu cpu0}')
linethick=0.25  --1.5
width=10   --ancho de barra
height=40 --altura de barra
linered=1
linegreen=1
lineblue=1
linealpha=0.5
facered=0
facegreen=0
faceblue=1
facealpha=0.1
across=370  -- barra
down=400    -- barra
title="cpu"
font="Liberation Mono"
fontsize=7
txtacross=370 -- texto
txtdown=410   -- texto
--1 for framelines, 0 for none
framelines=1
bar3d(conkyobject, linethick, width, height, linered, linegreen, lineblue, linealpha, facered, facegreen, faceblue, facealpha, across, down, title, framelines, font, fontsize, txtacross, txtdown)


end
end

Simple, minimal (boring?)

Edit: Anyone know how to make it not interfere with tint2 at start up? I have to restart tint2. I fiddled with autostart (added a few more seconds; some before tint; swapped tint2 and conky over) to no effect. Will try window type: override right now!

Last edited by dura (2012-09-30 22:10:14)

Offline

#3155 2012-10-02 03:40:18

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

Re: Conky v1.9 Thread

A while back cecilpierce (Ubuntu Forums) mentioned he was using Manjaro Linux that come with "conky-control" that originates with Voyager Linux, a French Xubuntu based Linux.  Interestingly enough I grabbed the files from a link at ARCH and my first impression was I'd deep six it. But I didn't, I've been playing and tweaking things for my system - 21 different conkys. Some are really interesting.  stinkeye helped cecilpierce get one going.  I was busy with other things, and the last couple of days life stepped in really heavy, but tonight I got to play with: HUD #6 on the list.

This is HUD - my way, for OpenBox and on Xfce4
acqFFXC9.jpg adivYaeV.jpg

Modified for an AMD Athlon II X3 - yellow is the Average (CPU 0). Pretty cool if I do say so myself.

#  version : v2011011601
#  license : Distributed under the terms of GNU GPL version 2 or later
#  Edited for Debian SID - OpenBox and XFCE4 - by Sector11 - 1 October 2012
#==============================================================================

background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

double_buffer yes
no_buffers yes
text_buffer_size 256
gap_x 0
gap_y 40
minimum_size 250 0
maximum_width 250
own_window yes
own_window_type override
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
own_window_argb_visual yes
border_inner_margin 0
border_outer_margin 0
alignment bm

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont Anonymous Pro:size=8
xftalpha 0.5
uppercase no

default_color FFFFFF
color1 00FFBB

lua_load ~/.conky/conky6/conky_HUD.lua
lua_draw_hook_post main

lua_load ~/Conky/LUA/draw-bg.lua
lua_draw_hook_pre draw_bg 8 0 0 0 0 0x000000 0.5

TEXT

  ${font digitalk:bold:size=12}${color1}${time %H:%M}${goto 200}${time %d:%m}${color}${font}
   HH:MM${goto 205}DD:MM

${goto 100}${font Anonymous Pro:bold:size=8}DISKS
${goto 110}${font Anonymous Pro:bold:size=7}${color1}size /${font}
${goto 30}${font Anonymous Pro:bold:size=8}${color}MEM${goto 105}${font Anonymous Pro:size=9}${color1} ${voffset -4}${fs_size /}
${goto 105}${font Anonymous Pro:bold:size=7}${color1}size /home${font}
${goto 170}${font Anonymous Pro:bold:size=8}${color}CPU${goto 105}${font Anonymous Pro:size=9}${color1} ${voffset -4}${fs_size /home}

needs three empty lines at the end.

conky_HUD.lua

--==============================================================================
--                              conky_HUD.lua
--
--  author   : SLK
--  version  : v2011062101
--  license  : Distributed under the terms of GNU GPL version 2 or later
--  modified : Sector11 2012·10·01
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu0',                  max_value=100,
    x=180,                         y=120,
    graph_radius=60,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0xFFFF00,      graph_bg_alpha=0.3,
    graph_fg_colour=0xFFFF00,      graph_fg_alpha=0.0,
    hand_fg_colour=0xFFFF00,       hand_fg_alpha=1.0,
    txt_radius=60,                -- yellow
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0xFFFF00,        txt_fg_alpha=0.8,
    graduation_radius=30,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0xFFFF00, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu1',                  max_value=100,
    x=180,                         y=120,
    graph_radius=50,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=50,                -- green
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=55,
    graduation_thickness=5,        graduation_mark_thickness=2,
    graduation_unit_angle=27,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu2',                  max_value=100,
    x=180,                         y=120,
    graph_radius=40,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=40,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=30,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu3',                  max_value=100,
    x=180,                         y=120,
    graph_radius=30,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=30,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=35,
    graduation_thickness=5,        graduation_mark_thickness=2,
    graduation_unit_angle=27,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='memperc',                arg='',                      max_value=100,
    x=40,                          y=85,
    graph_radius=34,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2,            graph_unit_thickness=2,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=20,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=24,
    graduation_thickness=6,        graduation_mark_thickness=2,
    graduation_unit_angle=10,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=10.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.5,
},
{
    name='fs_used_perc',           arg='/',                     max_value=100,
    x=120,                         y=70,
    graph_radius=40,
    graph_thickness=4,
    graph_start_angle=210,
    graph_unit_angle=2,            graph_unit_thickness=2,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=32,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=46,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=20,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.5,
},
{
    name='fs_used_perc',           arg='/home/',                max_value=100,
    x=120,                         y=70,
    graph_radius=50,
    graph_thickness=8,
    graph_start_angle=210,
    graph_unit_angle=2,            graph_unit_thickness=2,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=60,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=58,
    graduation_thickness=4,        graduation_mark_thickness=2,
    graduation_unit_angle=20,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.5,
},
}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end

    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    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)
    local display = cairo_create(cs)

    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)

    if update_num > 5 then
        go_gauge_rings(display)
    end

    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

Last edited by Sector11 (2012-10-02 03:44:40)


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

Offline

#3156 2012-10-02 03:48:13

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

Nice... Glad to see you getting to play again.. wink

I redid my Tint2 for a new look

screenshot-10012012-095551pm.php


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#3157 2012-10-02 04:59:19

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

VastOne wrote:

Nice... Glad to see you getting to play again.. wink

I redid my Tint2 for a new look

screenshot-10012012-095551pm.php


Love it!
Im shooting for one that looks that good some day big_smile

Offline

#3158 2012-10-02 05:01:01

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

Sector11 wrote:

A while back cecilpierce (Ubuntu Forums) mentioned he was using Manjaro Linux that come with "conky-control" that originates with Voyager Linux, a French Xubuntu based Linux.  Interestingly enough I grabbed the files from a link at ARCH and my first impression was I'd deep six it. But I didn't, I've been playing and tweaking things for my system - 21 different conkys. Some are really interesting.  stinkeye helped cecilpierce get one going.  I was busy with other things, and the last couple of days life stepped in really heavy, but tonight I got to play with: HUD #6 on the list.

This is HUD - my way, for OpenBox and on Xfce4
acqFFXC9.jpg adivYaeV.jpg

Modified for an AMD Athlon II X3 - yellow is the Average (CPU 0). Pretty cool if I do say so myself.

#  version : v2011011601
#  license : Distributed under the terms of GNU GPL version 2 or later
#  Edited for Debian SID - OpenBox and XFCE4 - by Sector11 - 1 October 2012
#==============================================================================

background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

double_buffer yes
no_buffers yes
text_buffer_size 256
gap_x 0
gap_y 40
minimum_size 250 0
maximum_width 250
own_window yes
own_window_type override
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
own_window_argb_visual yes
border_inner_margin 0
border_outer_margin 0
alignment bm

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont Anonymous Pro:size=8
xftalpha 0.5
uppercase no

default_color FFFFFF
color1 00FFBB

lua_load ~/.conky/conky6/conky_HUD.lua
lua_draw_hook_post main

lua_load ~/Conky/LUA/draw-bg.lua
lua_draw_hook_pre draw_bg 8 0 0 0 0 0x000000 0.5

TEXT

  ${font digitalk:bold:size=12}${color1}${time %H:%M}${goto 200}${time %d:%m}${color}${font}
   HH:MM${goto 205}DD:MM

${goto 100}${font Anonymous Pro:bold:size=8}DISKS
${goto 110}${font Anonymous Pro:bold:size=7}${color1}size /${font}
${goto 30}${font Anonymous Pro:bold:size=8}${color}MEM${goto 105}${font Anonymous Pro:size=9}${color1} ${voffset -4}${fs_size /}
${goto 105}${font Anonymous Pro:bold:size=7}${color1}size /home${font}
${goto 170}${font Anonymous Pro:bold:size=8}${color}CPU${goto 105}${font Anonymous Pro:size=9}${color1} ${voffset -4}${fs_size /home}

needs three empty lines at the end.

conky_HUD.lua

--==============================================================================
--                              conky_HUD.lua
--
--  author   : SLK
--  version  : v2011062101
--  license  : Distributed under the terms of GNU GPL version 2 or later
--  modified : Sector11 2012·10·01
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu0',                  max_value=100,
    x=180,                         y=120,
    graph_radius=60,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0xFFFF00,      graph_bg_alpha=0.3,
    graph_fg_colour=0xFFFF00,      graph_fg_alpha=0.0,
    hand_fg_colour=0xFFFF00,       hand_fg_alpha=1.0,
    txt_radius=60,                -- yellow
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0xFFFF00,        txt_fg_alpha=0.8,
    graduation_radius=30,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0xFFFF00, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu1',                  max_value=100,
    x=180,                         y=120,
    graph_radius=50,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=50,                -- green
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=55,
    graduation_thickness=5,        graduation_mark_thickness=2,
    graduation_unit_angle=27,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu2',                  max_value=100,
    x=180,                         y=120,
    graph_radius=40,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=40,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=30,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu3',                  max_value=100,
    x=180,                         y=120,
    graph_radius=30,
    graph_thickness=5,
    graph_start_angle=0,
    graph_unit_angle=0.9,          graph_unit_thickness=0.9,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=30,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=35,
    graduation_thickness=5,        graduation_mark_thickness=2,
    graduation_unit_angle=27,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='memperc',                arg='',                      max_value=100,
    x=40,                          y=85,
    graph_radius=34,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2,            graph_unit_thickness=2,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=20,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=24,
    graduation_thickness=6,        graduation_mark_thickness=2,
    graduation_unit_angle=10,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=10.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.5,
},
{
    name='fs_used_perc',           arg='/',                     max_value=100,
    x=120,                         y=70,
    graph_radius=40,
    graph_thickness=4,
    graph_start_angle=210,
    graph_unit_angle=2,            graph_unit_thickness=2,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=32,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=46,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=20,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.5,
},
{
    name='fs_used_perc',           arg='/home/',                max_value=100,
    x=120,                         y=70,
    graph_radius=50,
    graph_thickness=8,
    graph_start_angle=210,
    graph_unit_angle=2,            graph_unit_thickness=2,
    graph_bg_colour=0x00FFBB,      graph_bg_alpha=0.3,
    graph_fg_colour=0x00FFBB,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00FFBB,       hand_fg_alpha=1.0,
    txt_radius=60,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x00FFBB,        txt_fg_alpha=0.8,
    graduation_radius=58,
    graduation_thickness=4,        graduation_mark_thickness=2,
    graduation_unit_angle=20,
    graduation_fg_colour=0x00FFBB, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.5,
},
}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end

    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    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)
    local display = cairo_create(cs)

    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)

    if update_num > 5 then
        go_gauge_rings(display)
    end

    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

Great job buddy! Lovin it!

Offline

#3159 2012-10-02 11:02:49

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

Re: Conky v1.9 Thread

i want to display seti@home in my conky. is there a way to include this?

Offline

#3160 2012-10-02 12:47:20

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

Re: Conky v1.9 Thread

VastOne wrote:

Nice... Glad to see you getting to play again.. wink

I redid my Tint2 for a new look

Thanks ... I've missed it

Tint2 the VastOne way in XFCE4 is some sexy ... well, maybe that's not the right word but you get my drift.  big_smile


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

Offline

#3161 2012-10-02 12:56:15

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

Re: Conky v1.9 Thread

lwfitz wrote:

Great job buddy! Lovin it!

It was a struggle for me.  I had to make the minimum_size and maximum_width bigger to see what was happening, there was some LUA code for CPU1 that was set to run below the actual window so I had top move that up into place and then shuffle things around to get the extra 2 CPU values in there.

I should have done a screen capture when I had 4 different colours for the CPU's in order to know which one I was working on  big_smile


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

Offline

#3162 2012-10-02 12:57:15

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

Re: Conky v1.9 Thread

lionhead wrote:

i want to display seti@home in my conky. is there a way to include this?

What is: seti@home?


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

Offline

#3163 2012-10-02 13:05:26

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Conky v1.9 Thread

^ Knew somebody was going to ask this. wink
http://en.wikipedia.org/wiki/Seti@home

Offline

#3164 2012-10-02 13:13:25

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

lionhead wrote:

i want to display seti@home in my conky. is there a way to include this?

Here is a conky with SETI@home already working.

http://gnome-look.org/content/show.php?content=127069

Another source

http://www.64bitjungle.com/tech/boinc-a … on-ubuntu/

And one more

http://technology.feedfury.com/content/ … buntu.html

Last edited by VastOne (2012-10-02 13:15:51)


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#3165 2012-10-02 13:17:38

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

@sector11 and @lwfitz

Thanks... Appreciated.. cool


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#3166 2012-10-02 16:02:21

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

Re: Conky v1.9 Thread

is it possible to display rss-feed (not xml-files). i want to display the rss-feed (image of the day): http://www.nasa.gov/rss/image_of_the_day.rss

i already work with xml-files but i do not know how to display this sad could u please help me with this?


EDIT: i've found a simple way: http://how-to.wikia.com/wiki/How_to_add … nky-rss.sh
but i still need to format the output within conky.

Last edited by lionhead (2012-10-04 16:48:08)

Offline

#3167 2012-10-06 19:00:41

dlharp2
Member
Registered: 2009-05-17
Posts: 14

Re: Conky v1.9 Thread

hi, is it possible to integrate irc in conky?

Offline

#3168 2012-10-06 19:03:59

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

^ You could do it by enabling logging in the IRC client and then just use a cat statement like:

${exec cat /path/to/irc.log | tail -n 5}

VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#3169 2012-10-06 19:30:59

dlharp2
Member
Registered: 2009-05-17
Posts: 14

Re: Conky v1.9 Thread

cool, thanks!

Offline

#3170 2012-10-07 22:24:07

dlharp2
Member
Registered: 2009-05-17
Posts: 14

Re: Conky v1.9 Thread

hello,

I'm having trouble using a bash script in conky:

URI=http://www.wkms.org/rss.xml
LINES=6 #Number of headlines


EXEC="/usr/bin/curl -s"


$EXEC $URI | grep title |\
sed -e :a -e 's/<[^>]*>//g;/</N' |\
sed -e 's/[ \t]*//' |\
sed -e 's/\(.*\)/ \1/' |\
sed -e 's/\.//' |\
sed -e 's/\"//' |\
sed -e 's/\"//' |\
head -n $(($LINES + 2)) |\
tail -n $(($LINES))

I keep getting the error:

/conky-rss.sh: 1: Syntax error: newline unexpected

i'm pretty frustrated.  lol

EDIT:  I got it working!

Last edited by dlharp2 (2012-10-07 22:48:08)

Offline

#3171 2012-10-08 06:30:32

Vicophine
#! Member
From: Detroit, MI
Registered: 2009-11-02
Posts: 98
Website

Re: Conky v1.9 Thread

##############################################
#  Settings
##############################################
background yes
use_xft yes
xftfont silkscreen:size=5.7
xftalpha 1
text_buffer_size 50000
update_interval 0.50
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type dock
own_window_colour 262729
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades yes
draw_outline no
draw_borders yes
draw_graph_borders no
default_color 789922
default_shade_color black
default_outline_color white
gap_x 4
gap_y 4
no_buffers yes
uppercase no
cpu_avg_samples 10
override_utf8_locale no
temperature_unit celsius
#alignment top_center
alignment bl ## top_center
minimum_size 1366 1
short_units yes
pad_percents 2
top_name_width 2
##############################################
#  Output #
##############################################
TEXT
${alignc} ${color f92672}Debian Wheezy ${color} | ${color beed5f}Machine:${color d3d3d3} $nodename | ${color fd971f} Uptime:${color d3d3d3} $uptime ${color}| ${color ff669d}Kernel: ${color d3d3d3} $kernel | ${color 9e6ffe}Cpu: ${color e3e3e3}${cpu cpu0}% | ${color 00CBEE}Ram: ${color d3d3d3}${mem}/${memmax} | ${color}System: ${color e0e0e0}${font}${fs_used /} | ${color}Home: ${color e1e1e1}${font}${fs_used /home}/${fs_size /home} | ${color G767676} Title: ${color e0e0e0} ${mpd_title} | ${color D45951}Artist: ${color e0e0e0}${mpd_artist} | ${color F21212}Album: ${color e0e0e0}${mpd_album} | ${color 900319} Length: ${color e0e0e0}${mpd_elapsed}/${mpd_length}

Moderately simple conky config, only variables are the font (free font "silkscreen" required) and the resolution should be manually set depending on your own.

smile

tZnNwaw


Thinkpad x120e 8GB DDR3, 1.6Ghz X2 - Laptop/Netbook
AMD Athlon X2 OC'ed to 3.33GHz, 4GB DDR2 2TBx2 - Desktop/Seedbox

Offline

#3172 2012-10-08 12:14:35

Deegan
Member
From: Italy Varese
Registered: 2011-11-19
Posts: 36

Re: Conky v1.9 Thread

Hi boys, need one help of yours!! wink

If I use this .conkyrc::**

######################
# - Conky settings - #
######################
#!/usr/bin/conky -d -c

update_interval 1.0
total_run_times 0
cpu_avg_samples 2
net_avg_samples 2
imlib_cache_size 0
double_buffer yes
no_buffers yes
  format_human_readable

#####################
# - Text settings - #
#####################
use_xft yes
xftfont ZeKton:size=8
override_utf8_locale yes
text_buffer_size 1920

#############################
# - Window specifications - #
#############################
own_window yes
own_window_type normal ##glass ##desktop  ##override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

minimum_size 180 
maximum_width 180
alignment top_right
gap_x 20
gap_y 60

#########################
# - Graphics settings - #
#########################
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
use_spacer none
xftalpha 0.8
uppercase no
background no
#border_inner_margin 1
#border_outer_margin 0
default_color ffffff

##  Controlla il consumo (in % di cpu) di tutti i processi conky
# watch -n 0,5 ps -C conky -o cmd,pcpu



####################
#  -  Stringhe  -  #
####################
# 
## ${lua conky_draw_bg 20 0 0 190 640 0x000000 0.3}



#  conky -c .conkyMeteo  

TEXT
${color A9A9A9}${font ZeKton:size=11:style=bold}${alignc}Besozzo 
${alignc}${execi 3600 conkyForecast -d HT -u -x}°C
${font Cure:size=8}${alignc}${execi 1800 conkyForecast --datatype=CT}
#########################${execpi 1800 conkyForecast --location=ITXX0082 --template=/home/deegan/.scripts/varese.template}
${voffset 0}





${font Cure:size=8}

${goto 60}$stippled_hr${font ZeKton:size=8:style=bold} 
${alignc}${time %d %B. %Y}
${alignc}${time %A}
${font ZeKton:size=16:style=bold}${alignc}${time %H:%M}${voffset 15}${goto 60}$stippled_hr
${color A9A9A9}
${voffset -40}
${font Cure:size=8}${alignc}$processes processes ($running_processes running)

${font ZeKton:size=8:style=bold}${alignc}${kernel}  

${voffset -7}${font ZeKton:size=7:style=bold}${goto 60}$stippled_hr

${goto 35}CPT. ${hwmon temp 1}°C ${goto 95}|${goto 118}HDT. ${hddtemp /dev/sda}°


${font ZeKton:size=7:style=bold}${alignc}(ATI HD 5750 Vapor-X) 
${alignc} (${execi 60 aticonfig --od-gettemperature | grep Temperature | cut -c43-44 | sed '/^$/d'}°C)
${goto 60}$stippled_hr ${color A9A9A9}


${font ZeKton:size=7:style=bold}${alignc}Email


#########################${font ZeKton:size=7:style=bold}${alignc}Hai ${execpi 1800 python ~/.scripts/gmail.py} email
${font OpenLogos:size=76}v${font}${voffset 6}${goto 134}${font ZeKton:size=11:style=bold}${voffset -58}12.04${font}

${font Nu:size=8}${alignr 19}By Deegan Style**

The conky works very well.

If I add this lace instead::**

${execpi 1800 conkyForecast --location=ITXX0082 --template=/home/deegan/.scripts/varese.template}

And this::*

${font ZeKton:size=7:style=bold}${alignc}Hai ${execpi 1800 python ~/.scripts/gmail.py} email

The terminal gives me this error::*

conky -c .conkyMeteo
Conky: desktop window (2c00039) is subwindow of root window (b8)
Conky: window type - normal
Conky: drawing to created window (0x3400001)
Conky: drawing to double buffer
Errore di segmentazione (core dump creato)

..... sad

Do you know how to tell me how come?
PS::*  conky version 1.8.1-6

Thanks.....;)

Offline

#3173 2012-10-08 14:05:55

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

Re: Conky v1.9 Thread

dlharp2 wrote:

I keep getting the error:

/conky-rss.sh: 1: Syntax error: newline unexpected

i'm pretty frustrated.  lol

EDIT:  I got it working!

no no no no no no no no ... did I say no?

That doesn't work - How did you get it working would be wonderful!  big_smile


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

Offline

#3174 2012-10-08 14:09:44

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

Re: Conky v1.9 Thread

Vicophine wrote:

Moderately simple conky config, only variables are the font (free font "silkscreen" required) and the resolution should be manually set depending on your own.

smile

tZnNwaw

I popped in to tell you that a scrot would be nice and saw the code for an image.

tZnNwaw <<-- I though it was a line.

lol lol --> OK chuckle done!! Nice oneliner.


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

Offline

Help fund CrunchBang, donate to the project!

#3175 2012-10-08 14:10:13

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

Re: Conky v1.9 Thread

Deegan wrote:

Hi boys, need one help of yours!! wink

If I use this .conkyrc::**

Do you know how to tell me how come?
PS::*  conky version 1.8.1-6

Thanks.....;)

I don't recognize that error but you really should not use v1.8.1 it had a lot of problems.
You should upgrade to v1.9.0 and see if that fixes it.

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