#1626 Le 17/07/2012, à 11:48
- ljere
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
ton script python me semble incorrect il manque ces deux premières lignes à mon avis
#!/usr/bin/env python
# encoding: utf-8
## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky
etc...
ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon
Hors ligne
#1627 Le 17/07/2012, à 21:15
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
salut,
j'ai essayé mais j'ai toujours le meme probléme....
Traceback (most recent call last):
File "/home/seb/conky/conkyscripts/gmail_parser.py", line 50, in <module>
readmail(f, int(maxlen)) # Let the feed be chewed by feedparser
File "/home/seb/conky/conkyscripts/gmail_parser.py", line 42, in readmail
print ' ${color2} - %s...' % atom.entries[i].title[:Nbcar]
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 27: ordinal not in range(128)
Je vais essayé la methode de traduction des charactéres avec accents.....
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1628 Le 17/07/2012, à 22:18
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
yess,
j'ai réussi en fouinant un peu et j'ai trouvé cette solution pour avec l'utf-8.
Les nouvelles lignes sont :
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
Et donc la nouvelle entete du script python Gmail
#!/usr/bin/env python
## -*- coding: utf-8 -*-
## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky
# ======================================================================
# Copyright (C) 2006 Baishampayan Ghose <b.ghose@ubuntu.com>
# Modified 2008 Hunter Loftis <hbloftis@uncc.edu>
# Time-stamp: Mon Jul 31, 2006 20:45+0530
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
# ======================================================================
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
import urllib # For BasicHTTPAuthentication
import feedparser # For parsing the feed
from textwrap import wrap
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1629 Le 19/07/2012, à 15:42
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour, a tous,
Bon ca commence a prendre la forme que je veux mon truc. J'ai modifié la météo, je la trouve plus clair comme çà. Par contre je n'arrive pas à afficher la ville. Que ce soit par le conkyrc ou le script python. Je peut, bien sur, lui faire afficher ce que je veux mais j'aimerais qu'il m'affiche la ville automatiquement. J'ai pas encore ou se cacher l'info avec intellicast... Je pense faire un petit script pour essayer de le faire.
Sinon j'ai réussi à modifier les scripts afin d'avoir l'affichage avec des accents des mails et de l'agenda (ce qui me bien pris la tête) et l'ensemble est Francisé (enfin je pense avec la météo, on ne sait jamais...)
Il me reste a mettre en place le script des "clics". J'aimerais que un clic sur les mails m'ouvre "gmail" dans chrome, qu'un clic sur agenda m'ouvre googleAgenda dans chrome et qu'un clic sur le meteo m'ouvre intellicast (ou autre) dans chrome et qu'un clic sur la ville permette de la changer (mais ce dernier je vais essayer par moi-meme avec le script exsitant).
Voila donc les scripts :
Conky meteo HTC
# -- Conky settings -- #
background no
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
short_units yes
# -- Window specifications -- #
own_window yes
own_window_title htc
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 460 250
maximum_width 460
alignment tr
gap_x 8
gap_y 0
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 8b8b8b
lua_load /home/seb/conky/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /home/seb/conky/v9000/weather_script.lua
lua_load /home/seb/conky/conkyscripts/Clic_info.lua
TEXT
${voffset 30}${font Helvetica LT Std :style=Condensed:size=60}${color 434343}${goto 40}${time %H}${goto 140}${time %M}${font Helvetica LT Std :size=15:style=condensed}
${voffset -60}${color whitesmoke}${font Helvetica LT Std :size=12}${alignr 50}${time %A}, ${time %e} ${time %B} ${time %G}
${color1}${font Helvetica LT Std :size=10}${offset 230}Aujourd'hui St. ${color1}${font Helvetica LT Std :size=10}${exec /home/seb/conky/conkyscripts/Saints}
${image /home/seb/conky/.images/base.png -p 12,30 -s 450x100}
${image /home/seb/conky/.images/base.png -p 12,135 -s 450x80}
${image /home/seb/conky/.images/flip_bg.png -p 30,10 -s 100x110}
${image /home/seb/conky/.images/flip_bg.png -p 130,10 -s 100x110}
Les scripts python qui vont avec la meteo et que je (tenté..) de franciser au maximum :
--SETTINGS AND PREFERENCES--SETTINGS AND PREFERENCES--SETTINGS AND PREFERENCES
function weather_settings()--#### DO NOT EDIT THIS LINE #################
--#######################################################################
local secs=1800--set update interval
local web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=FRXX0047"--insert unit=C& after aspx? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
--set location of weather images (replace "benjamin" with your own username)
local weathericons="/home/seb/conky/v9000/additional_files/weathericons/"
--short conditions setup
--this section allows you to set your own shorter terms to replace the terms foud in conditions
--to use for current: now["conditions_short"], now["conditions_short_caps"], now["conditions_short_lc"]
--to use for forecast: conditions_short[n], conditions_short_caps[n], conditions_short_lc[n]
--ALSO USE THIS TABLE TO ENTER CONDITIONS TRANSLATIONS
con_short={--start of table, put entries below in form eg: ["Thunderstorm"]="T.Strm",
["Wind Early"]="Brise",--remember to put a comma at the end of every entry
["Showers/Wnd"]="Pluie",
["Snow Showers"]="Av.Neige",
["Thunderstorm"]="Orage",
["Few Snow Showers"]="Neige",
["Partly Cloudy"]="Nuageux",
["Mostly Cloudy"]="Couvert",
["Mostly Sunny"]="Soleil",
["Rain/Snow"]="Pluie/neige",
["Rain/Thunderstorm"]="Orageux",
["PM Rn/Snow"]="Pluie/neige",
["PM Showers"]="Averse",
["Showers Late"]="Averse",
["AM Rn/Snow"]="Pluie/neige",
["AM Light Snow"]="Neige",
["AM T.Strms/Wind"]="Tempête",
["Light Rain"]="Pluie fine",
["Mostly Clear"]="Variable",
["Rain"]="Pluie",
["Shower"]="Averse",
["Clear"]="Clair",
["Broken Clouds"]="Qqs Nuages",
["Mostly"]="",
["PM"]="",
["Cloudy"]="Nuageux",
["Few Clouds"]="Peu Nuageux",
["Overcast"]="Voilé"
}--this bracket closes the table
--the script is capable of converting between several unit types
--set how many decimal places you want the conversions to show
local decimal_places=1
--some weather data options need to come with their own units attached as they can be NA on occasion
--set here what you want to have for units, or set "" for nothing
--include preceeding spaces if any for formatting
local visibility_unit=" mi"
local wind_mph_unit=" mph"
local wind_km_unit=" kmh"
local wind_kts_unit=" kts"
local ceiling_unit=" ft"
local wind_degrees_unit="°"
--do you want the script to use translation tables?
--set 1 if you want to translate, 0 if not.
--the translation tables are located at the bottom of the script in function called "translate_tables"
--these tables are in addition to the con_short table which can be used to translate weather conditions and data options units settings
local translate=0
--NOTE if you make changes to these settings, they will only take effect at the next weather update
--or after killall conky and restart
--#######################################################################
return {secs,web,weathericons,con_short,decimal_places,visibility_unit,wind_mph_unit,wind_km_unit,wind_kts_unit,ceiling_unit,wind_degrees_unit,translate}
end--OF SETTINGS AND PREFERENCES ########################################
--#######################################################################
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--#######################################################################
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Helvetica LT Std"--font must be in quotes
default_font_size=14
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
out({fs=10,x=90,y=120,txt="Last Update: "..now["time"]})
out({fs=10,x=90,y=130,txt=now["City"]})
image({x=300,y=50,h=90,w=90,file=now["weather_icon"]})
--output of data options
out({x=230,y=90,txt=now["conditions_short"]})
out({x=400,y=90,txt=now["wind_km"]})
out({x=240,y=120,txt=now["temp"].."° / "..now["feels_like"].."°"})
out({x=400,y=120,txt=high_temp[1].."° / "..low_temp[1].."°"})
--start of weather forecast repeat section
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=6
topy=150
ygap=0
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]=50,topy
top_left_x_coordinate[2],top_left_y_coordinate[2]=120,topy
top_left_x_coordinate[3],top_left_y_coordinate[3]=190,topy
top_left_x_coordinate[4],top_left_y_coordinate[4]=260,topy
top_left_x_coordinate[5],top_left_y_coordinate[5]=330,topy
top_left_x_coordinate[6],top_left_y_coordinate[6]=400,topy
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do--start of day repeat, do not edit ########
tlx=top_left_x_coordinate[i]--sets top left x position for each repeat ###################
tly=top_left_y_coordinate[i]--sets top left y position for each repeat ###################
--########################################################################################
out({fs=12,x=tlx+9,y=tly,txt=forecast_day_short[i]})
image({x=tlx,y=tly+2,h=45,w=45,file=weather_icon[i]})
out({fs=12,x=tlx,y=tly+55,txt=high_temp[i].."°/"..low_temp[i].."°"})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
function hg_to_hpa(hg_pressure)
--convert inches of hg to pascals
local pa=tonumber(hg_pressure)*3386.389
--convert to hpa, 1hpa=100pa
local hpa=pa/100
--round hpa to 2 decimal places
local mult = 10^2
return math.floor(hpa * mult + 0.5) / mult
end
--weather v9000 by mrpeachy 01/10/12
require 'cairo'
require 'imlib2'
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
username = os.getenv("USERNAME")
--username = "yourusername"
package.path = '/home/seb/conky/.v9000_config.lua'
require '.v9000_config'
--END SETUP--END SETUP--END SETUP--END SETUP--END SETUP--END SETUP--END SETUP--END---
--######## main function ###########
function conky_weather()--##########
--##################################
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)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
local display_script=1 -- set 1 for seperate display script, 0 to enter at bottom, default = 1
settings_table=weather_settings()
local secs=settings_table[1]
local web=settings_table[2]
local weathericons=settings_table[3]
con_short=settings_table[4]
decimal_places=settings_table[5] -- dont localize
local visibility_unit=settings_table[6]
local wind_mph_unit=settings_table[7]
local wind_km_unit=settings_table[8]
local wind_kts_unit=settings_table[9]
local ceiling_unit=settings_table[10]
local wind_degrees_unit=settings_table[11]
local translate=settings_table[12]--]]
local testing=0--this setting is for script testing, if not in testing set to 0
--#########################################################################################################
--############start of timed section#######################################################################
--#########################################################################################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %secs)+1
--#######################################
if timer==secs or updates==6 then--######
--#######################################
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")
allweather=f:read("*a")
f:close()
allweather=string.gsub(allweather,"[\n\r]","")
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions ' | sed 's/%//g'")
nowweather=f:read("*a")
f:close()
nowweather=string.gsub(nowweather,"[\n\r]","")
processall=1
processnow=1
end--of timed data gathering section
--#####################################################
--in case curl craps up it should retry until it works
local testall=string.find(allweather,"%a")
local testnow=string.find(nowweather,"%a")
if testall==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")
allweather=f:read("*a")
f:close()
allweather=string.gsub(allweather,"[\n\r]","")
processall=1
end
-----------------------------------------
if testnow==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions ' | sed 's/%//g'")
nowweather=f:read("*a")
f:close()
nowweather=string.gsub(nowweather,"[\n\r]","")
processnow=1
end
--end or curl reruns
local testall=string.find(allweather,"%a")
local testnow=string.find(nowweather,"%a")
--LOAD TRANSLATE TABLES IF TRANSLATE SETTING = 1
if translate==1 then
monthshort={}
monthnames={}
dayshort={}
daysnames={}
neswtext={}
tsuffix={}
uvtext={}
moonphases={}
translate_tables()
else
dayshort={Monday="Lun",Tuesday="Mar",Wednesday="Merc",Thursday="Jeu",Friday="Vend",Saturday="Sam",Sunday="Dim"}
monthshort={January="Jan",February="Feb",March="Mar",April="Apr",May="May",June="Jun",July="Jul",August="Aug",September="Sep",October="Oct",November="Nov",December="Dec"}
end
--end if translate =1
if testall~=nil and testnow~=nil and processall==1 and processnow==1 then
--process data
--intellicast to conky weather icon conversion
wimage={
wx_65="32",
wx_66="30",
wx_67="26",
wx_68="32",
wx_69="28",
wx_70="20",
wx_71="32",
wx_72="21",
wx_73="36",
wx_74="14",
wx_75="28",
wx_76="18",
wx_77="14",
wx_78="23",
wx_79="05",
wx_80="15",
wx_81="15",
wx_82="11",
wx_83="16",
wx_84="00",
wx_85="32",
wx_86="25",
wx_87="09",
wx_88="05",
wx_89="18",
wx_90="18",
wx_91="39",
wx_92="39",
wx_93="39",
wx_94="39",
wx_95="37",
wx_96="37",
wx_97="31",
wx_98="29",
wx_99="27",
wx_100="47",
wx_101="47",
wx_102="33",
wx_103="26",
wx_104="20",
wx_105="45",
wx_106="45",
wx_107="11",
wx_108="46",
wx_109="46",
wx_110="06",
wx_111="18",
wx_112="06",
wx_113="46",
wx_114="46",
wx_115="31",
wx_116="47",
}--end w image table
--convert intellicast icons to weather font
wfont={
wx_65="a",
wx_66="c",
wx_67="f",
wx_68="a",
wx_69="d",
wx_70="0",
wx_71="a",
wx_72="9",
wx_73="5",
wx_74="p",
wx_75="d",
wx_76="w",
wx_77="p",
wx_78="6",
wx_79="x",
wx_80="8",
wx_81="8",
wx_82="h",
wx_83="q",
wx_84="m",
wx_85="a",
wx_86="-",
wx_87="h",
wx_88="x",
wx_89="w",
wx_90="w",
wx_91="g",
wx_92="g",
wx_93="g",
wx_94="g",
wx_95="k",
wx_96="k",
wx_97="A",
wx_98="C",
wx_99="D",
wx_100="K",
wx_101="K",
wx_102="B",
wx_103="f",
wx_104="0",
wx_105="G",
wx_106="G",
wx_107="h",
wx_108="O",
wx_109="O",
wx_110="x",
wx_111="w",
wx_112="x",
wx_113="O",
wx_114="O",
wx_115="A",
wx_116="K",
}--end w font table
--conversion day and month tables
moonfontt={
["New"]="@",
["Full"]="=",
["First Quarter"]="T",
["Last Quarter"]="G",
["Waning Gibbous"]="D",
["Waning Crescent"]="J",
["Waxing Crescent"]="Q",
["Waxing Gibbous"]="W",
}--end of moon font table
windfontt={
S="9",
SSW=":",
SW=";",
WSW="<",
W="=",
WNW=">",
NW="?",
NNW="@",
N="1",
NNE="2",
NE="3",
ENE="4",
E="5",
ESE="6",
SE="7",
SSE="8"
}--end of wind direction font table
--setup tables for forecast weather
forecast_day={}
forecast_day_caps={}
forecast_day_lc={}
forecast_day_short={}
forecast_day_short_caps={}
forecast_day_short_lc={}
forecast_month={}
forecast_month_caps={}
forecast_month_lc={}
forecast_month_short={}
forecast_month_short_caps={}
forecast_month_short_lc={}
forecast_date={}
weather_icon={}
weather_font={}
high_temp={}
low_temp={}
conditions={}
conditions_caps={}
conditions_lc={}
conditions_short={}
conditions_short_caps={}
conditions_short_lc={}
sun_rise={}
sun_rise_lc={}
sun_rise_time={}
moon_rise={}
moon_rise_lc={}
moon_rise_time={}
moon_rise_ampm={}
moon_rise_ampm_lc={}
sun_set={}
sun_set_lc={}
sun_set_time={}
moon_set={}
moon_set_lc={}
moon_set_time={}
moon_set_ampm={}
moon_set_ampm_lc={}
humidity={}
precipitation={}
snow={}
cloud_cover={}
moon_phase={}
moon_phase_caps={}
moon_phase_lc={}
moon_font={}
wind_mph={}
wind_km={}
wind_kts={}
wind_font={}
wind_deg={}
wind_nesw={}
uv_index_num={}
uv_index_txt={}
uv_index_txt_caps={}
uv_index_txt_lc={}
-----------------
--extract information into tables
local start=0
local f=1
while f~=nil do
--match forecast day name and date
local s,f,t=string.find(allweather,"<td colspan=\"2\"><strong>([%a,%s%d]*)</strong></td>",start)
if t~=nil then
--split name from month and date
local a,b,day=string.find(t,"(%a*),%s")
local a,b,month=string.find(t,",%s(%a*)%s")
local a,b,date=string.find(t,"(%d*)$")
--ser day names, regular, caps, lowercase and short
table.insert(forecast_day_short,dayshort[day])
table.insert(forecast_day_short_caps,string.upper(dayshort[day]))
table.insert(forecast_day_short_lc,string.lower(dayshort[day]))
if translate==1 then
day=daynames[day]
else
day=day
end
table.insert(forecast_day,day)
table.insert(forecast_day_caps,string.upper(day))
table.insert(forecast_day_lc,string.lower(day))
--set month types
table.insert(forecast_month_short,monthshort[month])
table.insert(forecast_month_short_caps,string.upper(monthshort[month]))
table.insert(forecast_month_short_lc,string.lower(monthshort[month]))
if translate==1 then
month=monthnames[month]
else
month=month
end
table.insert(forecast_month,month)
table.insert(forecast_month_caps,string.upper(month))
table.insert(forecast_month_lc,string.lower(month))
--set date
table.insert(forecast_date,date)
end--if t~= nil
--intellicast weather icon match
local s,f,t=string.find(allweather,"40_white/(wx_[%d]*).png\"",start)
--convert to conkyweather icon
if t~=nil then
table.insert(weather_icon,weathericons..wimage[t]..".png")
--convert to weather font
table.insert(weather_font,wfont[t])
end
--match conditions
local s,f,t=string.find(allweather," /><br />([%a%s%p]*)</td>",start)
if t~=nil then
table.insert(conditions,t)
table.insert(conditions_caps,string.upper(t))
table.insert(conditions_lc,string.lower(t))
--set short versions--------------------------------
local cons=t
for k,v in pairs(con_short) do
cons=string.gsub(cons,k,v)
end
table.insert(conditions_short,cons)
table.insert(conditions_short_caps,string.upper(cons))
table.insert(conditions_short_lc,string.lower(cons))
-----------------------------------------------------
end
--match high temp
local s,f,t=string.find(allweather,"\"Hi\">([%p%d]*)°",start)
table.insert(high_temp,t)
--match low temp
local s,f,t=string.find(allweather,"\"Lo\">([%p%d]*)°",start)
table.insert(low_temp,t)
--match sun rise times
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(sun_rise,tm..suf)
table.insert(sun_rise_lc,string.lower(tm..suf))
table.insert(sun_rise_time,tm)
end
--match sun set times
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(sun_set,tm..suf)
table.insert(sun_set_lc,string.lower(tm..suf))
table.insert(sun_set_time,tm)
end
--moon rise
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(moon_rise,tm..suf)
table.insert(moon_rise_lc,string.lower(tm..suf))
table.insert(moon_rise_time,tm)
table.insert(moon_rise_ampm,suf)
table.insert(moon_rise_ampm_lc,string.lower(suf))
end
--moon set
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(moon_set,tm..suf)
table.insert(moon_set_lc,string.lower(tm..suf))
table.insert(moon_set_time,tm)
table.insert(moon_set_ampm,suf)
table.insert(moon_set_ampm_lc,string.lower(suf))
end
--match uv index
local s,f,tuv=string.find(allweather,"UV Index:</strong> (%d*%s*%(%a*%)) <br />",start)
if tuv~=nil then
--get just number
local a,b,unm=string.find(tuv,"(%d*)%s*%(%a*%)")
--get just text
local a,b,utx=string.find(tuv,"%d*%s*%((%a*)%)")
table.insert(uv_index_num,unm)
if translate==1 then
utx=uvindextext[utx]
else
utx=utx
end
table.insert(uv_index_txt,utx)
table.insert(uv_index_txt_caps,string.upper(utx))
table.insert(uv_index_txt_lc,string.lower(utx))
end
--match humidity
local s,f,t=string.find(allweather,"Humidity:</strong> (%d*)<br />",start)
table.insert(humidity,t)
--match ppt
local s,f,t=string.find(allweather,"Precipitation:</strong> (%d*)<br />",start)
table.insert(precipitation,t)
--match snow %
local s,f,t=string.find(allweather,"Snow Probability:</strong>%s*(%d*)<br />",start)
table.insert(snow,t)
--match cloud coveage
local s,f,t=string.find(allweather,"Cloud Coverage:</strong> (%d*)<br />",start)
table.insert(cloud_cover,t)
--match moon phase
local s,f,t=string.find(allweather,"Moon Phase:</strong> ([%a%s]*) <br />",start)
--set moon phase text
if t~= nil then
--set moon phase font
table.insert(moon_font,moonfontt[t])
if translate==1 then
t=moonphases[t]
else
t=t
end
table.insert(moon_phase,t)
table.insert(moon_phase_caps,string.upper(t))
table.insert(moon_phase_lc,string.lower(t))
end
--match wind speeds
local s,f,t=string.find(allweather,"Wind Speed:</strong> (%d*)Mph",start)
table.insert(wind_mph,t)
local s,f,t=string.find(allweather,"Mph%s*%((%d*)Km,",start)
table.insert(wind_km,t)
local s,f,t=string.find(allweather,"Km,%s*(%d*)Kts%)",start)
table.insert(wind_kts,t)
--match wind direction
local s,f,twd=string.find(allweather,"Wind Direction:</strong> ([%d&;%s%(%a%)]*)%s*</div>",start)
if twd~=nil then
local a,b,tdeg=string.find(twd,"(%d*)°")
table.insert(wind_deg,tdeg)
--match wind font and nesw
local a,b,tnesw=string.find(twd,"%((%a*)%)")
table.insert(wind_font,windfontt[tnesw])
if translate==1 then
tnesw=neswtext[tnesw]
else
tnesw=tnesw
end
table.insert(wind_nesw,tnesw)
end
if f==nil then break end
start=f
end--while
--#########################################################################################################################################
--end--of timed section
--format now weather
--extract current data
now={}
monthlong={Jan="January",Feb="February",Mar="March",Apr="April",May="May",Jun="June",Jul="July",Aug="August",Sep="September",Oct="October",Nov="November",Dec="December"}
local s,f,tnow=string.find(nowweather,"<div style=\"float:right;color:#666;\"> As of ([%d%p%a%s]*) %(Local Time%)")
local s,f,t=string.find(tnow,"(%d*%p%d*%s%a*) on")
--get time only
local a,b,ntm=string.find(t,"(%d*%p%d*)")
--get suffix only
local a,b,nsf=string.find(t,"(%u%u)")
if translate==1 then
suf=tsuffix[nsf]
else
suf=nsf
end
now["time"]=ntm..suf
now["time_lc"]=string.lower(ntm..suf)
now["time_num"]=ntm
now["time_ampm"]=suf
now["time_ampm_lc"]=string.lower(suf)
--get day
local s,f,t=string.find(tnow,"on (%a*)%s%d*")
if translate==1 then
day=daynames[t]
else
day=t
end
now["day"]=day
now["day_caps"]=string.upper(day)
now["day_lc"]=string.lower(day)
--short day names
local ds=dayshort[t]
now["day_short"]=ds
now["day_short_caps"]=string.upper(ds)
now["day_short_lc"]=string.lower(ds)
--get date
local s,f,t=string.find(tnow,"%s(%d%d)%s")
now["date"]=t
--get months
local s,f,t=string.find(tnow,"%d%d%s(%a*)%s%d")
if translate==1 then
mnth=monthlong[t]
now["month_short"]=monthshort[mnth]
now["month_short_caps"]=string.upper(monthshort[mnth])
now["month_short_lc"]=string.lower(monthshort[mnth])
mnth=monthnames[mnth]
else
now["month_short"]=t
now["month_short_caps"]=string.upper(t)
now["month_short_lc"]=string.lower(t)
mnth=monthlong[t]
end
now["month"]=mnth
now["month_caps"]=string.upper(mnth)
now["month_lc"]=string.lower(mnth)
--get year
local s,f,t=string.find(tnow,"%a%a%a%s(%d%d%d%d)")
now["year"]=t
--get weather icon
local s,f,t=string.find(nowweather,"40_white/(wx_[%d]*)%ppng%p%stitle=%p")
now["weather_icon"]=weathericons..wimage[t]..".png"
now["weather_font"]=wfont[t]
--class=%pIcon%p /> ([%a%s]*)%s*</td>
local s,f,t=string.find(nowweather,"class=%pIcon%p /> ([%a%s%p]*)%s*%s*</td>%s*<td class=%pEmpty%p> ")
now["conditions"]=t
now["conditions_caps"]=string.upper(t)
now["conditions_lc"]=string.lower(t)
--set short versions------------------------
local cons=t
for k,v in pairs(con_short) do
cons=string.gsub(cons,k,v)
end
now["conditions_short"]=cons
now["conditions_short_caps"]=string.upper(cons)
now["conditions_short_lc"]=string.lower(cons)
--------------------------------------------
local s,f,t=string.find(nowweather,"Temperature\">([%p%d]*)°")
now["temp"]=t
local s,f,t=string.find(nowweather,">Feels Like: ([%p%d]*)°</a>")
now["feels_like"]=t
local s,f,t=string.find(nowweather,">Wind Chill: </a></td>%s*<td>([%p%d]*)°</td>")
now["wind_chill"]=t
local s,f,t=string.find(nowweather,">Ceiling: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tc=t..ceiling_unit
else
tc=t
end
now["ceiling"]=tc
now["ceiling_caps"]=string.upper(tc)
now["ceiling_lc"]=string.lower(tc)
--get heat index
local s,f,t=string.find(nowweather,">Heat Index: </a></td>%s*<td>([%p%d]*)°</td>")
now["heat_index"]=t
--get visibility
local s,f,t=string.find(nowweather,">Visibility: </a></td>%s*<td>([%a%d%p]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tv=t..visibility_unit
else
tv=t
end
now["visibility"]=tv
now["visibility_caps"]=string.upper(tv)
--get dew point
local s,f,t=string.find(nowweather,">Dew Point: </a></td>%s*<td>([%p%d]*)°</td>")
now["dew_point"]=t
--get wind speed
local s,f,t=string.find(nowweather,">Wind: </a></td>%s*<td>(%d*)mph</td>")
now["wind_mph"]=t..wind_mph_unit
now["wind_mph_caps"]=string.upper(t..wind_mph_unit)
--convert mph to km and knots #################################################
--[[1 mile per hour = 0.869 international nautical mile per hour (knot)
1 mile per hour = 1.609 kilometers per hour
1 mile per hour = 0.4470 meter per second
1 knot = 1.852 kilometers per hour
1 knot = 0.5144 meter per second
1 meter per second = 3.6 kilometers per hour]]
now["wind_km"]=round(tonumber(t)*1.609)..wind_km_unit
now["wind_km_caps"]=string.upper(round(tonumber(t)*1.609)..wind_km_unit)
now["wind_kts"]=round(tonumber(t)*0.869)..wind_kts_unit
now["wind_kts_caps"]=string.upper(round(tonumber(t)*0.869)..wind_kts_unit)
--#############################################################################
if tonumber(t)==0 then
windtest=0
else
windtest=1
end
local s,f,t=string.find(nowweather,">Humidity: </a></td>%s*<td>(%d*)</td>")
now["humidity"]=t
local s,f,twd=string.find(nowweather,">Direction: </a></td>%s*<td style=[%p%a]*>([%d&;%s%(%a%)]*)</td>%s*</tr>")
local a,b,t=string.find(twd,"(%d*)°")
if windtest==1 then
now["wind_deg"]=t..wind_degrees_unit
else
now["wind_deg"]="NA"
end
--set wind font
local a,b,t=string.find(twd,"%((%a*)%)")
if windtest==1 then
now["wind_nesw"]=t
now["wind_font"]=windfontt[t]
else
now["wind_nesw"]="NA"
now["wind_font"]=windfontt["N"]
end
--get pressure
local s,f,t=string.find(nowweather,">Pressure: </a></td>%s*<td>([%d%p]*)\"</td>")
now["pressure"]=t
--convert pressures ########################################################
--[[ 1 inch of mercury = 25.4 mm of mercury = 33.86 millibars
= 33.86 hectoPascals]]
now["pressure_mb"]=round(tonumber(t)*33.86)
--##########################################################################
local s,f,t=string.find(nowweather,">Gusts: </a></td>%s*<td>([%d%a]*)</td>")
if t~="NA" then
local s,f,t=string.find(t,"(%d*)")
tg=t..wind_mph_unit
tgkm=round(tonumber(t)*1.609)..wind_km_unit
tgkts=round(tonumber(t)*0.869)..wind_kts_unit
else
tg=t
tgkm=t
tgkts=t
end
now["wind_gusts"]=tg
now["wind_gusts_caps"]=string.upper(tg)
--convert gusts from mph to km and knots ###################################
now["wind_gusts_km"]=tgkm
now["wind_gusts_km_caps"]=string.upper(tgkm)
now["wind_gusts_kts"]=tgkts
now["wind_gusts_kts_caps"]=string.upper(tgkts)
--##########################################################################
--get hourly forecast options hour1--------------------
--get day 1 bit
s,f,hfc=string.find(nowweather,"<td class=%pHour%p%sstyle=%ppadding%pleft([%a%d%p%s]*)%pdeg%p</strong>",1)
--get time and conditions
--<strong>1 PM</strong><br />%s*P Cloudy%s*</td>%s*<td class=%pHour%p
local a,b,t=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",1)
--print (a,b,t)
now["fc_hour1_time"]=t
local a,b,t=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",1)
now["fc_hour1_ampm"]=t
now["fc_hour1_ampm_lc"]=string.lower(t)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%p%s%a]*)%s*</td>%s*<td class=%pHour%p",1)
now["fc_hour1_cond"]=t
now["fc_hour1_cond_lc"]=string.lower(t)
now["fc_hour1_cond_caps"]=string.upper(t)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",1)
now["fc_hour1_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour1_wfont"]=wfont[t]
--get temperature
--><strong>-5°</strong></td>
local a,b,t=string.find(hfc,"><strong>([%p%d]*)°</strong></td>",1)
now["fc_hour1_temp"]=t
--end of hour1 data gathering--repeat 2 more times
--get hourly forecast options hour2--------------------
local start=tonumber(b)
--get time and conditions
--<strong>1 PM</strong><br />%s*P Cloudy%s*</td>%s*<td class=%pHour"%p
local a,b,t=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",start)
now["fc_hour2_time"]=t
local a,b,t=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",start)
now["fc_hour2_ampm"]=t
now["fc_hour2_ampm_lc"]=string.lower(t)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%a%s%p]*)%s*</td>%s*<td class=%pHour%p",start)
now["fc_hour2_cond"]=t
now["fc_hour2_cond_lc"]=string.lower(t)
now["fc_hour2_cond_caps"]=string.upper(t)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",start)
now["fc_hour2_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour2_wfont"]=wfont[t]
--get temperature
--><strong>-5°</strong></td>
local a,b,t=string.find(hfc,"><strong>([%p%d]*)°</strong></td>",start)
now["fc_hour2_temp"]=t
--end of hour2 data gathering--repeat 1 more times
--get hourly forecast options hour3--------------------
local start=tonumber(b)
--get time and conditions
--<strong>1 PM</strong><br />%s*P Cloudy%s*</td>%s*<td class=%pHour"%p
local a,b,t=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",start)
now["fc_hour3_time"]=t
local a,b,t=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",start)
now["fc_hour3_ampm"]=t
now["fc_hour3_ampm_lc"]=string.lower(t)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%a%s%p]*)%s*</td>%s*<td class=%pHour%p",start)
now["fc_hour3_cond"]=t
now["fc_hour3_cond_lc"]=string.lower(t)
now["fc_hour3_cond_caps"]=string.upper(t)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",start)
now["fc_hour3_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour3_wfont"]=wfont[t]
--get temperature
--><strong>-5°</strong></td>
local a,b,t=string.find(hfc,"><strong>([%p%d]*)",start)
now["fc_hour3_temp"]=t
--end of hour3 data gathering--finished for all hours
--###############end of data processing########################
if testing==0 then
processall=0
processnow=0
print ("processing complete")
elseif testing==1 then
processall=1
processnow=1
end
--######################################
end--of data processing section ########
--######################################
if testnow~=nil and testall~=nil and display_script==1 then
_G.weather_script()--uncomment this line to use the seperate display script method
elseif testnow~=nil and testall~=nil and display_script==0 then
weather_display()
end
--######################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
--################################
end-- end main function ##########
--################################
function round(num)
local idp=default_decimal_places
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end
function xout(txj)--c,a,f,fs,x,y,txt,j
c=nil
c=txj.c
if c==nil then c=default_color end
alpha=nil
a=txj.a
if a==nil then a=default_alpha end
f=nil
f=txj.f
if f==nil then f=default_font end
fs=nil
fs=txj.fs
if fs==nil then fs=default_font_size end
x=nil
x=txj.x
if x==nil then x=0 end
y=nil
y=txj.y
if y==nil then y=0 end
txt=nil
txt=txj.txt
if txt==nil then txt="set txt" end
j=nil
j=txj.j
if j==nil then j="l" end
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
local text=string.gsub(txt," ","_")
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local wx=extents.width
cairo_set_source_rgba (cr,col(c,a))
if j=="l" then
cairo_move_to (cr,x,y)
adx=wx
elseif j=="c" then
cairo_move_to (cr,x-(wx/2),y)
adx=wx/2
elseif j=="r" then
cairo_move_to (cr,x-wx,y)
adx=0
end
cairo_show_text (cr,txt)
cairo_stroke (cr)
nextx=nil
nextx=adx+x
return nextx
end--function xout ###################################################################
function out(tx)--####################################################
c=nil
c=tx.c
if c==nil then c=default_color end
a=nil
a=tx.a
if a==nil then a=default_alpha end
f=nil
f=tx.f
if f==nil then f=default_font end
fs=nil
fs=tx.fs
if fs==nil then fs=default_font_size end
x=nil
x=tx.x
if x==nil then x=0 end
y=nil
y=tx.y
if y==nil then y=0 end
txt=nil
txt=tx.txt
if txt==nil then txt="set txt" end
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
cairo_set_source_rgba (cr,col(c,a))
cairo_move_to (cr,x,y)
cairo_show_text (cr,txt)
cairo_stroke (cr)
end--function out ###################################################################
function image(im)--#################################################################
x=nil
x=im.x
if x==nil then x=0 end
y=nil
y=im.y
if y==nil then y=0 end
w=nil
w=im.w
if w==nil then w=default_image_width end
h=nil
h=im.h
if h==nil then h=default_image_height end
file=nil
file=tostring(im.file)
if file==nil then print("set image file") end
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then
width=imlib_image_get_width()
else
width=tonumber(w)
end
if tonumber(h)==0 then
height=imlib_image_get_height()
else
height=tonumber(h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image()
show=nil
end--function image ##################################################################
function translate_tables()
--TRANSLATION TABLES - only edit the second, the one after the =
--translate NESW text
neswtext={
S="testS",
SSW="tsetSSW",
SW="testSW",
WSW="testWSW",
W="testW",
WNW="testWNW",
NW="testNW",
NNW="testNNW",
N="testN",
NNE="testNNE",
NE="testNE",
ENE="testENE",
E="testE",
ESE="testESE",
SE="testSE",
SSE="testSSE",
}--end of N E S W text table
--translate time suffix
tsuffix={
AM="testAM",
PM="testPM",
}--end of time suffix table
--enter translations for uv index text
uvindextext={
["Low"]="testLow",
["Moderate"]="testModerate",
["High"]="testHigh",
["Very High"]="testVery High",--format is different because of the space in the text
["Extreme"]="testExtreme",
}--end of uv text table
--enter translations for moonpahse
moonphases={
["New"]="testNouvelle lune",
["Full"]="testPleine Lune",
["First Quarter"]="testPremier Quartier",
["Last Quarter"]="testDernier Quartier",
["Waning Gibbous"]="testWaning Gibbous",
["Waning Crescent"]="testWaning Crescent",
["Waxing Crescent"]="testWaxing Crescent",
["Waxing Gibbous"]="testWaxing Gibbous",
}--end of moon phase table
--enter translations for day names
daynames={
Monday="testMonday",
Tuesday="testTuesday",
Wednesday="testWednesday",
Thursday="testThursday",
Friday="testFriday",
Saturday="testSaturday",
Sunday="testSunday",
}--end day names table
--enter translations for short day names
dayshort={
Monday="testLun",
Tuesday="testMar",
Wednesday="testMerc",
Thursday="testJeudi",
Friday="testVend",
Saturday="testSam",
Sunday="testDim"
}--end short day names table
--enter translation for month names
monthnames={
January="testJanuary",
February="testFebruary",
March="testMarch",
April="testApril",
May="testMay",
June="testJune",
July="testJuly",
August="testAugust",
September="testSeptember",
October="testOctober",
November="testNovember",
December="testDecember"
}--end of month name translations
monthshort={
January="testJan",
February="testFeb",
March="testMar",
April="testApr",
May="testMay",
June="testJun",
July="testJul",
August="testAug",
September="testSep",
October="testOct",
November="testNov",
December="testDec"
}--end of short month name translations
--END OF TRANSLATIONS
end--of translate tables function ####################################################
--END OF SCRIPT
Le conky "systeme"
# -- Conky settings -- #
background yes
update_interval 1
total_run_times 0
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
temperature_unit celsius
# -- Window specifications -- #
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 300 240
maximum_width 290
alignment top_right
gap_x 10
gap_y 250
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 8b8b8b
lua_load /home/seb/conky/v9000/v9000.lua
TEXT
${color whitesmoke}${font Helvetica LT Std :size=8:weight=bold}${goto 30}Process${goto 120}MEM${goto 185}CPU
${font Helvetica LT Std :size=8}${goto 30}${top name 1}${goto 115}${top mem 1}%${goto 180}${top cpu 1}%
${goto 30}${top name 2}${goto 115}${top mem 2}%${goto 180}${top cpu 2}%
${goto 30}${top name 3}${goto 115}${top mem 3}%${goto 180}${top cpu 3}%
${voffset 0}${font Helvetica LT Std :size=8}${goto 30}Machine:${goto 80}$nodename
${goto 30}Distro:${goto 80}${pre_exec cat /etc/issue.net}
${goto 30}Kernel:${goto 80}$kernel
${goto 30}CPU1:${goto 80}${freq_g 1}GHz${goto 145}CPU2:${goto 190}${freq_g 2}GHz
${goto 30}CPU3:${goto 80}${freq_g 3}GHz${goto 145}CPU4:${goto 190}${freq_g 4}GHz
${goto 30}Temp:${goto 80}${exec sensors|grep 'temp2'|awk '{print $2}'}
${goto 30}RAM: ${goto 70}${mem} / ${memmax}${goto 165}SWAP: ${goto 210}${swap} / ${swapmax}
${goto 30}Local IP:${goto 80}${addr wlan0}
${goto 30}Strength:${goto 80}${wireless_link_qual_perc wlan0}%${goto 120}${wireless_bitrate wlan0}
${image /home/seb/conky/.images/base.png -p 12,5 -s 280x230}
${image /home/seb/conky/.images/applications-system.png -p 230,0 -s 37x40}
Le conky "Agenda"
# -- Conky settings -- #
background no
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
short_units yes
# -- Window specifications -- #
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 300 150
maximum_width 300
alignment top_right
gap_x 5
gap_y 490
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 8b8b8b
override_utf8_locale yes
TEXT
${voffset -15}${font Helvetica LT Std :size=6:weight=bold}${color white}${goto 242}${time %b}
${voffset 2}${font Helvetica LT Std :size=14}${color 434343}${goto 238}${time %e}
${voffset -30}${font Helvetica LT Std :size=8}${color white}${execpi 10 /home/seb/conky/conkyscripts/conkyGoogleCalendar.py -u XXXXXXXXXXXXXXXX@gmail.com --limit=3 --dateformat="%a, %d %b" --timeformat="%H:%M" --indent=8 --nowho}
${image /home/seb/conky/.images/base.png -p 12,10 -s 280x135}
${image /home/seb/conky/.images/calendar-icon.png -p 230 0 -s 37x40}
La script python qui va bien avec :
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
###############################################################################
# conkyGoogleCalendar.py is a simple python script to output google calendar
# event details in conky.
#
# Author: Kaivalagi
# Created: 22/06/2008
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
from datetime import datetime, date, timedelta
from dateutil.relativedelta import *
from optparse import OptionParser
from xml.dom import minidom
from keyring import get_password
import socket
import gdata.calendar.service
import locale
import re
import textwrap
import urllib
import codecs
import traceback
import os
class CalendarData:
def __init__(self, title):
self.title = title
class CalendarEventData:
def __init__(self, title, starttime, endtime, location, description, who=None):
self.title = title
self.starttime = starttime
self.endtime = endtime
self.location = location
self.description = description
self.who = who
def __cmp__(self, other):
return cmp(self.starttime, other.starttime)
def __str__(self):
return str(self.starttime)
class CommandLineParser:
parser = None
def __init__(self):
self.parser = OptionParser()
self.parser.add_option("-u","--username", dest="username", type="string", metavar="USERNAME", help=u"Username for login into Google Calendar, this will normally be your gmail account")
self.parser.add_option("-p","--password",dest="password", type="string", metavar="PASSWORD", help=u"Password to login with, if not set the username is used to fetch a 'conky' password from the keyring")
self.parser.add_option("-r","--requestCalendarNames",dest="requestedCalendars", type="string", metavar="TEXT", help=u"Define a list of calendars to request event data for, calendar names should be separated by semi-colons \";\". For example --requestCalendarNames=\"cal1;cal2;other cal\" If not set all calendar data will be returned.")
self.parser.add_option("-d","--daysahead",dest="daysahead", default=7, type="int", metavar="NUMBER", help=u"[default: %default] Define the number of days ahead you wish to retrieve calendar entries for, starting from today.")
self.parser.add_option("-s","--startdate",dest="startdate", type="string", metavar="DATE", help=u"Define the start date to retrieve calendar events. In the form '2007-12-01'")
self.parser.add_option("-e","--enddate",dest="enddate", type="string", metavar="DATE", help=u"Define the end date to retrieve calendar events, must be supplied if --startdate supplied. In the form '2007-12-01'")
self.parser.add_option("-a","--allevents",dest="allevents", default=False, action="store_true", help=u"Retrieve all calendar events")
self.parser.add_option("-w","--wordsearch",dest="wordsearch", type="string", metavar="TEXT", help=u"Define the text to search calendar entries with.")
self.parser.add_option("-l","--limit",dest="limit", default=0, type="int", metavar="NUMBER", help=u"[default: %default] Define the maximum number of calendar events to display, zero means no limit.")
self.parser.add_option("-t","--template",dest="template", type="string", metavar="FILE", help=u"Template file determining the format for each event. Use the following placeholders: [title], [starttime], [endtime], [completetime], [duration], [location], [description], [who]. Ensure only one placeholder per line, as the whole line is removed if no data for that placeholder exists.")
self.parser.add_option("-f","--dateformat",dest="dateformat", default=None, type="string", metavar="\"DATEFORMAT\"", help=u"If used this overrides the default date formatting. The values to use are standard formatting strings e.g. Weekday=%a, Day=%d, Month=%m, Year=%y. For an output like \"Thu 15/10/2008\" you would require --dateformat=\"%a %d/%m/%y\", to have no date you would require --dateformat=\"\"")
self.parser.add_option("-F","--timeformat",dest="timeformat", default=None, type="string", metavar="\"TIMEFORMAT\"", help=u"If used this overrides the default time formatting. The values to use are standard formatting strings e.g. Hours (12hr)=%l, Hours (24hr)=%H, Minutes=%M, Seconds=%S, AM/PM=%P. For an output like \"05:22 PM\" you would require --timeformat=\"%l:%M %P\", --timeformat=\"\" is not supported, default locale settings are used")
self.parser.add_option("-i","--indent",dest="indent", default=0, type="int", metavar="NUMBER", help=u"[default: %default] Define the number of spaces to indent the output (excludes template based output)")
self.parser.add_option("-m","--maxwidth",dest="maxwidth", default=40, type="int", metavar="NUMBER", help=u"[default: %default] Define the number of characters to output per line")
self.parser.add_option("-n","--nowho",dest="nowho", default=False, action="store_true", help=u"Hides who is attending the events (excludes template based output)")
self.parser.add_option("-c","--connectiontimeout",dest="connectiontimeout", type="int", default=30, metavar="NUMBER", help=u"[default: %default] Define the number of seconds before a connection timeout can occur.")
self.parser.add_option("-v","--verbose",dest="verbose", default=False, action="store_true", help=u"Request verbose output, no a good idea when running through conky!")
self.parser.add_option("-V", "--version", dest="version", default=False, action="store_true", help=u"Displays the version of the script.")
self.parser.add_option("--errorlogfile", dest="errorlogfile", type="string", metavar="FILE", help=u"If a filepath is set, the script appends errors to the filepath.")
self.parser.add_option("--infologfile", dest="infologfile", type="string", metavar="FILE", help=u"If a filepath is set, the script appends info to the filepath.")
def parse_args(self):
(options, args) = self.parser.parse_args()
return (options, args)
def print_help(self):
return self.parser.print_help()
class GoogleCalendarInfo:
dateformat=""
timeformat=""
options = None
requestedCalendars = []
requiredCalendars = []
feedPrefix = 'https?://www.google.com/calendar/feeds/'
ACCESS_ALL = 'all' # non-google access level
ACCESS_DEFAULT = 'default' # non-google access level
ACCESS_NONE = 'none'
ACCESS_OWNER = 'owner'
ACCESS_EDITOR = 'editor'
ACCESS_CONTRIBUTOR = 'contributor'
ACCESS_READ = 'read'
ACCESS_FREEBUSY = 'freebusy'
################ GOOGLE CALENDAR FUNCTIONS ################################
def __init__(self, options):
try:
# store options for use throughout the class
self.options = options
# obtain a password from the keyring if none is set
if self.options.password == None:
self.logInfo("Attempting to obtain a password through the conky keyring as none was provided")
try:
password = get_password("conky", self.options.username)
except Exception, e:
self.logError("Failed to retrieve password from keyring:" + traceback.format_exc())
if password == None:
self.logError("No password was found in the conky keyring")
else:
self.options.password = password
self.logInfo("Initialising google calendar connection...")
socket.setdefaulttimeout(self.options.connectiontimeout)
self.cal_client = gdata.calendar.service.CalendarService()
self.cal_client.email = self.options.username
self.cal_client.password = self.options.password
self.cal_client.source = 'conkyGoogleCalendar'
self.cal_client.ProgrammaticLogin()
# load the format for date and time to use
self.getDatetimeFormat(self.options.dateformat, self.options.timeformat)
# prepare calendar list to use for event retrieval
self.getCalendarList()
except Exception,e:
self.logError("GoogleCalendarEngine Initialisation:Unexpected error:" + traceback.format_exc())
def getDatetimeFormat(self,dateformat=None,timeformat=None):
try:
# get locale defaults for output
locale.setlocale(locale.LC_ALL,'')
# format date based on format setting
if dateformat == None:
self.dateformat = "%a "+locale.nl_langinfo(locale.D_FMT)
elif dateformat == "":
self.dateformat = ""
else:
self.dateformat = dateformat
# format time based on format setting
if timeformat == None or timeformat == "":
self.timeformat = locale.nl_langinfo(locale.T_FMT)
else:
self.timeformat = timeformat
except Exception,e:
self.logError("getDatetimeFormat:Unexpected error:" + traceback.format_exc())
def getCalendarList(self):
self.logInfo("Preparing google calendar list...")
# prepare calendar list to retrieve
if self.options.requestedCalendars != None:
self.requestedCalendars = self.options.requestedCalendars.split(";")
# get the list of calendars from google
calendars = self.cal_client.GetAllCalendarsFeed()
order = { self.ACCESS_OWNER : 1,
self.ACCESS_EDITOR : 2,
self.ACCESS_CONTRIBUTOR : 3,
self.ACCESS_READ : 4,
self.ACCESS_FREEBUSY : 5,
self.ACCESS_NONE : 6 }
calendars.entry.sort(lambda x, y:
cmp(order[x.access_level.value],
order[y.access_level.value]))
# clear the list
self.requiredCalendars = []
for cal in calendars.entry:
cal.gcalcli_altLink = cal.GetAlternateLink().href
match = re.match('^' + self.feedPrefix + '(.*?)/(.*?)/(.*)$',cal.gcalcli_altLink)
cal.username = urllib.unquote(match.group(1))
cal.visibility = urllib.unquote(match.group(2))
cal.projection = urllib.unquote(match.group(3))
if len(self.requestedCalendars):
# get the calendar name, updating it if an override is found
calendarName = cal.title.text
doc = minidom.parseString(str(cal))
overrideName = doc.getElementsByTagNameNS(u'http://schemas.google.com/gCal/2005', 'overridename')
if len(overrideName) > 0:
calendarName = overrideName[0].getAttribute("value")
for rc in self.requestedCalendars:
if rc.lower() == calendarName.lower():
self.requiredCalendars.append(cal)
else:
self.requiredCalendars.append(cal)
def getOwnedCalendars(self):
try:
self.logInfo("Fetching owned calendars...")
feed = self.cal_client.GetOwnCalendarsFeed()
calendarDataList = []
for mycalendar in zip(xrange(len(feed.entry)), feed.entry):
calendarData = CalendarData(mycalendar.title.text)
calendarDataList.append(calendarData)
return calendarDataList
except Exception,e:
self.logError("getOwnedCalendars:Unexpected error:" + traceback.format_exc())
return []
def getAllEvents(self):
try:
self.logInfo("Fetching all event data...")
calendarDataEventList = []
for cal in self.requiredCalendars:
query = gdata.calendar.service.CalendarEventQuery(cal.username, cal.visibility, cal.projection)
feed = self.cal_client.CalendarQuery(query)
now = datetime.now()
for i, event in zip(xrange(len(feed.entry)), feed.entry):
for j, when in zip(xrange(len(event.when)), event.when):
for k, where in zip(xrange(len(event.where)), event.where):
# if the event's end time is after now then add it!
if self.getDatetimeFromWhen(when.end_time) > now:
whoList = []
for l, who in zip(xrange(len(event.who)), event.who):
whoList.append(who.email)
if len(whoList) == 0:
whoList = None
calendarDataEvent = CalendarEventData(event.title.text, when.start_time, when.end_time, where.value_string, event.content.text, whoList)
calendarDataEventList.append(calendarDataEvent)
return calendarDataEventList
except Exception,e:
self.logError("getAllEvents:Unexpected error:" + traceback.format_exc())
return []
def getTextQueryEvents(self, text_query='Project'):
try:
self.logInfo("Fetching text queried event data using text query of \"%s\"..."%text_query)
calendarDataEventList = []
for cal in self.requiredCalendars:
query = gdata.calendar.service.CalendarEventQuery(cal.username, cal.visibility, cal.projection, text_query)
query.orderby = 'starttime'
query.singleevents = 'true'
feed = self.cal_client.CalendarQuery(query)
now = datetime.now()
for i, event in zip(xrange(len(feed.entry)), feed.entry):
for j, when in zip(xrange(len(event.when)), event.when):
for k, where in zip(xrange(len(event.where)), event.where):
# if the event's end time is after now then add it!
if self.getDatetimeFromWhen(when.end_time) > now:
whoList = []
for l, who in zip(xrange(len(event.who)), event.who):
whoList.append(who.email)
if len(whoList) == 0:
whoList = None
calendarDataEvent = CalendarEventData(event.title.text, when.start_time, when.end_time, where.value_string, event.content.text, whoList)
calendarDataEventList.append(calendarDataEvent)
return calendarDataEventList
except Exception,e:
self.logError("getTextQueryEvents:Unexpected error:" + traceback.format_exc())
return []
def getDateRangedEvents(self, start_date='2007-01-01', end_date='2020-01-01'):
try:
self.logInfo("Fetching date ranged event data for dates between %s and %s..."%(start_date,end_date))
calendarDataEventList = []
for cal in self.requiredCalendars:
query = gdata.calendar.service.CalendarEventQuery(cal.username, cal.visibility, cal.projection)
query.start_min = start_date
query.start_max = end_date
query.orderby = 'starttime'
query.singleevents = 'true'
feed = self.cal_client.CalendarQuery(query)
for i, event in zip(xrange(len(feed.entry)), feed.entry):
for j, when in zip(xrange(len(event.when)), event.when):
for k, where in zip(xrange(len(event.where)), event.where):
whoList = []
for l, who in zip(xrange(len(event.who)), event.who):
whoList.append(who.email)
if len(whoList) == 0:
whoList = None
calendarDataEvent = CalendarEventData(event.title.text, when.start_time, when.end_time, where.value_string, event.content.text, whoList)
calendarDataEventList.append(calendarDataEvent)
return calendarDataEventList
except Exception,e:
self.logError("getDateRangedEvents:Unexpected error:" + traceback.format_exc())
return []
def getFutureEvents(self, days_ahead=7):
try:
self.logInfo("Fetching future event data, for the next %s days..."%days_ahead)
calendarDataEventList = []
for cal in self.requiredCalendars:
query = gdata.calendar.service.CalendarEventQuery(cal.username, cal.visibility, cal.projection)
query.start_min = str(date.today())
query.start_max = str(date.today()+timedelta(days=days_ahead))
query.orderby = 'starttime'
query.singleevents = 'true'
feed = self.cal_client.CalendarQuery(query)
now = datetime.now()
for i, event in zip(xrange(len(feed.entry)), feed.entry):
for j, when in zip(xrange(len(event.when)), event.when):
for k, where in zip(xrange(len(event.where)), event.where):
# if the event's end time is after now then add it!
if self.getDatetimeFromWhen(when.end_time) > now:
whoList = []
for l, who in zip(xrange(len(event.who)), event.who):
whoList.append(who.email)
if len(whoList) == 0:
whoList = None
calendarDataEvent = CalendarEventData(event.title.text, when.start_time, when.end_time, where.value_string, event.content.text, whoList)
calendarDataEventList.append(calendarDataEvent)
return calendarDataEventList
except Exception,e:
self.logError("getFutureEvents:Unexpected error:" + traceback.format_exc())
return []
def getDuration(self, starttime, endtime):
if endtime > starttime:
rdelta = relativedelta(endtime, starttime)
else:
endtime = endtime + timedelta(days=+1)
rdelta = relativedelta(endtime, starttime)
output = u""
if rdelta.days > 0:
if rdelta.days == 1:
suffix = " day "
else:
suffix = " days "
output = output + str(rdelta.days) + suffix
if rdelta.hours > 0:
if rdelta.hours == 1:
suffix = " hr "
else:
suffix = " hrs "
output = output + str(rdelta.hours) + suffix
if rdelta.minutes > 0:
if rdelta.minutes == 1:
suffix = " min "
else:
suffix = " mins "
output = output + str(rdelta.minutes) + suffix
return output
def getFormattedEventTimes(self, starttime, endtime):
datematch = (datetime.strftime(starttime, self.dateformat) == datetime.strftime(endtime, self.dateformat))
timematch = (datetime.strftime(starttime, self.timeformat) == datetime.strftime(endtime, self.timeformat))
if datematch == True:
if timematch == True:
completetime = self.getDatetimeString(starttime)
duration = ""
else:
completetime = "Le %s à %s"%(self.getDatetimeString(starttime), datetime.strftime(endtime, self.timeformat))
duration = "Pendant %s"%self.getDuration(starttime, endtime)
else:
if timematch == True:
if starttime.hour == 0 and endtime.hour == 0 and (endtime - starttime == timedelta(days=1)):
completetime = datetime.strftime(starttime, self.dateformat)
duration = "Pendant %s"%self.getDuration(starttime, endtime)
else:
completetime = "Du %s au %s"%(self.getDatetimeString(starttime), datetime.strftime(endtime, self.dateformat))
duration = "Pendant %s"%self.getDuration(starttime, endtime)
else:
completetime = "%s à %s"%(self.getDatetimeString(starttime), self.getDatetimeString(endtime))
duration = "Pendant %s"%self.getDuration(starttime, endtime)
if starttime.hour == 0 and endtime.hour == 0:
starttime = datetime.strftime(starttime, self.dateformat)
endtime = datetime.strftime(endtime, self.dateformat)
else:
starttime = self.getDatetimeString(starttime)
endtime = self.getDatetimeString(endtime)
return starttime, endtime, completetime, duration
def getDatetimeString(self,whendatetime, format=None):
try:
# is this a datetime or just date field
if whendatetime.year != 1900:
dateandtime = True
else:
dateandtime = False
if dateandtime == True:
if self.dateformat == "":
whendatetime = whendatetime.strftime(self.timeformat)
else:
whendatetime = whendatetime.strftime(self.dateformat + " " + self.timeformat)
else:
if self.dateformat == "": # if no formating but only required to show date we need then revert to default!
whendatetime = whendatetime.strftime(locale.nl_langinfo(locale.D_FMT))
else:
whendatetime = whendatetime.strftime(self.dateformat)
# remove excess space between date and time if necessary
whendatetime = whendatetime.replace(" "," ")
return whendatetime
except Exception,e:
self.logError("getDatetimeString:Unexpected error:" + traceback.format_exc)
def getDatetimeFromWhen(self, when):
try:
# is this a datetime or just date field
if len(when) > 10:
dateandtime = True
else:
dateandtime = False
# convert to datetime field
if dateandtime == True:
whendatetime = datetime.strptime(when[0:19], "%Y-%m-%dT%H:%M:%S")
else:
whendatetime = datetime.strptime(when[0:10], "%Y-%m-%d")
return whendatetime
except Exception,e:
self.logError("getDatetimeFromWhen:Unexpected error:" + traceback.format_exc)
def removeLineByString(self,lines,string):
# define list from multiple lines, to allow remove function
lineslist = lines.split("\n")
lineslistchanged = False
for line in lineslist:
if line.find(string) <> -1:
lineslist.remove(line)
lineslistchanged = True
break
if lineslistchanged == True:
# rebuild lines string from updated list
lines = "\n".join(lineslist)
return lines
def getSpaces(self,spaces):
string = ""
for i in range(0, spaces+1):
string = string + " "
return string
def getWrappedText(self,text,width=40,indent=0):
if len(text) > width:
indentspace = "".ljust(indent)
wrappedtext=""
for line in textwrap.wrap(text,width=(width-indent),expand_tabs=False,replace_whitespace=False):
wrappedtext = wrappedtext + line + "\n" + indentspace
return wrappedtext.rstrip("\n ")
else:
return text
def logInfo(self, text):
if self.options.verbose == True:
print >> sys.stdout, "INFO: " + text
if self.options.infologfile != None:
datetimestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
fileoutput = open(self.options.infologfile, "ab")
fileoutput.write(datetimestamp+" INFO: "+text+"\n")
fileoutput.close()
def logError(self, text):
print >> sys.stderr, "ERROR: " + text
if self.options.errorlogfile != None:
datetimestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
fileoutput = open(self.options.errorlogfile, "ab")
fileoutput.write(datetimestamp+" ERROR: "+text+"\n")
fileoutput.close()
def getMadeSafeOutput(self, text):
return text.replace("${exec","${!noexec!")
def getOutputFromTemplate(self, template, title, starttime, endtime, location, description, who):
try:
output = template
if title == None or title.strip() == "":
output = self.removeLineByString(output,"[title]")
else:
output = output.replace("[title]",title)
if location == None or location.strip() == "":
output = self.removeLineByString(output,"[location]")
else:
output = output.replace("[location]",location)
if description == None or description.strip() == "":
output = self.removeLineByString(output,"[description]")
else:
output = output.replace("[description]",description)
if who == None or who.strip() == "":
output = self.removeLineByString(output,"[who]")
else:
#output = output.replace("[who]",";".join(who))
output = output.replace("[who]",who)
starttime, endtime, completetime, duration = self.getFormattedEventTimes(starttime, endtime)
output = output.replace("[starttime]",starttime)
output = output.replace("[endtime]",endtime)
if output.find("[completetime]") != -1:
output = output.replace("[completetime]",completetime)
if output.find("[duration]") != -1:
output = output.replace("[duration]",duration)
# get rid of any excess crlf's and add just one
#output = output.rstrip(" \n")
#output = output + "\n"
return output
except Exception,e:
self.logError("getOutputFromTemplate:Unexpected error:" + traceback.format_exc())
return ""
def writeOutput(self):
try:
################ GOOGLE CALENDAR DATA RETRIEVAL #########################
# determine the required query and run it
if self.options.wordsearch != None:
calendarEventDataList = self.getTextQueryEvents(self.options.wordsearch)
elif self.options.startdate != None:
if self.options.enddate != None:
calendarEventDataList = self.getDateRangedEvents(self.options.startdate,self.options.enddate)
else:
print >> sys.stdout, "--startdate provided with no --enddate."
self.parser.print_help()
elif self.options.allevents == True:
calendarEventDataList = self.getAllEvents()
else:
calendarEventDataList = self.getFutureEvents(self.options.daysahead)
################ PREPARE FOR OUTPUT ##############################
self.logInfo("Processing output...")
if self.options.template == None:
# get the indent spacing sorted out
if self.options.indent > 0:
indent = self.getSpaces(self.options.indent)
else:
indent = ""
# create default template
template = indent+"[title]\n" + indent + "[completetime]\n" + indent + "Lieu: [location]\n" + indent + "\"[description]\"\n" + indent + "Avec [who]\n"
else:
# load the template file contents
try:
fileinput = codecs.open(os.path.expanduser(self.options.template), encoding='utf-8')
template = fileinput.read()
fileinput.close()
# lose the final "\n" which should always be there...
template = template[0:len(template)-1]
except:
self.logError("Template file no found!")
sys.exit(2)
################ PROCESS OUTPUT #########################################
calendarEventCount = 0
calendarEventDataList.sort()
if len(calendarEventDataList) > 0:
# walk through the calendar events
for calendarEventData in calendarEventDataList:
# keep a tally of events output, if past the limit then exit
if self.options.limit <> 0:
calendarEventCount = calendarEventCount+1
if calendarEventCount > self.options.limit:
sys.exit()
# collect calendar event data and format as we go
title = calendarEventData.title
starttime = self.getDatetimeFromWhen(calendarEventData.starttime)
endtime = self.getDatetimeFromWhen(calendarEventData.endtime)
location = calendarEventData.location
if location <> None:
#location = self.getWrappedText(location, self.options.maxwidth, indent)
if len(location) > self.options.maxwidth:
location = location[0:self.options.maxwidth].replace("\n","")+"..."
description = calendarEventData.description
if description <> None:
#description = self.getWrappedText(description, self.options.maxwidth, indent)
if len(description) > self.options.maxwidth:
description = description[0:self.options.maxwidth].replace("\n","")+"..."
who = calendarEventData.who
if who != None:
if self.options.nowho == True:
who = None
else:
who = ";".join(who)+";"
who = re.sub("@.*?;",", ",who).rstrip(", ")
if len(who) > self.options.maxwidth:
who = who[0:self.options.maxwidth]+"..."
#who = ";".join(who).replace(";",", ")
#who = self.getWrappedText(who, self.options.maxwidth, indent)
# output event data using the template
output = self.getOutputFromTemplate(template, title, starttime, endtime, location, description, who)
output = self.getMadeSafeOutput(output)
print output.decode("utf-8")
else:
self.logInfo("Aucun RDV...")
except Exception,e:
self.logError("writeOutput:Unexpected error:" + traceback.format_exc())
def main():
"""Runs the conkyGoogleCalendar application with the provided username and
and password values. Authentication credentials are required."""
################ COMMAND LINE ARGUMENTS #################################
parser = CommandLineParser()
(options, args) = parser.parse_args()
if options.version == True:
print >> sys.stdout,"conkyGoogleCalendar v.2.16"
else:
if options.username == None:
print >> sys.stdout, "A username was not given!"
sys.exit(2)
if options.verbose == True:
print >> sys.stdout, "*** INITIAL OPTIONS:"
print >> sys.stdout, " username:",options.username
print >> sys.stdout, " password:",options.password
print >> sys.stdout, " daysahead:",options.daysahead
print >> sys.stdout, " startdate:",options.startdate
print >> sys.stdout, " enddate:",options.enddate
print >> sys.stdout, " allevents:",options.allevents
print >> sys.stdout, " wordsearch:",options.wordsearch
print >> sys.stdout, " limit:",options.limit
print >> sys.stdout, " template:",options.template
print >> sys.stdout, " dateformat:",options.dateformat
print >> sys.stdout, " indent:",options.indent
print >> sys.stdout, " nowho:",options.nowho
print >> sys.stdout, " verbose:",options.verbose
print >> sys.stdout, " errorlogfile:",options.errorlogfile
print >> sys.stdout, " infologfile:",options.infologfile
googlecalendarinfo = GoogleCalendarInfo(options)
googlecalendarinfo.writeOutput()
if __name__ == '__main__':
main()
sys.exit()
Enfin le conkyrc "Mail"
# -- Conky settings -- #
background no
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
short_units yes
# -- Window specifications -- #
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 300 120
maximum_width 305
alignment top_right
gap_x 5
gap_y 640
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 8b8b8b
TEXT
${font Helvetica LT Std :size=8}${color white}
${voffset -15}${goto 30}M@il: ${execpi 30 python ~/conky/conkyscripts/gmail_parser.py XXXXXXXXXXXXX@gmail.com YYYYYYYY 3 30}
${image /home/seb/conky/.images/base.png -p 12,5 -s 280x105}
${image /home/seb/conky/.images/email.png -p 230,0 -s 37x40}
et le script python qui va bien :
#!/usr/bin/env python
## -*- coding: utf-8 -*-
## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky
# ======================================================================
# Copyright (C) 2006 Baishampayan Ghose <b.ghose@ubuntu.com>
# Modified 2008 Hunter Loftis <hbloftis@uncc.edu>
# Time-stamp: Mon Jul 31, 2006 20:45+0530
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
# ======================================================================
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
import urllib # For BasicHTTPAuthentication
import feedparser # For parsing the feed
from textwrap import wrap
_URL = "https://mail.google.com/gmail/feed/atom"
uname = sys.argv[1]
password = sys.argv[2]
maxlen = sys.argv[3]
Nbcar = 30
urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password)
def auth():
'''The method to do HTTPBasicAuthentication'''
opener = urllib.FancyURLopener()
f = opener.open(_URL)
feed = f.read()
return feed
def readmail(feed, maxlen):
'''Parse the Atom feed and print a summary'''
atom = feedparser.parse(feed)
print '${color1} %s email(s) non lu(s)\n' % (len(atom.entries))
for i in range(min(len(atom.entries), maxlen)):
print ' ${color2}%s... :' % atom.entries[i].author[:Nbcar]
print ' ${color2} - %s...' % atom.entries[i].title[:Nbcar]
#uncomment the following line if you want to show the name of the sender
if len(atom.entries) > maxlen:
print ' ${color2} ...'
if __name__ == "__main__":
f = auth() # Do auth and then get the feed
readmail(f, int(maxlen)) # Let the feed be chewed by feedparser
et celui-ci semble necessaisre au fonctionnement de Conky "googleAgenda"
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
###############################################################################
# conkyKeyring.py is a simple python script to store/edit/delete passwords
# for use in the conky scripts that utilise stored passwords
#
# Author: Kaivalagi
# Created: 26/02/2011
from keyring import get_password, set_password
from datetime import datetime
from optparse import OptionParser
import sys
import codecs
import os
class CommandLineParser:
parser = None
def __init__(self):
self.parser = OptionParser()
self.parser.add_option("-u", "--username", dest="username", type="string", metavar="USERNAME", help=u"The username where the password will be stored against, this is usually an email address or other account identifier which is used for login purposes")
self.parser.add_option("-p", "--password", dest="password", type="string", metavar="PASSWORD", help=u"The password to be stored safely, leave unset to retrieve the password")
self.parser.add_option("-d", "--delete", dest="delete", default=False, action="store_true", help=u"If set the password associated with the username given is deleted")
self.parser.add_option("-v", "--verbose", dest="verbose", default=False, action="store_true", help=u"Request verbose output, not a good idea when running through conky!")
self.parser.add_option("-V", "--version", dest="version", default=False, action="store_true", help=u"Displays the version of the script.")
self.parser.add_option("--errorlogfile", dest="errorlogfile", type="string", metavar="FILE", help=u"If a filepath is set, the script appends errors to the filepath.")
self.parser.add_option("--infologfile", dest="infologfile", type="string", metavar="FILE", help=u"If a filepath is set, the script appends info to the filepath.")
def parse_args(self):
(options, args) = self.parser.parse_args()
return (options, args)
def print_help(self):
return self.parser.print_help()
class Keyring:
options = None
def __init__(self,options):
self.options = options
def ApplyKeyringOperations(self):
try:
if self.options.username == None:
self.logError("A username must be set for any keyring operations to be made")
return
if self.options.delete == True:
self.logInfo("Clearing password for "+self.options.username)
set_password("conky", self.options.username, "")
else:
if self.options.password != None:
self.logInfo("Storing password for "+self.options.username)
set_password("conky", self.options.username, self.options.password)
else:
self.logInfo("Retrieving password for "+self.options.username)
password = get_password("conky", self.options.username)
if password != None:
print password
else:
self.logInfo("Password not found!")
except Exception, e:
self.logError("ApplyKeyringOperations error:" + e.__str__())
def logInfo(self, text):
if self.options.verbose == True:
print >> sys.stdout, "INFO: " + text
if self.options.infologfile != None:
datetimestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
fileoutput = open(self.options.infologfile, "ab")
fileoutput.write(datetimestamp+" INFO: "+text+"\n")
fileoutput.close()
def logError(self, text):
print >> sys.stderr, "ERROR: " + text
if self.options.errorlogfile != None:
datetimestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
fileoutput = open(self.options.errorlogfile, "ab")
fileoutput.write(datetimestamp+" ERROR: "+text+"\n")
fileoutput.close()
if __name__ == "__main__":
parser = CommandLineParser()
(options, args) = parser.parse_args()
if options.version == True:
print >> sys.stdout,"conkyKeyring v.1.01"
else:
if options.verbose == True:
print >> sys.stdout, "*** INITIAL OPTIONS:"
print >> sys.stdout, " username:", options.username
print >> sys.stdout, " password:", options.password
print >> sys.stdout, " delete:", options.delete
print >> sys.stdout, " verbose:", options.verbose
print >> sys.stdout, " errorlogfile:",options.errorlogfile
print >> sys.stdout, " infologfile:",options.infologfile
keyring = Keyring(options)
keyring.ApplyKeyringOperations()
Pensez a changer les XXXXX@gmail.com (Adresse mail) et les YYYYYY (Mdp) dans les scripts pour les adapter avec vos adresses et mdp.
J'utilise aussi le script "Saints" que j'ai outrageusement piqué sur la page d'avant..... :-))
Voila,
Jusqu'a la prochaine......
Dernière modification par los_tintinos (Le 19/07/2012, à 15:47)
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1630 Le 19/07/2012, à 16:06
- Didier-T
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
@ los_tintinos,
Pour la météo, tu peut regarder le lien dans ma signature, c'est pour les francophones uniquement, mais c'est ce que tu cherche, du moins il me semble.
Hors ligne
#1631 Le 19/07/2012, à 19:15
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Je vais étudier ca mais comme on dit chez moi, "si ca marche, tu touche pas..." mais comme j'ai pas encore tout ce que jeu veux.
Mais j'ai telecharger tout deja mais pas encore eu le temps de lancer le binz. Je vais tenter de mettre ca a ma sauce pour avoir au moins les villes et le conkyclics actif. Je vais repasser une petite soirée la dessus...
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1632 Le 21/07/2012, à 22:58
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
bon j'ai modifier la meteo de didier pour l'adapter a mes besoins.
Je merde encore avec les clicks, je cherche encore avant d'appeler à l'aide ;-))
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1633 Le 22/07/2012, à 10:31
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Salut,
J'ai un big probléme avec l'affiche de mes conky. Tant que je bosser dessus je ne m'en suis pas apercus mais à l'usage du pc j'ai un bléme avec la taille des fenetre. Celles-ci sont trop haute. Du coup elles se chevauchent les unes sur les autres. Je pensais avoir regler le probléme avec le script de demarrage qui attend entre chaque lancement de conky. mais si je clique sur l'un d'eux, il me chevauche les autres. J'ai tenté de jouer avec les own-windows en les passant à destop, normal ou override. Les conky ne se chevauche plus mais disparaissent du bureau si je les laisse en desktop....
Je ne trouve aucun commande gerant la hauteur de la fenetre d'un conky.
Enfin si je met tout mes conky dans un seul, la hauteur est telle que mon dock disparait, celui-ci etant regler pour ne pas passer au dessus des autres fenetre. J4ai vu qu'en mode fenetré je pouvez modifier a la main la hauteur de la fenetre mais que cela n'était pas permanent...
Avez vous une idée???
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1634 Le 22/07/2012, à 10:48
- ljere
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
ben le reglage ce fait avec ces lignes ci (si j'ai bien compris ton problème)
minimum_size 300 150
maximum_width 300
alignment top_right
gap_x 5
gap_y 490
ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon
Hors ligne
#1635 Le 22/07/2012, à 12:37
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
salut,
Non mon problème c'est que les fenetres conky sont trop hautes. J'ai un espace vide sous les textes qui empiete sur les autres fenetres conky. Il semble que conky est etait concus pour etre utilisé en mode "horintale" et on en mode "verticale". Il n'existe, a prpiori, aucun reglage pour la hauteur maximale des fenetre (maximale_height par exemple serait pas mal...).
J'ai fait une capture d'écran où on voit bien la taille des fenetres. J'ai mis en transparence "no" et j'ai decalé les fenetres. Dans cet exemple, si je clique sur la meteo, la partie noire sous la meteo passe par-dessus ma partie agenda...
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1636 Le 22/07/2012, à 12:54
- kurapika29
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Tu veux tronqer le conky en bas O_O
Conky affiche ce que tu lui demande c'est tout, pour réduire la taille faut changé la taille de la police ou de tes images.
Disponible sur IRC, sur le serveur irc.freenode.net salon ##ubuntu-voyager (et aussi sur plein d'autre serveur/salon)
Venez si vous avec besoin d'aide ou pour causer ;) suffit d'avoir Xchat ou un autre client IRC
Où sinon en cliquant sur se lien http://kiwiirc.com/client/irc.freenode. … tu-voyager
Hors ligne
#1637 Le 22/07/2012, à 13:37
- ljere
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
si c'est bien ce que je dis c'est à toi de régler ta position et tes dimensions et regler aussi tes images comme le dit kura
ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon
Hors ligne
#1638 Le 22/07/2012, à 15:34
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Salut,
moi je veux bien regler la taille en hauteur mais dans la mesure ou il n' a aucune commande pour le faire, comment c'est t'y qu'on fait....
Voila les reglages de mon conky meteo. Je vois pas comment reduire la hauteur de ce conky. Est-ce le nombre de ligne de la partie TEXT qui fait la hauteur du conky ? si oui je suis en train de reduire le nombre de ligne en mettant à la suite nombre d'info et en jouant avec les goto et voffset pour mettre en place le tout.
# -- Conky settings -- #
background no
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
short_units yes
# -- Window specifications -- #
own_window yes
own_window_title htc
own_window_type normal
own_window_transparent no
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 5
border_outer_margin 0
minimum_size 100 100
maximum_width 460
alignment tr
gap_x 5
gap_y 8
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 8b8b8b
# -- Déclaration template -- #
template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
template2 ${lua_parse Meteo_\1 \2 \3 \4 60 \5} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #
lua_load /home/seb/meteo.lua
lua_startup_hook init /home/seb/meteo.cfg
ceci est la partie TEXT mais qui n'est pas encore compement remanié pour reduire le nombre de ligne.
TEXT
${template1 Maj}
${voffset -5}${font Helvetica LT Std :style=Condensed:size=60}${color 434343}${goto 45}${time %H}${goto 145}${time %M}${font Helvetica LT Std :size=15:style=condensed}${voffset -45}${color whitesmoke}${font Helvetica LT Std :size=12}${goto 240}${time %A}, ${time %e} ${time %B} ${time %G}${color1}${font Helvetica LT Std :size=10}${voffset 10}${goto 250}Aujourd'hui St. ${color1}${font Helvetica LT Std :size=10}${exec /home/seb/conky/conkyscripts/Saints}${voffset 50}${goto 230}${color white}${template1 Ville} : ${template1 CondMeteo} / ${if_match ${template1 TempAct}<5}${color lightblue}${blink ${temp}late1 TempAct}°}${else}${color white}${template1 TempAct}°C${endif}${goto 235}${voffset -30}Pluie : ${template1 QPrec 1}%
${voffset -20}${color white}${font Helvetica LT Std:style=Bold:size=8}${goto 380}Vent :${template1 VentForce} km/h
${voffset 2}${color white}${font Helvetica LT Std:style=Bold:size=8}${alignr}${template1 VentDirP}
${voffset 8}${color white}${font Helvetica LT Std:style=Bold:size=8}${goto 60}Dernière mise à jour à ${template1 Heure}h${template1 Minute}
${image /home/seb/conky/.images/base.png -p 12,30 -s 450x100}
${image /home/seb/conky/.images/flip_bg.png -p 30,10 -s 100x110}
${image /home/seb/conky/.images/flip_bg.png -p 130,10 -s 100x110}
${template2 IconeM /home/seb/icones 275,65 100x60}
${voffset -40}${font Helvetica LT Std :size=9}${color4}${goto 40}${template1 Jour %a 2}${goto 115}${template1 Jour %a 3}${goto 190}${template1 Jour %a 4}${goto 265}${template1 Jour %a 5}${goto 340}${template1 Jour %a 6}${goto 415}${template1 Jour %a 7}
${font Ubuntu :size=8:style=bold}${color ffe595}${goto 40}${voffset 37}${template1 Jour_VentForce 2}${font Ubuntu :size=6:style=bold} km/h${goto 115}${voffset -2}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 3}${font Ubuntu :size=6:style=bold} km/h${goto 190}${voffset -2}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 4}${font Ubuntu :size=6:style=bold} km/h${goto 265}${voffset -2}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 5}${font Ubuntu :size=6:style=bold} km/h${font Ubuntu :size=8:style=bold}${color ffe595}${goto 340}${voffset -2}${template1 Jour_VentForce 6}${font Ubuntu :size=6:style=bold} km/h${font Ubuntu :size=8:style=bold}${color ffe595}${goto 415}${voffset -2}${template1 Jour_VentForce 7}${font Ubuntu :size=6:style=bold} km/h
${voffset 0}${goto 37}${font Ubuntu :size=8:style=bold}${color red}${template1 Jour_Temp 2}°${color white}/${color lightblue}${template1 Nuit_Temp 2}°${goto 115}${color red}${template1 Jour_Temp 3}°${color white}/${color lightblue}${template1 Nuit_Temp 3}°${goto 190}${color red}${template1 Jour_Temp 4}°${color white}/${color lightblue}${template1 Nuit_Temp 4}°${goto 265}${color red}${template1 Jour_Temp 5}°${color white}/${color lightblue}${template1 Nuit_Temp 5}°${goto 340}${color red}${template1 Jour_Temp 6}°${color white}/${color lightblue}${template1 Nuit_Temp 6}°${goto 415}${color red}${template1 Jour_Temp 7}°${color white}/${color lightblue}${template1 Nuit_Temp 7}°${image /home/seb/conky/.images/base.png -p 12,135 -s 450x80}
${template2 AM_IconeM /home/seb/icones 10,150 86x52 2}${template2 AM_IconeM /home/seb/icones 85,150 86x52 3}${template2 AM_IconeM /home/seb/icones160,150 86x52 4}${template2 AM_IconeM /home/seb/icones 235,150 86x52 5}${template2 AM_IconeM /home/seb/icones 310,150 86x52 6}${template2 AM_IconeM /home/seb/icones 385,150 86x52 7}
${voffset -60}${color whitesmoke}${font Helvetica LT Std :size=8:weight=bold}${goto 215}Identité
${color whitesmoke}${font Helvetica LT Std :size=8}${goto 215}Machine:${goto 270}$nodename
${goto 215}Distro:${goto 270}${pre_exec cat /etc/issue.net}
${goto 215}Kernel:${goto 270}$kernel
${voffset 10}${color whitesmoke}${font Helvetica LT Std :size=8:weight=bold}${goto 215}Process${goto 310}MEM${goto 370}CPU
${font Helvetica LT Std :size=8}${goto 215}${top name 1}${goto 300}${top mem 1}%${goto 360}${top cpu 1}%
${goto 215}${top name 2}${goto 300}${top mem 2}%${goto 360}${top cpu 2}%
${goto 215}${top name 3}${goto 300}${top mem 3}%${goto 360}${top cpu 3}%
${voffset 10}${goto 215}CPU1:${goto 270}${freq_g 1}GHz${goto 375}CPU2:${goto 420}${freq_g 2}GHz
${goto 215}CPU3:${goto 270}${freq_g 3}GHz${goto 375}CPU4:${goto 420}${freq_g 4}GHz
${voffset 10}${goto 215}Temp:${goto 270}${exec sensors|grep 'temp2'|awk '{print $2}'}
${goto 215}RAM: ${goto 270}${mem} / ${memmax}${goto 350}SWAP: ${goto 400}${swap} / ${swapmax}
${voffset 10}${goto 215}Local IP:${goto 270}${addr wlan0}
${goto 215}Strength:${goto 280}${wireless_link_qual_perc wlan0}%${goto 320}${wireless_bitrate wlan0}
${image /home/seb/conky/.images/base.png -p 200,230 -s 260x230}${image /home/seb/conky/.images/applications-system.png -p 400,225 -s 37x40}
et voila ou çà en est pour le moment c'est un peu le bordel car je bidouille pour replacer tout ça a sa place. Ce que je cherche à enlever c'est toute la partie noir sous le cadre "systeme". J'ai rien fait pour demander ca (enfin pas consciemment...), ou alors c'est un des scripts meteo qui le fait, mais je vois pas trop où, c'est la meteo de DidierT que je remanier pour l'afficher comme ça mais je n'ai touché qu'au conkyrc pas au reste.
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1639 Le 22/07/2012, à 16:27
- kurapika29
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Test pour voir
minimum-size 100 0
Et pour le carré noir après je pense que le problème et là
own_window_transparent no
Disponible sur IRC, sur le serveur irc.freenode.net salon ##ubuntu-voyager (et aussi sur plein d'autre serveur/salon)
Venez si vous avec besoin d'aide ou pour causer ;) suffit d'avoir Xchat ou un autre client IRC
Où sinon en cliquant sur se lien http://kiwiirc.com/client/irc.freenode. … tu-voyager
Hors ligne
#1640 Le 22/07/2012, à 17:29
- Didier-T
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
@ los_tintinos,
Ce que tu peut faire c'est definir la taille maxi de ton conky
Maximum_size xx yy
Il me semble verifi dans la doc
Hors ligne
#1641 Le 22/07/2012, à 19:15
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
salut,
Pour la transparence à "no" c'est fait exprès. C'est ce qui me permet de voir la taille du conky. Dans les page precedente, elle etait bien à yes mais etant un pseudo transparance cela mecaché les autres conky en dessous... J'ai tenté une autre commande de transparence mais c'est tout qui devient transparant, a priori ça joue sur l'alpha dans l'ensemble du conky.
Pour la "minimum size", j'ai deja tenté sans succés de mettre à 0 l'axe y.
Je vais tenté la maximum size mais je n'ai jamais vu dans les docs de conky et je crois avoir deja tenté.
Je vais reconstruire complement mon conkyrc pour voir...
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1642 Le 22/07/2012, à 19:23
- kurapika29
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Ah ok bah voit avec ton script qui lance tout tes conky rajoute un sleep 2 par exemple entre chaque et mets les dans l'ordre pour que ça se chevauche dans le bon sens au pire
Disponible sur IRC, sur le serveur irc.freenode.net salon ##ubuntu-voyager (et aussi sur plein d'autre serveur/salon)
Venez si vous avec besoin d'aide ou pour causer ;) suffit d'avoir Xchat ou un autre client IRC
Où sinon en cliquant sur se lien http://kiwiirc.com/client/irc.freenode. … tu-voyager
Hors ligne
#1643 Le 22/07/2012, à 19:50
- ljere
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
en effet je viens de relire ton conky ce n'est pas les réglages qui joueront mais bien la taille des images dans conkyrc
ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon
Hors ligne
#1644 Le 22/07/2012, à 23:09
- los_tintinos
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
salut,
Bon je vient de refaire entierement le conky et je n'ai plus cette espace en dessous...
J'avais déjà fait un lanceur avec des sleep qui evitaient les chevauchements mais si je cliquais sur un des conky, il prenait la main sur les autres. A priori c'est regler maintenant.
Voici la partie meteo nouvelle formule
# -- 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
# -- Window specifications -- #
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 450 250
maximum_width 455
alignment tr
gap_x 0
gap_y -10
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 8b8b8b
# -- Déclaration template -- #
template0 ${image /home/seb/conky/images/\1 -p \2 -s \3} # -- images fond -- #
template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
template2 ${lua_parse Meteo_\1 \2 \3 \4 60 \5} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
template3 ${lua Lune_\1}
template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #
lua_load /home/seb/conky/meteo.lua
lua_startup_hook init /home/seb/conky/meteo.cfg
TEXT
#### Lancement du script récupérant les données météo ####
${template1 Maj}
#### Premier cadre ####
##### Heure #####
${voffset -16}${font LED_mono :style=Medium:size=60}${color 434343}${goto 30}${time %H}${goto 140}${time %M}${font LED_mono :size=25:style=Medium}${color 808080}${goto 235}
##### Heure mise à jour #####
${voffset 0}${color white}${font Helvetica LT Std :size=8}${goto 80}Dernière mise à jour : ${template1 Heure}h${template1 Minute}
##### Date et Saints du jour #####
${voffset -70}${color white}${font Helvetica LT Std :size=12:style=Bold}${goto 250}${exec date "+%A %d %B %Y"|sed 's/^.\| [a-z]/\U&/g'}
${color1}${font Helvetica LT Std :size=10}${goto 250}Aujourd'hui St. ${color1}${font Helvetica LT Std :size=10}${exec /home/seb/conky/conkyscripts/Saints}
##### Affichage infos vent ######
${color white}${font Helvetica LT Std:style=Bold:size=10}${goto 350}Direction:${template1 VentDirP}
${color white}${font Helvetica LT Std:style=Bold:size=10}${goto 350}Vitesse:${template1 VentForce} km/h
##### ville #####
${voffset 10}${alignc}${font Helvetica LT Std :size=10 style:bold}${color white}${template1 Ville} : ${font Helvetica LT Std :size=10}${color white}${template1 CondMeteo}${font Helvetica LT Std :size=10} / ${template1 TempAct}°C
##### Affichage temperature #####
${voffset 0}${goto 32}${font Ubuntu :size=8:style=bold}${color red}${template1 Jour_Temp 2}°${color white}/${color lightblue}${template1 Nuit_Temp 2}°${goto 110}${color red}${template1 Jour_Temp 3}°${color white}/${color lightblue}${template1 Nuit_Temp 3}°${goto 185}${color red}${template1 Jour_Temp 4}°${color white}/${color lightblue}${template1 Nuit_Temp 4}°${goto 260}${color red}${template1 Jour_Temp 5}°${color white}/${color lightblue}${template1 Nuit_Temp 5}°${goto 335}${color red}${template1 Jour_Temp 6}°${color white}/${color lightblue}${template1 Nuit_Temp 6}°${goto 410}${color red}${template1 Jour_Temp 7}°${color white}/${color lightblue}${template1 Nuit_Temp 7}°
##### Affichage vitesse du vent #####
${font Ubuntu :size=8:style=bold}${color white}${goto 35}${voffset 37}${template1 Jour_VentForce 2}${font Ubuntu :size=6:style=bold} km/h${goto 110}${voffset -2}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 3}${font Ubuntu :size=6:style=bold} km/h${goto 185}${voffset -2}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 4}${font Ubuntu :size=6:style=bold} km/h${goto 260}${voffset -2}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 5}${font Ubuntu :size=6:style=bold} km/h${font Ubuntu :size=8:style=bold}${goto 335}${voffset -2}${template1 Jour_VentForce 6}${font Ubuntu :size=6:style=bold} km/h${font Ubuntu :size=8:style=bold}${goto 410}${voffset -2}${template1 Jour_VentForce 7}${font Ubuntu :size=6:style=bold} km/h
##### Affichage Date #####
${font Ubuntu :size=10}${color white}${goto 27}${template1 Jour %a_%d 2}${goto 100}${template1 Jour %a_%d 3}${goto 170}${template1 Jour %a_%d 4}${goto 250}${template1 Jour %a_%d 5}${goto 320}${template1 Jour %a_%d 6}${goto 400}${template1 Jour %a_%d 7}
#### Affichage des cadres utilisés dans le conky ####
${voffset -935}
#### premier cadre ####
${template0 base.png 0,40 450x110}
${template0 flip_bg.png 24,10 100x100}
${template0 flip_bg.png 134,10 100x100}
#### Second cadre ####
${template0 base.png 0,155 450x80}
#### icônes premier cadre ####
${template2 IconeM /home/seb/conky/icones 220,65 132x79}
#### icônes Second cadre ####
${template2 AM_IconeM /home/seb/conky/icones 5,165 86x52 2}
${template2 AM_IconeM /home/seb/conky/icones 80,165 86x52 3}
${template2 AM_IconeM /home/seb/conky/icones 155,165 86x52 4}
${template2 AM_IconeM /home/seb/conky/icones 230,165 86x52 5}
${template2 AM_IconeM /home/seb/conky/icones 305,165 86x52 6}
${template2 AM_IconeM /home/seb/conky/icones 380,165 86x52 7}
"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio
Hors ligne
#1645 Le 23/07/2012, à 11:29
- F50
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour à tous,
A la page 64 #1582 j'avais exposé mon problème avec un de mes deux conky. Depuis, j'ai changé de CG et essayé sans catalyst avec, etc etc... pour voir si la corruption venait de là mais sans résultat. Est-ce que qq'un pourrait l'essayer pour voir si c'est vraiment uniquement chez qu'il déconne ou si c'est le conky lui-même? Le voici, merci pour le coup de main.
use_xft yes
xftfont Sans
xftalpha 0.8
update_interval 1
own_window no
own_window_type desktop
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 700
maximum_width 700
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color black
default_outline_color black
alignment bottom_left
gap_x 46
gap_y 200
no_buffers yes
override_utf8_locale yes
TEXT
${voffset 10}${color 8BAEE8}${font Sans:pixelsize=120}${time %H:%M}${font}${voffset -84}${offset 30}${color B5141B}${font Sans:pixelsize=42}${time %d}${voffset -15} ${color 444755}${font Sans:pixelsize=22}${time %B}${time %Y}${font}${voffset 35}${font Sans:pixelsize=58}${offset -166}${time %A}${font}${voffset 1}${offset 12} ${font Sans:pixelsize=10}${color 444755}
#1646 Le 23/07/2012, à 15:34
- chepioq
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour à tous,
A la page 64 #1582 j'avais exposé mon problème avec un de mes deux conky. Depuis, j'ai changé de CG et essayé sans catalyst avec, etc etc... pour voir si la corruption venait de là mais sans résultat. Est-ce que qq'un pourrait l'essayer pour voir si c'est vraiment uniquement chez qu'il déconne ou si c'est le conky lui-même? Le voici, merci pour le coup de main.
use_xft yes xftfont Sans xftalpha 0.8 update_interval 1 own_window no own_window_type desktop own_window_transparent yes own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager double_buffer yes minimum_size 700 maximum_width 700 draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color white default_shade_color black default_outline_color black alignment bottom_left gap_x 46 gap_y 200 no_buffers yes override_utf8_locale yes TEXT ${voffset 10}${color 8BAEE8}${font Sans:pixelsize=120}${time %H:%M}${font}${voffset -84}${offset 30}${color B5141B}${font Sans:pixelsize=42}${time %d}${voffset -15} ${color 444755}${font Sans:pixelsize=22}${time %B}${time %Y}${font}${voffset 35}${font Sans:pixelsize=58}${offset -166}${time %A}${font}${voffset 1}${offset 12} ${font Sans:pixelsize=10}${color 444755}
bonjour
Voici la configuration qui fonctionne chez moi :
background no
use_xft yes
xftfont Sans
xftalpha 0.8
update_interval 1
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorate,skip_taskbar,skip_pager,below
minimum_size 700
maximum_width 700
gap_x 46
gap_y 200
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
default_color white
default_shade_color black
default_outline_color black
alignment bottom_left
no_buffers yes
override_utf8_locale yes
text_buffer_size 1024
TEXT
${voffset -30}${color 8BAEE8}${font Sans:pixelsize=110}${time %H:%M}${font}${voffset -84}${offset 30}${color B5141B}${font Sans:pixelsize=42}${time %d}${voffset -15} ${color 444755}${font Sans:pixelsize=22}${time %B}${time %Y}${font}${voffset 35}${font Sans:pixelsize=58}${offset -150}${time %A}
Tout est dans tout et réciproquement....
Hors ligne
#1647 Le 23/07/2012, à 15:48
- F50
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Salut,
Merci mais est-ce que ma version fonctionne chez toi? Si non, qu'as-tu changé?
Edit: J'ai trouvé! J'ai changé ${voffset 10}$ en ${voffset -32}$ et j'ai pu mettre own_window yes au lieu de no. Maintenant ça marche super, fini les moitié affiché ou restante! Un grand merci.
Dernière modification par faucon50 (Le 23/07/2012, à 16:10)
#1648 Le 23/07/2012, à 16:09
- chepioq
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Chez moi , ta version ne m'affiche que la moitié de l'heure, dans le sens horizontal, la partie supérieure.
De plus avec "own_window no" et sans "background no", cela fait merder mon bureau....
Ensuite j'ai du modifier un peu la ligne après TEXT, j'ai ajouté une ligne vide au début, changer le premier voffset de 10 à -30, j'ai changé la d'autre chose aussi, je te les met en rouge ci dessous
${voffset -30}${color 8BAEE8}${font Sans:pixelsize=110}${time %H:%M}${font}${voffset -84}${offset 30}${color B5141B}${font Sans:pixelsize=42}${time %d}${voffset -15} ${color 444755}${font Sans:pixelsize=22}${time %B}${time %Y}${font}${voffset 35}${font Sans:pixelsize=58}${offset -150}${time %A}
De plus j'ai supprimé la dernière partie qui ne sert à rien,
${font}${voffset 1}${offset 12} ${font Sans:pixelsize=10}${color 444755}
Tout est dans tout et réciproquement....
Hors ligne
#1649 Le 23/07/2012, à 16:18
- F50
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Super, merci chepioq!
Tu m'as bien aidé avec ce 10>-30, c'est ce qui faisait merder en coupant ça en moitié. J'avais copier ce conky mais je ne m'imaginais pas que c'était la source de l'épine. j'ai aussi viré cette dernière ligne! Encore une fois merci, c'est cool, va falloir trouver autre chose pour passer le temps.
Dernière modification par faucon50 (Le 23/07/2012, à 16:48)
#1650 Le 23/07/2012, à 21:04
- F50
Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes
Je me demande comment intégrer dans un de mes conky la commande de vérification de la température de mon gpu AMD qui est la suivante (je dois passer par: amdconfig) puis:
aticonfig --adapter=0 --od-gettemperature
Ca serait sympa de l'avoir vu que j'ai toutes les autres. Si qq'un à une idée... Merci.