You are not logged in.

#1 2024-02-02 20:18:59

mdiemer
Member
Registered: 2021-02-25
Posts: 44

Add Clock To Default Conky Theme?

I like the simple Conky theme over on the right side of the desktop, which shows ram, cpu, shortcuts etc. Without getting too into the weeds with conky (which I am a total nooby to), how can I get a nice digital clock in there with the other stuff? And perhaps a basic weather app also?

I don't want to detract from the elegance of the desktop. So I'm leery of just downloading a them from Github. I just would like the clock and maybe the weather.

Thanks,

michael

Last edited by mdiemer (2024-02-02 20:49:33)

Offline

#2 2024-02-02 23:40:39

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Add Clock To Default Conky Theme?

Well, your "nice digital clock" might be different for someone else.

First if you want a digital clock I'd suggest a "mono font" that has a 1 using the same space as a 0 or 2 for example.

LED_mono font is a font that only does numbers and : designed for digital clocks.
2024-02-02-203642.jpg

I use it like this:

${font LED_mono:size=65}${goto 00}${color1}88:88:88${goto 00}${color2}${time %T}${color}${font}
${font fira mono:medium:size=12}${alignc 12}${color2}\
${if_match ${time %H}<12}Good morning · Buen día${else}\
${if_match ${time %H}<18}Good afternoon · Buenas tardes${else}\
Good evening · Buenas noches${endif}${endif}

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3 2024-02-03 00:03:25

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: Add Clock To Default Conky Theme?

On the default menu:

User Settings -> Conky -> Edit Conkys -> Default conyrc

