Leo_ex7
Entuzjasta Open Source
Liczba postów: 44
Dołączył: 03-05-2009
Reputacja: 1
|
RE: Conky - configi
main_conkyrc
Kod:
# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# -- "DNA Conky" created by Kamillus (aka Leo_ex7) for 15,6" screen and 1366x768 resolution -- #
# -- General -- #
background yes
cpu_avg_samples 2
net_avg_samples 2
total_run_times 0
update_interval 1
no_buffers yes
short_units yes
# -- Text -- #
uppercase no
override_utf8_locale yes
use_xft yes
xftalpha 0.75
# -- Windows -- #
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes # for KDE4, disable "shadows" in Kwin
own_window_argb_visual yes
own_window_type normal # normal, desktop, override
own_window_class conky-semi
own_window_title conky
# -- Graphics -- #
double_buffer yes
# -- Colors -- #
color1 000000 # black
color2 FFFFFF # white
# -- Layout -- #
alignment top_right
gap_x 0
gap_y 0
minimum_size 350 758
maximum_width 350
# -- Lua Load -- #
lua_load ~/.conky/conky_widgets.lua
lua_draw_hook_pre widgets
TEXT
# CLOCK
${color2}${font :bold:size=14}${goto 153}${time %d}.${time %m}${font :size=30}${goto 45}${time %H}${offset 175}${time %M}${font :bold:size=12}${goto 161}${voffset 2}${time %Y}${font :bold:size=10}${goto 170}${voffset 20}${time %a}
# CPU & HDD
${font :size=15}${voffset 74}${offset 45}CPU${offset 180}HDD
${font :italic:size=8}${offset 5}core1${offset 50}${cpu cpu1}%${alignr 8}/home${offset 5}${fs_used /home} / ${fs_size /home}
${offset 5}core2${offset 50}${cpu cpu2}%${alignr 30}swap${offset 12}${swap} / ${swapmax}
${offset 5}temp${offset 50}${hwmon 0 temp 1}°C
# RAM & BAT
${font :size=15}${voffset 115}${offset 45}RAM${offset 180}BAT
${font :italic:size=8}${offset 5}used${offset 50}${memperc}%${alignr 24}remaining${offset 18}${battery_percent}%
${offset 5}total${offset 50}${memmax}${alignr 24}${battery_time}
# ETHERNET & WIFI
${font :size=15}${voffset 128}${offset 5}ETHERNET${offset 155}WIFI
${font :italic:size=8}${offset 5}DL:${offset 50}${downspeed eth0}${alignr 78}DL:${offset 50}${downspeed wlan0}
${offset 5}UP:${offset 50}${upspeed eth0}${alignr 78}UP:${offset 50}${upspeed wlan0}
${offset 5}IP:${offset 20}${addr eth0}${alignr 35}IP:${offset 20}${addr wlan0}
secondary_conkyrc
Kod:
# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# -- "DNA Conky" created by Kamillus (aka Leo_ex7) for 15,6" screen and 1366x768 resolution -- #
# -- Configuration for vertical lines and Paconky (Arch Linux) -- #
# -- General -- #
background yes
total_run_times 0
update_interval 3600
no_buffers yes
# -- Text -- #
uppercase no
override_utf8_locale yes
xftfont Ubuntu
use_xft yes
xftalpha 0.75
# -- Windows -- #
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes # for KDE4, disable "shadows" in Kwin
own_window_argb_visual yes
own_window_type normal # normal, desktop, override
own_window_class conky-semi
own_window_title conky
# -- Graphics -- #
double_buffer yes
# -- Colors -- #
color1 000000 # black
color2 FFFFFF # white
# -- Layout -- #
alignment top_right
gap_x 0
gap_y 0
minimum_size 350 758
maximum_width 350
# -- Lua Load -- #
lua_load ~/.conky/conky_widgets_updates.lua
lua_draw_hook_pre widgets
TEXT
${color2}${font :size=10}${voffset 24}${offset 1}_________________/${alignr 3}\________________
# 1
${color1}${font :bold:size=10}${alignc}${voffset 55}${offset 2}__
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_______
${color2}${font :size=10}${voffset 15}${offset 6}________________/${color1}${font :bold:size=10}${offset 22}_________${color2}${font :size=10}${offset 24}\________________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_____
# 2
${color1}${font :bold:size=10}${alignc}${voffset 55}${offset 3}____
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 3}________
${color2}${font :size=10}${voffset 15}${offset 4}________________/${color1}${font :bold:size=10}${offset 25}_________${color2}${font :size=10}${offset 25}\________________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 3}________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 3}____
# 3
${color1}${font :bold:size=10}${alignc}${voffset 55}${offset 2}_____
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}________
${color2}${font :size=10}${voffset 15}${offset 4}________________/${color1}${font :bold:size=10}${offset 25}_________${color2}${font :size=10}${offset 25}\_______________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_______
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}__
# ARCH LOGO (requires OpenLogos font)
${color2}${font OpenLogos:size=62}${goto 146}${voffset 50}A${font}
conky_widgets.lua
Kod:
--[[
Conky Widgets by londonali1010 (2009)
This script is meant to be a "shell" to hold a suite of widgets for use in Conky.
To configure:
+ Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between "require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
+ To call the widget, add the following between "cr = cairo_create(cs)" and "cairo_destroy(cr)" at the end of the script:
NAME_OF_FUNCTION(cr, OPTIONS)
+ Replace OPTIONS with the options for your widget (should be specified in the widget's code block)
Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
lua_load ~/scripts/conky_widgets.lua
lua_draw_hook_pre widgets
Changelog:
+ v1.1 -- Simplified calls to widgets by implementing a global drawing surface, and included imlib2 by default (03.11.2009)
+ v1.0 -- Original release (17.10.2009)
]]
--[[ "DNA Conky" by Kamillus (aka Leo_ex7) ]]
require 'cairo'
require 'imlib2'
--[[ RING WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
"arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
"max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
"bg_colour" is the colour of the base ring.
"bg_alpha" is the alpha value of the base ring.
"fg_colour" is the colour of the indicator part of the ring.
"fg_alpha" is the alpha value of the indicator part of the ring.
"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
"radius" is the radius of the ring.
"thickness" is the thickness of the ring, centred around the radius.
"start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
"end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle. ]]
function ring(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
local function draw_ring(pct)
local angle_0 = sa * (2 * math.pi/360) - math.pi/2
local angle_f = ea * (2 * math.pi/360) - math.pi/2
local pct_arc = pct * (angle_f - angle_0)
-- Draw background ring
cairo_arc(cr, xc, yc, r, angle_0, angle_f)
cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
cairo_set_line_width(cr, t)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
cairo_stroke(cr)
end
local function setup_ring()
local str = ''
local value = 0
str = string.format('${%s %s}', name, arg)
str = conky_parse(str)
value = tonumber(str)
if value == nil then value = 0 end
pct = value/max
draw_ring(pct)
end
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then setup_ring() end
end
--[[ END RING WIDGET ]]
--[[ RING (COUNTER-CLOCKWISE) WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
"arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
"max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
"bg_colour" is the colour of the base ring.
"bg_alpha" is the alpha value of the base ring.
"fg_colour" is the colour of the indicator part of the ring.
"fg_alpha" is the alpha value of the indicator part of the ring.
"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
"radius" is the radius of the ring.
"thickness" is the thickness of the ring, centred around the radius.
"start_angle" is the starting angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative.
"end_angle" is the ending angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative, but must be larger (e.g. more counter-clockwise) than start_angle. ]]
function ring_ccw(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
local function draw_ring(pct)
local angle_0 = sa * (2 * math.pi/360) - math.pi/2
local angle_f = ea * (2 * math.pi/360) - math.pi/2
local pct_arc = pct * (angle_f - angle_0)
-- Draw background ring
cairo_arc_negative(cr, xc, yc, r, angle_0, angle_f)
cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
cairo_set_line_width(cr, t)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc_negative(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
cairo_stroke(cr)
end
local function setup_ring()
local str = ''
local value = 0
str = string.format('${%s %s}', name, arg)
str = conky_parse(str)
value = tonumber(str)
if value == nil then value = 0 end
pct = value/max
draw_ring(pct)
end
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then setup_ring() end
end
--[[ END RING (COUNTER-CLOCKWISE) WIDGET ]]
function conky_widgets()
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)
--1)-----------------------------------------------------------------------------------------------------------------------
--[[ TIME (Left) ]]
cr = cairo_create(cs) --outer
ring(cr, 'time', '%H', 23, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 0, 129, 10, 224, 270)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring(cr, 'time', '%S', 59, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 0, 118, 10, 224, 270)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--[[ TIME (Right) ]]
cr = cairo_create(cs) --outer
ring_ccw(cr, 'time', '%M', 59, 0x000000, 0.1, 0x000000, 0.50, 105, 0, 129, 10, 141, 90)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring_ccw(cr, 'time', '%S', 59, 0x000000, 0.1, 0x000000, 0.50, 105, 0, 118, 10, 141, 90)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--2)----------------------------------------------------------------------------------------------------------------------
--[[ CPU (Left) ]]
cr = cairo_create(cs) --outer
ring(cr, 'cpu', 'cpu1', 100, 0x000000, 0.1, 0x000000, 0.50, 261, 192, 129, 10, 224, 321)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring(cr, 'cpu', 'cpu2', 100, 0x000000, 0.1, 0x000000, 0.50, 261, 192, 118, 10, 224, 321)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--[[ HDD (Right) ]]
cr = cairo_create(cs) --outer
ring_ccw(cr, 'fs_used_perc', '/home', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 192, 129, 10, 141, 44)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring_ccw(cr, 'swap', '', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 192, 118, 10, 141, 44)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--3)----------------------------------------------------------------------------------------------------------------------
--[[ RAM (Left) ]]
cr = cairo_create(cs) --outer
ring(cr, 'memperc', '', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 384, 129, 10, 224, 321)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring(cr, 'memperc', '', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 384, 118, 10, 224, 321)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--[[ BAT (Right) ]]
cr = cairo_create(cs) --outer
ring_ccw(cr, 'battery_percent', 'BAT0', 100, 0x000000, 0.1, 0x000000, 0.50, 105, 384, 129, 10, 141, 44)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring_ccw(cr, 'battery_percent', 'BAT0', 100, 0x000000, 0.1, 0x000000, 0.50, 105, 384, 118, 10, 141, 44)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--4)----------------------------------------------------------------------------------------------------------------------
--[[ ETHERNET (Left) ]]
cr = cairo_create(cs) --outer
ring(cr, 'downspeedf', 'eth0', 12800, 0x000000, 0.1, 0x000000, 0.50, 261, 576, 129, 10, 224, 321) --"max" is set for Fast Ethernet (100 Mb/s)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring(cr, 'upspeedf', 'eth0', 12800, 0x000000, 0.1, 0x000000, 0.50, 261, 576, 118, 10, 224, 321) --"max" is set for Fast Ethernet (100 Mb/s)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--[[ WIFI (Right) ]]
cr = cairo_create(cs) --outer
ring_ccw(cr, 'downspeedf', 'wlan0', 6912, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 576, 129, 10, 141, 44) --"max" is set for IEEE 802.11g (54 Mb/s)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring_ccw(cr, 'upspeedf', 'wlan0', 6912, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 576, 118, 10, 141, 44) --"max" is set for IEEE 802.11g (54 Mb/s)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
end
conky_widgets_updates.lua
Kod:
--[[
Conky Widgets by londonali1010 (2009)
This script is meant to be a "shell" to hold a suite of widgets for use in Conky.
To configure:
+ Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between "require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
+ To call the widget, add the following between "cr = cairo_create(cs)" and "cairo_destroy(cr)" at the end of the script:
NAME_OF_FUNCTION(cr, OPTIONS)
+ Replace OPTIONS with the options for your widget (should be specified in the widget's code block)
Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
lua_load ~/scripts/conky_widgets.lua
lua_draw_hook_pre widgets
Changelog:
+ v1.1 -- Simplified calls to widgets by implementing a global drawing surface, and included imlib2 by default (03.11.2009)
+ v1.0 -- Original release (17.10.2009)
]]
--[[ "DNA Conky" by Kamillus (aka Leo_ex7) ]]
--[[ Configuration for updates meters ]]
require 'cairo'
require 'imlib2'
--[[ RING WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
"arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
"max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
"bg_colour" is the colour of the base ring.
"bg_alpha" is the alpha value of the base ring.
"fg_colour" is the colour of the indicator part of the ring.
"fg_alpha" is the alpha value of the indicator part of the ring.
"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
"radius" is the radius of the ring.
"thickness" is the thickness of the ring, centred around the radius.
"start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
"end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle. ]]
function ring(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
local function draw_ring(pct)
local angle_0 = sa * (2 * math.pi/360) - math.pi/2
local angle_f = ea * (2 * math.pi/360) - math.pi/2
local pct_arc = pct * (angle_f - angle_0)
-- Draw background ring
cairo_arc(cr, xc, yc, r, angle_0, angle_f)
cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
cairo_set_line_width(cr, t)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
cairo_stroke(cr)
end
local function setup_ring()
local str = ''
local value = 0
str = string.format('${%s %s}', name, arg)
str = conky_parse(str)
value = tonumber(str)
if value == nil then value = 0 end
pct = value/max
draw_ring(pct)
end
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 0 then setup_ring() end
end
--[[ END RING WIDGET ]]
--[[ RING (COUNTER-CLOCKWISE) WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
"arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
"max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
"bg_colour" is the colour of the base ring.
"bg_alpha" is the alpha value of the base ring.
"fg_colour" is the colour of the indicator part of the ring.
"fg_alpha" is the alpha value of the indicator part of the ring.
"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
"radius" is the radius of the ring.
"thickness" is the thickness of the ring, centred around the radius.
"start_angle" is the starting angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative.
"end_angle" is the ending angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative, but must be larger (e.g. more counter-clockwise) than start_angle. ]]
function ring_ccw(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
local function draw_ring(pct)
local angle_0 = sa * (2 * math.pi/360) - math.pi/2
local angle_f = ea * (2 * math.pi/360) - math.pi/2
local pct_arc = pct * (angle_f - angle_0)
-- Draw background ring
cairo_arc_negative(cr, xc, yc, r, angle_0, angle_f)
cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
cairo_set_line_width(cr, t)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc_negative(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
cairo_stroke(cr)
end
local function setup_ring()
local str = ''
local value = 0
str = string.format('${%s %s}', name, arg)
str = conky_parse(str)
value = tonumber(str)
if value == nil then value = 0 end
pct = value/max
draw_ring(pct)
end
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 0 then setup_ring() end
end
--[[ END RING (COUNTER-CLOCKWISE) WIDGET ]]
function conky_widgets()
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)
--5)----------------------------------------------------------------------------------------------------------------------
--[[ REPO (Left) ]]
cr = cairo_create(cs) --outer
ring(cr, 'exec ~/.conky/updates_rings_outer', '', 1, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 768, 129, 10, 270, 321)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring(cr, 'exec ~/.conky/updates_rings_inner', '', 1, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 768, 118, 10, 270, 321)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
--[[ REPO (Right) ]]
cr = cairo_create(cs) --outer
ring_ccw(cr, 'exec ~/.conky/updates_rings_outer', '', 1, 0x000000, 0.1, 0x000000, 0.50, 105, 768, 129, 10, 90, 44)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
cr = cairo_create(cs) --inner
ring_ccw(cr, 'exec ~/.conky/updates_rings_inner', '', 1, 0x000000, 0.1, 0x000000, 0.50, 105, 768, 118, 10, 90, 44)
--function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
cairo_destroy(cr)
end
updates_rings_inner
Kod:
#!/usr/bin/perl
## script by Xyne
## http://bbs.archlinux.org/viewtopic.php?id=57291
use strict;
use warnings;
my $n = (`pacman -Qu | wc -l`);
if ($n == 0)
{
print "0"
}
elsif($n == 1)
{
print "0"
}
else
{
print "1"
}
updates_rings_outer
Kod:
#!/usr/bin/perl
## script by Xyne
## http://bbs.archlinux.org/viewtopic.php?id=57291
use strict;
use warnings;
my $n = (`pacman -Qu | wc -l`);
if ($n == 0)
{
print "0"
}
elsif($n == 1)
{
print "1"
}
else
{
print "1"
}
Hi! I'm a PC.......
and I'm MAC..........
AND WE ARE LINUX........................................
|
|