This will start geany with the default conkyrc ready to edit. Scroll down until you see this line:

 conky.text = [[  

Code below that line is output. You want to use the "time" variable to include a clock. For example:

${time %I:%M %P}

will add a basic clock (at the end in this example)

s7b8Mngt.png

"man date" in a terminal will show you all the time and date formats you can use.

You can use ${alignr} or ${alignc} to align the clock to the right or center respectively.

${alignc}${time %I:%M %P}

and Sector11 is correct, monospace fonts work best for clocks. So:

${font Monospace:size=11}${alignc}${time %_I:%M %P}${font}

Monospace font, centered clock at end of conky. The ending ${font} ends the monospace; anything after that will be the default sans.

bBwcaqMt.png

Last edited by PackRat (2024-02-03 00:04:21)


You must unlearn what you have learned.
    -- yoda

Offline

#4 2024-02-03 00:05:46

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: Add Clock To Default Conky Theme?

For weather, have a look here - https://forums.bunsenlabs.org/viewtopic.php?id=189


You must unlearn what you have learned.
    -- yoda

Offline

#5 2024-02-03 01:00:33

mdiemer
Member
Registered: 2021-02-25
Posts: 44

Re: Add Clock To Default Conky Theme?

Thanks Sector11 and PackRat, I'll see what I can do.

Offline

#6 2024-02-05 19:11:00

mdiemer
Member
Registered: 2021-02-25
Posts: 44

Re: Add Clock To Default Conky Theme?

OK. I got the clock going. I used 31 for the font, which gives a decent, but not absurd, size clock.

The weather thing is a lot more complicated, I'll need to really study up on that one. but for now at least I have the clock.

Offline

#7 2024-02-05 21:23:17

walter
Member
From: Sint-Agatha-Berchem, Belgium
Registered: 2023-07-30
Posts: 30

Re: Add Clock To Default Conky Theme?

In the default conky profiles there is the option 'BL-Right-lua-conky.conf' that gives  a reduced shortcut menu, a short system stats view, the calendar of the month and a 24-hour clock (instead of the 12-hour clock)

While obviously you can customize is all you want but if your lazy that is a great one IMHO

Mod EDIT: Please keep innuendos and insults out of your posts.

Offline

#8 2024-02-06 17:31:56

mdiemer
Member
Registered: 2021-02-25
Posts: 44

Re: Add Clock To Default Conky Theme?

walter wrote:

In the default conky profiles there is the option 'BL-Right-lua-conky.conf' that gives  a reduced shortcut menu, a short system stats view, the calendar of the month and a 24-hour clock (instead of the 12-hour clock)

While obviously you can customize is all you want but if your lazy that is a great one IMHO

Mod EDIT: Please keep innuendos and insults out of your posts.

Thanks for the info walter. I decided however to "cheat" and just use Meteo. Installed it from Synaptic. fine for my needs. for in depth info, I use the NWS.

Offline

#9 2024-02-06 18:54:57

Robi
Member
Registered: 2024-01-30
Posts: 43

Re: Add Clock To Default Conky Theme?

I borrowed this conky-clock-date.conf from Lilidog.

SxyFTNCt.png

----------------------
--  conky_datetime  --
-- @ceeslans feb 2022 --
----------------------

conky.config = {

no_buffers = true,
double_buffer = true,
update_interval = 1,
	
background = true,
own_window = true,
own_window_type = 'normal',
-- own_window_transparent = true,
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',
own_window_colour = '000000',
own_window_class = 'Conky',
own_window_title = 'DatetimeConky',

draw_borders = false,
stippled_borders = 5,
border_inner_margin = 5,
border_outer_margin = 5,
border_width = 2,
draw_graph_borders = yes,
draw_shades = false,
default_shade_color = '333333',
imlib_cache_size = 0,
draw_outline = false,
default_outline_color = '000000',

use_xft = true,
font = 'DejaVu Sans:size=10:bold',
xftalpha = 1,
override_utf8_locale = true,
uppercase = false,
use_spacer = 'none',
text_buffer_size = 6144,
short_units = true,
pad_percents = 2,

default_color = 'd8dee9', --clear
color1 = '84929C', --light grey
color2 = 'ebcb8b', --yellow
color3 = 'a3be8c', --green
color4 = 'd08770', --orange
color5 = 'bf616a', --red
color6 = '6B94BC', --blue
color7 = '93A2AD', --lighter grey

minimum_width = 150,
minimum_height = 0,
-- bl-conkymove, original value for gap_x: 78
	gap_x = 84,
-- bl-conkymove, original value for gap_y: 55
	gap_y = 12,
alignment = 'top_right',

-- ### uncomment below two lines for transparent background layer
--------------------------------
	--lua_load = '~/.conky/LUA/transbg.lua',
	--lua_draw_hook_pre = 'draw_bg 8 0 0 0 0 0x000000 0.16',

lua_load = '$HOME/.config/conky/LUA/vertclock.lua',
lua_draw_hook_pre = 'draw_bg 16 0 0 0 0 0x000000 0.35',
};

conky.text = [[
### set 12H clock ###
# ${color1}${voffset -15}${font DejaVu Sans:size=81:bold}${alignc}${time %I}${font}
### or 24H clock ###
${color1}${voffset -15}${font DejaVu Sans:size=81:bold}${alignc}${time %H}${font}
### day+date ###
${color2}${voffset 5}${alignc}${time %A} ${color3}${time %d %b}${font}
### minute ###
${color6}${voffset -15}${font DejaVu Sans:size=81:bold}${alignc}${time %M}${color}${font}
### mem+cpu ###
${color3}${voffset 5}${alignc}mem ${color7}${memperc}%  ${color4}cpu ${color7}${cpu cpu0}%
### battery ###
#${color2}${voffset 5}${alignc}bat  \
#${if_existing /sys/class/power_supply/BAT0/status}${voffset 1}${color6}${battery_bar 6,50 BAT0}  ${voffset -1}${color3}${battery_percent BAT0}%${endif}\
#${if_existing /sys/class/power_supply/BAT1/status}${voffset 1}${color6}${battery_bar 6,50 BAT1}  ${voffset -1}${color3}${battery_percent BAT1}%${endif}
### adjust widget height ###
${voffset -90}
]];

vertclock.lua

-- some globals
   CJK = 'false'
   DATE_FORMAT = '${time %A   %B %d}'
   LANG = os.getenv("LC_ALL")
   if ( not LANG or LANG == '' ) then  LANG = os.getenv("LANG") end
   if ( not LANG or LANG == '' ) then  LANG = "C" end
   if string.match(LANG,"^%l%l+_%u+") then
      LL_CC = string.sub(LANG, string.find(LANG, "^%l%l+_%u+"))
   else
      LL_CC = "C"
   end
   if  string.match(LANG,"^%l%l+") then
       LL = string.sub(LANG, string.find(LANG, "^%l%l+"))
   else
       LL = "C"
   end

-- some locals
local date_format_table =
{
   ['en_US']   = '${time %A   %B %d}',
   ['en']      = '${time %A   %B %d}',
   ['C']       = '${time %A   %B %d}',
   ['de_DE']   = '${time %A  %-d. %B}',
   ['de']      = '${time %A  %-d. %B}',
   ['ja']      = '${time %B %d日 %A}',
   ['ko']      = '${time %B %d일 %A}',
   ['zh']      = '${time %B %d日 %A}',
   ['default'] = '${time %A  %d %B}',
}

local cjk_table =
{
   ['ja'] = 'true',
   ['ko'] = 'true',
   ['zh'] = 'true',
   ['ar'] = 'true',
   ['fa'] = 'true',
   ['he'] = 'true',
}

-- some functions
function has_ampm()
    local handle = io.popen("locale  -k d_t_fmt | grep  -sqo -E '%r|%p|%I' && echo yes || echo no")
    local output = handle:read("*l")
    handle:close()
    return  output
end

if has_ampm() == "yes" then
    ampm = true
else
    ampm = false
end

function conky_hours()
    if ampm then
        return os.date("%I")
    else
        return os.date("%H")
    end
end

function conky_ampm()
    if ampm then
        return os.date("%P")
    else
        return ''
    end
end

function conky_AMPM()
    if ampm then
        return os.date("%p")
    else
        return ''
    end
end

function conky_am_pm()
    return conky_ampm()
end

function conky_AM_PM()
    return conky_AMPM()
end

function conky_lang()
     return os.getenv("LANG")
end

function conky_cpu()
     local str=''
     str=conky_parse('${cpu cpu0}')
     return string.format("%3d", str)
end

function conky_memperc()
     local str=''
     str=conky_parse('${memperc}')
     return string.format("%2d", str)
end

-- CJK handling

function conky_cjk()
    if cjk_table[LL] then
       return 'true'
    else
       return 'false'
    end
end

function conky_time(a)
     local s='${time %' .. a .. '}'
     return conky_parse(s)
end

function conky_set_time(d)
     if ( d == 'a' or d == 'A' ) then
        TIME_A = d
     elseif ( d == 'b' or d == 'B' ) then 
        TIME_B = d
     end
     set_date_format()
     return ''
end

function date_format()
     local date_format
     if      date_format_table[LL_CC] then
             date_format = date_format_table[LL_CC]
     elseif  date_format_table[LL] then
             date_format = date_format_table[LL]
     else
        date_format = date_format_table['default']
     end
        if TIME_A == 'a' then date_format = date_format:gsub('A', 'a');  end
        if TIME_B == 'b' then date_format = date_format:gsub('B', 'b');  end
     return date_format
end

function set_date_format()
     DATE_FORMAT = date_format()
     return
end

function conky_date_format() return DATE_FORMAT; end
function conky_get_date_format() return DATE_FORMAT; end

function conky_date()
     local format_str = DATE_FORMAT
     str=conky_parse(format_str)
     return str
end

-- Set the colour and transparency (alpha) of your background.
corner_r=16
bg_colour=0x000000
bg_alpha=0.0 

require 'cairo'
function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function conky_draw_bg()
	if conky_window==nil then return end
	local w=conky_window.width
	local h=conky_window.height
	local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
	cr=cairo_create(cs)
	
	cairo_move_to(cr,corner_r,0)
	cairo_line_to(cr,w-corner_r,0)
	cairo_curve_to(cr,w,0,w,0,w,corner_r)
	cairo_line_to(cr,w,h-corner_r)
	cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
	cairo_line_to(cr,corner_r,h)
	cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
	cairo_line_to(cr,0,corner_r)
	cairo_curve_to(cr,0,0,0,0,corner_r,0)
	cairo_close_path(cr)
	
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
	cairo_fill(cr)
end

Last edited by hhh (2024-02-07 07:00:18)


...Welcome to the family...

Offline

#10 2024-02-09 15:38:19

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Add Clock To Default Conky Theme?

Robi wrote:

I borrowed this conky-clock-date.conf from Lilidog.

It looks like "vertclock.lua" background function is not working.

AHA!
Change this:

-- own_window_transparent = true,
own_window_argb_visual = true,
own_window_argb_value = 0,

to this:

own_window_transparent = false,
own_window_argb_visual = true,
own_window_argb_value = 0,

and try it.

OR:
change to this:

own_window_transparent = true,
--own_window_argb_visual = true,
--own_window_argb_value = 0,

and try it.

I don't have conky v1.18 installed at the moment but just try those.

My test.conky window settings area:

## ---------- Begin Window Settings
own_window yes
own_window_type normal # normal desktop dock panel override
own_window_transparent yes # Set to "no" when using ARGB
own_window_hints skip_taskbar,skip_pager #,sticky #,below,undecorated
own_window_colour 000000
own_window_class Conky
own_window_title Sector11's Test Conky
## ARGB can be used for real transparency
## OJO: own_window_transparent MUST be set to no to use argb
#own_window_argb_visual yes ## Options: yes or no
## Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
#own_window_argb_value 80

no = false | yes = true


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#11 2024-02-09 15:55:43

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Add Clock To Default Conky Theme?

Hmmmm Still doesn't seem to work

Try this: draw-bg.lua

--[[Background originally by londonali1010 (2009)
    ability to set any size for background mrpeachy 2011
    ability to set variables for bg in conkyrc dk75

  the change is that if you set width and/or height to 0
  then it assumes the width and/or height of the conky window

so:

Above and After TEXT  (requires a composite manager or it blinks!)

 lua_load /media/5/Conky/LUA/draw-bg.lua
 TEXT
 ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}

OR Both above TEXT (no composite manager required - no blinking!)

 lua_load /media/5/Conky/LUA/draw-bg.lua
 lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
 TEXT

Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
  See below:        1  2 3 4 5 6        7

${lua conky_draw_bg corner_radius x_position y_position width height color alpha}

covers the whole window and will change if you change the minimum_size setting

1 = 20            corner_radius
2 = 0             x_position l|r
3 = 0             y_position u|d
4 = 0             width
5 = 0             height
6 = 0x000000      color
7 = 0.4           alpha

--  -----  calendar function  -----

then to use it, you activate the calendar function BELOW TEXT like this

${lua luacal {settings}}

#${lua luacal {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gh=,gt=,gv=,sd=}}
#    x=x position top left
#    y=y position top left
#    tf=title font, eg "mono" must be in quotes
#    tfs=title font size
#    tc=title color
#    ta=title alpha
#    bf=body font, eg "mono" must be in quotes
#    bfs=body font size
#    bc=body color
#    ba=body alpha
#    hf=highlight font, eg "mono" must be in quotes
#    hfs=highlight font size
#    hc=highlight color
#    ha=highlight alpha
#    sp=spacer, eg " " or sp="0"... 0,1 or 2 spaces can help with positioning of non-monospaced fonts

--  ----- GAPS  -----
#    gt=gap from title to body
#    gh=gap horizontal between columns
#    gv=gap vertical between rows
#    sd=start day, 0=Sun, 1=Mon

#    hstyle = heading style, 0=just days, 1=date insert
#    tdf=title date font, eg "mono" must be in quotes
#    tdfs=title date font size
#    tdc=title date color
#    tda=title date alpha

# test line
-- ${lua luacal {x=20,y=100,tf="Monofur",tfs=24,tc=0xFFDEAD,ta=1,bf="Monofur",bfs=24,bc=0xFFDEAD,ba=1,hf="Monofur",hfs=24,hc=0x00BFFF,ha=1,sp="0",gh=60,gt=26,gv=20,sd=0,hstyle=1,tdf="Monofur",tdfs=24,tdc=0x00BFFF,tda=1}}


]]

require 'cairo'
local    cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
if w=="0" then w=tonumber(conky_window.width) end
if h=="0" then h=tonumber(conky_window.height) end
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--  top left mid circle
local xtl=x+r
local ytl=y+r
--  top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--  bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--  bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
--  -----  -----  -----  -----
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
--  -----  -----  -----  -----
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
-- ----- calendar function -----
function conky_luacal(caltab) -- {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gt=,gh=,gv=,sd=,hstyle=,tdf=,tdfs=,tdc=,tda=}
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--  -----  -----  -----  -----
if caltab.x==nil then
caltab=loadstring("return" .. caltab)()
end
local cal_x=caltab.x
local cal_y=caltab.y
local tfont=caltab.tf		or "mono"
local tfontsize=caltab.tfs	or 12
local tc=caltab.tc			or 0xffffff
local ta=caltab.ta			or 1
local bfont=caltab.bf		or "mono"
local bfontsize=caltab.bfs	or 12
local bc=caltab.bc			or 0xffffff
local ba=caltab.ba			or 1
local hfont=caltab.hf		or "mono"
local hfontsize=caltab.hfs	or 12
local hc=caltab.hc			or 0xff0000
local ha=caltab.ha			or 1
local spacer=caltab.sp		or " "
local gaph=caltab.gh		or 20
local gapt=caltab.gt		or 15
local gapl=caltab.gv		or 15
local sday=caltab.sd		or 0
local hstyle=caltab.hstyle	or 0
--  convert colors
--  local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b(tc,ta)
--  main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b(bc,ba)
--  highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b(hc,ha)
--  -----  -----  -----  -----
--  calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
    if i<=start_day then
    dnum[i]="  "
    else
    dn=i-start_day
        if dn=="nil" then dn=0 end
        if dn<=9 then dn=(spacer .. dn) end
        if i>x then dn="" end
        dnum[i]=dn
        dnumh[i]=dn
        if dn==(spacer .. today) or dn==today then
        dnum[i]=""
        end
        if dn==(spacer .. today) or dn==today then
        dnumh[i]=dn
        place=i
        else dnumh[i]="  "
        end
    end
end --  for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if hstyle==0 then
    if tonumber(sday)==0 then
    dys={"SU","MO","TU","WE","TH","FR","SA"}
    else
    dys={"MO","TU","WE","TH","FR","SA","SU"}
    end
--  draw calendar titles
elseif hstyle==1 then
    if tonumber(sday)==0 then
    dys={"SU","MO"," ","  ","  ","FR","SA"}
    cairo_text_extents(cr,"MO",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    else
    dys={"MO","TU"," ","  ","  ","SA","SU"}
    cairo_text_extents(cr,"TU",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    end
end
--  draw calendar titles
for i=1,7 do
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--  draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnum[i])
    cairo_stroke (cr)
    end
end
--  highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnumh[i])
    cairo_stroke (cr)
    end
end
--  -----  -----  -----  -----
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end
-- ----- end main function -----

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#12 2024-07-23 18:23:20

danielhb
Member
Registered: 2024-05-28
Posts: 9

Re: Add Clock To Default Conky Theme?

Sector11 wrote:

Well, your "nice digital clock" might be different for someone else.

First if you want a digital clock I'd suggest a "mono font" that has a 1 using the same space as a 0 or 2 for example.

LED_mono font is a font that only does numbers and : designed for digital clocks.
https://i.ibb.co/wN0cYH8/2024-02-02-203642.jpg

I use it like this:

${font LED_mono:size=65}${goto 00}${color1}88:88:88${goto 00}${color2}${time %T}${color}${font}
${font fira mono:medium:size=12}${alignc 12}${color2}\
${if_match ${time %H}<12}Good morning · Buen día${else}\
${if_match ${time %H}<18}Good afternoon · Buenas tardes${else}\
Good evening · Buenas noches${endif}${endif}

Buena tu propuesta, yo la modifiqué un poco (no encontré la fuente LED_mono, usé  fira mono).
Así quedó

Mi conky

Offline

#13 2024-07-24 07:57:34

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,640

Re: Add Clock To Default Conky Theme?

esto no es 'fira mono' 
esto es 'LED_mono'  wink

this is not 'fira mono' 
this is 'LED_mono'  wink

Offline

#14 2024-07-24 14:50:56

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Add Clock To Default Conky Theme?

danielhb wrote:

Buena tu propuesta, yo la modifiqué un poco (no encontré la fuente LED_mono, usé  fira mono).
Así quedó

https://orquidealucinada.net/lib/exe/fe … ebp?cache=

Like unklar said, this is LED_mono you are using for your "clock" at lease.  The "text" part looks to be fira mono thought.  If fira mono was used for the clock it would look like the lower one.
2024-07-24-114201.jpg

Como dijo Unklar, este es LED_mono que estás usando para tu "reloj" al menos. La parte "texto" parece ser un pensamiento "fira mono". Si se usara "fira mono" para el reloj se vería como el de abajo


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#15 2024-07-25 13:05:21

danielhb
Member
Registered: 2024-05-28
Posts: 9

Re: Add Clock To Default Conky Theme?

Tenés razón, es que me marea esto, soy poco ducho en el tema y me lo paso probando y deshaciendo.
Saludos
Dejo el código por si a alguien le sirve. La última línea (voffset -85) es para que quede bien abajo en la pantalla.

conky.config = {
-- Use Xft yes
	use_xft = true,
	font = 'Digital Display:size=110',
	xftalpha = 1,
	text_buffer_size = 2048,

-- Update interval in seconds
	update_interval = 1,

-- This is the number of times Conky will update before quitting.
-- Set to zero to run forever.
	total_run_times = 0,

-- Create own window instead of using desktop (required in nautilus)
	own_window = yes,
	own_window_transparent = yes,
	own_window_type = 'desktop',
	own_window_class = 'desktop',
	own_window_colour = '#000000',
	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
	background = true,


-- Use double buffering (reduces flicker, may not work for everyone)
	double_buffer = true,
-- Minimum size of text area
	minimum_width = 200, minimum_height = 0,
	maximum_width = 700,

-- Draw shades?
	draw_shades = yes,
	default_shade_color = 'black',

-- Draw outlines?
	draw_outline = false,

-- Draw borders around text
	draw_borders = false,

-- Stippled borders?
	stippled_borders = 0,
	border_inner_margin = 0,
	border_outer_margin = 0,

-- Colores
	default_color = 'darkgreen',
	color0 = '#B0E0E6',
	color1 = '#004400',-- 719c67
	color2 = '#dddddd',
	color3 = '#9ACD32',
	color4 = '#FFA07A',
	color5 = '#FFDEAD',
	color6 = '#00BFFF',
	color7 = '#5F9EA0',
	color8 = '#BDB76B',
	color9 = '#C0C0C0',

	own_window_argb_visual = yes,
	own_window_argb_value = 0,

	alignment = 'bottom_middle',
	gap_x = 0,
	gap_y = 0,

};

conky.text = [[
${alignc}${font fira mono:medium:size=12}${color white}${if_match ${time %H}<12}Buen día${else}${if_match ${time %H}<18}Buenas tardes${else}Buenas noches${endif}${endif}${color}
${alignc}${font Dejavu Sans:Book:size=15:style=bold}${color gold}${execi 3600 date +%A} ${time %d de %B de %Y}${color}

${alignc}${font Digital Display:size=110:style=bold}${color1}${time %T}${font}
${voffset -85}
]];

Offline

Board footer

Powered by FluxBB