Conky theme problems

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
mandak
Level 4
Level 4
Posts: 343
Joined: Mon Jul 08, 2024 8:05 am
Location: Livno

Re: Conky theme problems

Post by mandak »

Logansfury wrote: Sun Sep 01, 2024 2:02 pm
mandak wrote: Sun Sep 01, 2024 1:59 pm I have this in the 'res' file:

Image
I am showing the same files, and my ring has transparency. I can't explain the display difficulty. My system may be hosed.
I don't know. Works for me.
Image

Linux Mint 22 "Wilma" Cinnamon / Samsung Galaxy A55 5G

MB: ASRock B550M Pro4 / CPU: AMD Ryzen 5 PRO 4650G / GPU int. in CPU Radeon RX Vega 7 Renoir / RAM Memory: Corsair Vengeance LPX 16GB
User avatar
mandak
Level 4
Level 4
Posts: 343
Joined: Mon Jul 08, 2024 8:05 am
Location: Livno

Re: Conky theme problems

Post by mandak »

The time sign is not changed in Alfirk Conky. It's always cloudy even though it was sunny all day today.

Image

weather-text-icon

Code: Select all

#!/bin/bash

# v2.0
# I create this scripts to show weather icon with text icon
# and take data from json file, so it can use offline
# the font i use Feather icon font  { https://github.com/AT-UI/feather-font }
# to get weather.json file i use another script
# Closebox73

# icon font based openweathermap.org data
ICON_01D=""
ICON_01N=""
ICON_02=""
ICON_09=""
ICON_10=""
ICON_11=""
ICON_13=""
ICON_50=""
NO_DATA=""

WEATHER_ICON=$(cat ~/.cache/weather.json | jq -r '.weather[0].icon')

if [[ "${WEATHER_ICON}" = *01d* ]]; then
    echo "${ICON_01D}"
elif [[ "${WEATHER_ICON}" = *01n* ]]; then
    echo "${ICON_01N}"
elif [[ "${WEATHER_ICON}" = *02d* || "${WEATHER_ICON}" = *02n* || "${WEATHER_ICON}" = *03d* || "${WEATHER_ICON}" = *03n* || "${WEATHER_ICON}" = *04d* || "${WEATHER_ICON}" = *04n* ]]; then
    echo "${ICON_02}"
elif [[ "${WEATHER_ICON}" = *09d* || "${WEATHER_ICON}" = *09n* ]]; then
    echo "${ICON_09}"
elif [[ "${WEATHER_ICON}" = *10d* || "${WEATHER_ICON}" = *10n* ]]; then
    echo "${ICON_10}"
elif [[ "${WEATHER_ICON}" = *11d* || "${WEATHER_ICON}" = *11n* ]]; then
    echo "${ICON_11}"
elif [[ "${WEATHER_ICON}" = *13d* || "${WEATHER_ICON}" = *13n* ]]; then
    echo "${ICON_13}"
elif [[ "${WEATHER_ICON}" = *50d* || "${WEATHER_ICON}" = *50n* ]]; then
    echo "${ICON_50}"
else
	echo "${NO_DATA}"
fi

exit
Image

Linux Mint 22 "Wilma" Cinnamon / Samsung Galaxy A55 5G

MB: ASRock B550M Pro4 / CPU: AMD Ryzen 5 PRO 4650G / GPU int. in CPU Radeon RX Vega 7 Renoir / RAM Memory: Corsair Vengeance LPX 16GB
User avatar
mandak
Level 4
Level 4
Posts: 343
Joined: Mon Jul 08, 2024 8:05 am
Location: Livno

Re: Conky theme problems

Post by mandak »

I installed the Asterope Conky widget. Everything is in capital letters. Can it be made to be lower case?

Image

Asterope.conf

Code: Select all

conky.config = {
--==============================================================================

--  Created : 2021/May/27
--  This theme is for conky version 1.10.8 or newer
-- 
--  ASTEROPE
--  ( A part of Taurus Conky themes pack )
--
--  author  : Closebox73
--  version : 2.2
--  variant : Mpd & Celcius
--  license : Distributed under the terms of GPLv3
--  notes   : Created on 1366x768 Monitor

--==============================================================================

-- Size and Position settings --
  alignment = 'top_right',
  gap_x = 150,
  gap_y = 90,
  maximum_width = 1000,
  minimum_height = 300,
  minimum_width = 1000,
  
-- Text settings --
  use_xft = true,
  override_utf8_locale = true,
  font = 'Dosis:size=9',
  
-- Color Settings --
  default_color = 'white',
  default_outline_color = 'white',
  default_shade_color = 'white',
  color1 = '#E5832F',
  
-- Window Settings --
  background = false,
  border_width = 1,
  draw_borders = false,
  draw_graph_borders = false,
  draw_outline = false,
  draw_shades = false,
  own_window = true,
  own_window_colour = '#FFFFFF',
  own_window_class = 'Conky',
  own_window_argb_visual = false,
  own_window_type = 'desktop',
  own_window_transparent = true,
  own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
  stippled_borders = 0,
  
-- Others --
  cpu_avg_samples = 2,
  net_avg_samples = 2,
  double_buffer = true,
  out_to_console = false,
  out_to_stderr = false,
  extra_newline = false,
  update_interval = 1,
  uppercase = true,
  use_spacer = 'none',
  show_graph_scale = false,
  show_graph_range = false,
  lua_load = '~/.conky/Asterope/scripts/Lua/mini_clock.lua',
  lua_draw_hook_pre = 'main',
}

conky.text = [[
${execi 200 ~/.conky/Asterope/scripts/weather-v2.0.sh}\
${offset 380}${voffset 90}${font Finlandica:size=10}time${goto 577}Weather
${alignr 580}${voffset }${font Finlandica:bold:size=20}${time %H : %M : %S}${font}
${offset 570}${voffset -29}${font Finlandica:bold:size=20}${execi 100 cat cat ~/.cache/weather.json | jq -r '.weather[0].main'} / ${execi 100 cat ~/.cache/weather.json | jq '.main.temp' | awk '{printf "%.0f\n",$1}' }°C${font}
${alignc 5}${voffset -15}${font feather:size=35}${execi 5 ~/.conky/Asterope/scripts/weather-text-icon}${font}
${offset 355}${voffset -10}${font Finlandica:size=10}calendar${goto 577}${if_running mpd}you're listening >> ${mpd_artist}${else}${execi 600 ~/.conky/Asterope/scripts/Greeting.sh} ${execi 600 whoami}$endif
${alignr 580}${voffset 0}${font Finlandica:bold:size=20}${time %e. %B, %Y}${font}
${offset 570}${voffset -29}${font Finlandica:bold:size=20}${if_running mpd}${mpd_title 50}${else}have a nice day$endif
]]
mini_clock.lua

Code: Select all

--[[
minimal clock for conky
based upon similar android clock widget

written by easysid
Tuesday, 03 February 2015 16:20 IST

edited by Etles_Team
Friday, 17 August 2016 21:08 WITA

To call this conky, Add this command before "TEXT" in conkyrc file:

   lua_load ~/.conky/Conky-Name/scripts/lua/min_clock.lua
   lua_draw_hook_pre main
   OR
   lua_draw_hook_post main

alignment middle_middle
gap_x 0
gap_y 0
own_window_transparent no
own_window_argb_visual no
own_window_argb_value 0
own_window_colour 000000
minimum_size 0 0
TEXT

]]

require 'cairo'

clock_table = {
-- clock style options
use12hourformat = true, -- 12 hr format. Set to false for 24 hrs
draw_background = false, -- set to false if you do not want a bg fill
draw_seconds    = true, -- draw the seconds ring

-- Options if above is true
seconds_ring_width       = 3,               -- seconds ring width
seconds_ring_base_color  = {0xFF0000, 0.1}, -- base color
seconds_ring_fill_color  = {0xFF0000, 0.2}, -- fill color
seconds_ring_fill_colorS = {0xFF0000, 0.2},

-- Main settings
xc = 500, -- centre of the clock
yc = 150,
R  = 140, -- default radius of the clock
RH = 50,  -- outher radius for hours fill ring
RM = 95,  -- outer radius for minutes fill ring
rh = 8,  -- hour ring fill raius
rm = 8,  -- minutes ring fill radius
rs = 8,  -- seconds ring fill radius
border_width = 0, -- radius border fill ring

-- Color settings. {color, alpha}
background_color = {0x2F2F2F, 0.6}, -- bgcolor id draw_background is true.
fill_color       = {0xFF0000, 0.6},   -- fill color for hour+minutes ring
fill_colorS      = {0xFF0000, 0.6},   -- fill color for seconds ring
border_colorS    = {0xFFDCDC, 1},   -- border color for seconds fill ring
border_color     = {0xAB9F6F, 1},   -- border color for hours+minutes
text_color       = {0x00EFFF, 1},   -- color of numbers
text_colorS      = {0xEEFFFF, 1},   -- color for text seconds inside fill ring

-- Font settings, Specify the font as font:face, where face is bold, italic, bolditalic
hour_font = "Lion", hour_font_size = 0, -- font face+size for hours
min_font  = "Lion", min_font_size  = 0, -- font face+size for minutes
sec_font  = "Lion", sec_font_size  = 0, -- font face+size for seconds
day_font  = "Lion", day_font_size  = 0, -- font face+size for the day
}
-----------------------------------------------------------------------------------------------------------------------------------------------
--
-- Main function to load script
function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
draw_clock(cr, clock_table)
end -- end main function
-----------------------------------------------------------------------------------------------------------------------------------------------
--
-- The primary function to draw the clock
function draw_clock(cr, t)
-- Hours
local divh = 12
local hour = tonumber(os.date("%H"))
local h_theta = hour*2*math.pi/divh - math.pi/2
local xh = t.xc + t.RH*math.cos(h_theta)
local yh = t.yc + t.RH*math.sin(h_theta)

-- Minutes
local divm = 60   
local minutes = tonumber(os.date("%M"))
local m_theta = minutes*2*math.pi/divm - math.pi/2 -- calculate the angle
local xm = t.xc + t.RM*math.cos(m_theta)
local ym = t.yc + t.RM*math.sin(m_theta)
    
-- Get font and font face hours + minutes
local dfont, dface = splitfont(t.day_font)
local hfont, hface = splitfont(t.hour_font)
local mfont, mface = splitfont(t.min_font)

-- Print calculate text extents
if t.use12hourformat then
hy = getheight(hour,t.hour_font, 'normal', t.hour_font_size)
end

-- Draw the outer ring
if t.draw_background then
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.background_color))
cairo_arc(cr, t.xc, t.yc, t.R, 0, 2*math.pi)
cairo_fill(cr)
end

-- The primary function to draw the clock if draw seconds
if t.draw_seconds then
local divs = 60
local seconds = tonumber(os.date("%S"))
local s_theta = seconds*2*math.pi/divs - math.pi/2 -- calculate the angle
local xs = t.xc + t.R*math.cos(s_theta)
local ys = t.yc + t.R*math.sin(s_theta)
local sfont, sface = splitfont(t.sec_font)

cairo_set_line_width(cr, t.seconds_ring_width)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.seconds_ring_base_color))

-- Draw the base ring for seconds
cairo_arc(cr, t.xc, t.yc, t.R, 0, 2*math.pi)
cairo_stroke(cr)

-- Draw the seconds indicator circle
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.seconds_ring_fill_colorS))
cairo_arc(cr, t.xc, t.yc, t.R, -math.pi/2, s_theta)
cairo_stroke(cr)

-- Draw the seconds ring fill
cairo_set_line_width(cr, t.border_width)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.fill_colorS))
cairo_arc(cr, xs, ys, t.rs, 0, 2*math.pi)
cairo_fill(cr)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.border_colorS))
cairo_arc(cr, xs, ys, t.rs, 0, 2*math.pi)
cairo_stroke(cr)

-- Output text for seconds
out({x=xs,y=ys,f=sfont,face=sface,fs=t.sec_font_size,c=t.text_colorS,txt=seconds,hj='c',vj='m'})
else
cairo_set_line_width(cr, t.border_width)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.border_color))
cairo_arc(cr, t.xc, t.yc, t.R, 0, 2*math.pi)
cairo_stroke(cr)
end
------------------------------------------------------------------------------------------------
--
-- Hours
cairo_set_line_width(cr, t.seconds_ring_width)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.seconds_ring_base_color))

-- Draw the base ring for hours
cairo_arc(cr, t.xc, t.yc, t.RH, 0, 2*math.pi)
cairo_stroke(cr)

-- Draw the hours indicator circle
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.seconds_ring_fill_color))
cairo_arc(cr, t.xc, t.yc, t.RH, -math.pi/2, h_theta)
cairo_stroke(cr)

-- Draw the hours ring fill
cairo_set_line_width(cr, t.border_width)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.fill_color))
cairo_arc(cr, xh, yh, t.rh, 0, 2*math.pi)
cairo_fill(cr)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.border_color))
cairo_arc(cr, xh, yh, t.rh, 0, 2*math.pi)
cairo_stroke(cr)
---------------------------------------------------------------------
--
-- Minutes
cairo_set_line_width(cr, t.seconds_ring_width)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.seconds_ring_base_color))

-- Draw the base ring minutes
cairo_arc(cr, t.xc, t.yc, t.RM, 0, 2*math.pi)
cairo_stroke(cr)

-- Draw the minutes indicator circle
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.seconds_ring_fill_color))
cairo_arc(cr, t.xc, t.yc, t.RM, -math.pi/2, m_theta)
cairo_stroke(cr)

-- Draw the minutes ring fill
cairo_set_line_width(cr, t.border_width)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.fill_color))
cairo_arc(cr, xm, ym, t.rm, 0, 2*math.pi)
cairo_fill(cr)
cairo_set_source_rgba(cr, rgba_to_r_g_b_a(t.border_color))
cairo_arc(cr, xm, ym, t.rm, 0, 2*math.pi)
cairo_stroke(cr)
---------------------------------------------------------------------
--
-- Check the time format
if t.use12hourformat then
hour = tonumber(os.date("%H"))
local ampm = os.date("%p")
-- Output text for the day
out({x=t.xc,y=t.yc+8,f=dfont,face=dface,fs=t.day_font_size,c=t.text_color,txt=ampm,hj='c',vj='n'})
end
-- Output text for hours
out({x=xh,y=yh,f=hfont,face=hface,fs=t.hour_font_size,c=t.text_color,txt=hour,hj='c',vj='m'})
-- Output text for
out({x=xm,y=ym,f=mfont,face=mface,fs=t.min_font_size,c=t.text_color,txt=minutes,hj='c',vj='m'})
end -- end draw_clock

function out(txj)
-- Taken from mrpeachy's wun.lua
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
local function justify(jtxt,x,hj,y,vj,f,face,fs)
if face=="normal" then
face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL}
elseif face=="bold" then
face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD}
elseif face=="italic" then
face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL}
elseif face=="bolditalic" then
face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD}
else
print ('face not set correctly - "normal","bold","italic","bolditalic"')
end

cairo_select_font_face (cr,face[1],face[2],face[3])
cairo_set_font_size(cr,fs)
cairo_text_extents(cr,jtxt,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
local tx=x
local ty=y

-- Set horizontal alignment - l, c, r
if hj=="l" then x=x-bx
elseif hj=="c" then x=x-((wx-bx)/2)-bx
elseif hj=="r" then x=x-wx
else
print ("hj not set correctly - l, c, r")
end

-- vj. n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
y=y
elseif vj=="nb" then
y=y-by
elseif vj=="m" then
y=y+((hy-by)/2)
elseif vj=="mb" then
y=y+(hy/2)-by
elseif vj=="t" then
y=y+hy-by
else
print ("vj not set correctly - n, nb, m, mb, t")
end
return face,fs,x,y,rad,rad2,tx,ty
end -- justify local function

-- Set variables
local c=txj.c 	 or {0xffffff, 1}
local a=txj.a 	 or 1
local f=txj.f 	 or "Mono"
local fs=txj.fs 	 or 12
local x=txj.x 	 or 100
local y=txj.y 	 or 100
local txt=txj.txt 	 or "text"
local hj=txj.hj 	 or "l"
local vj=txj.vj 	 or "n"
local face=txj.face	 or "normal"
    
-- Print text
local face,fs,x,y=justify(txt,x,hj,y,vj,f,face,fs)
cairo_select_font_face (cr,face[1],face[2],face[3])
cairo_set_font_size(cr,fs)
cairo_move_to (cr,x,y)
cairo_set_source_rgba (cr,rgba_to_r_g_b_a(c))
cairo_show_text (cr,txt)
cairo_stroke (cr)
return nx
end -- function out

function rgba_to_r_g_b_a(tcolor)
local color,alpha=tcolor[1],tcolor[2]
return ((color / 0x10000) % 0x100) / 255., ((color / 0x100) % 0x100) / 255., (color % 0x100) / 255., alpha
end -- end rgba

function getheight(txt,f,face,fs)
-- Return the height of text. Needed for proper placement
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if face=="normal" then
face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL}
elseif face=="bold" then
face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD}
elseif face=="italic" then
face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL}
elseif face=="bolditalic" then
face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD}
else
print ('face not set correctly - "normal","bold","italic","bolditalic"')
end
cairo_select_font_face (cr,face[1],face[2],face[3])
cairo_set_font_size(cr,fs)
cairo_text_extents(cr,txt,extents)
return extents.height
end -- end getheight

function splitfont(s)
-- Return font and face
if s:find(':') then
return s:match("([^:]+):([^:]+)")
else
return s, nil
end
end -- end splitfont

function cairo_cleanup()
cairo_destroy(cr)
cairo_surface_destroy(cs)
collectgarbage()
cr,cs=nil
end -- cleanup
--======================= Regards, Etles_Team =============================
Image

Linux Mint 22 "Wilma" Cinnamon / Samsung Galaxy A55 5G

MB: ASRock B550M Pro4 / CPU: AMD Ryzen 5 PRO 4650G / GPU int. in CPU Radeon RX Vega 7 Renoir / RAM Memory: Corsair Vengeance LPX 16GB
User avatar
Koentje
Level 8
Level 8
Posts: 2080
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Conky theme problems

Post by Koentje »

Have you even checked the config???

uppercase = true,
Image
User avatar
mandak
Level 4
Level 4
Posts: 343
Joined: Mon Jul 08, 2024 8:05 am
Location: Livno

Re: Conky theme problems

Post by mandak »

Koentje wrote: Tue Sep 03, 2024 2:35 pm Have you even checked the config???

uppercase = true,
I replaced true I put false and the problem is solved. Thanks. I have gone through this many times, but when I don't understand what it means, I could have gone through it a hundred times and still not solve the problem.
Image

Linux Mint 22 "Wilma" Cinnamon / Samsung Galaxy A55 5G

MB: ASRock B550M Pro4 / CPU: AMD Ryzen 5 PRO 4650G / GPU int. in CPU Radeon RX Vega 7 Renoir / RAM Memory: Corsair Vengeance LPX 16GB
User avatar
mandak
Level 4
Level 4
Posts: 343
Joined: Mon Jul 08, 2024 8:05 am
Location: Livno

Re: Conky theme problems

Post by mandak »

I want to make Conky show me how much the stick is used and free. Only when the USB stick has the name 'USB STICK' does it show how much the stick is used and free. When it is some other name, then it does not show how much the stick is used.

It looks like this:

Code: Select all

${color2}USB  ${color}${alignr}
$color${fs_used /media/mandak/USB STICK} of ${fs_size /media/mandak/USB STICK} used - ${fs_used_perc /media/mandak/USB STICK}%
${color2}${goto 5}${fs_bar 12 /media/mandak/USB STICK}
Otherwise the USB is at /dev/sdd/.

Is it possible to use /dev/sdd/ in Conky and thus always show used and free USB sticks. If it can, how?
Image

Linux Mint 22 "Wilma" Cinnamon / Samsung Galaxy A55 5G

MB: ASRock B550M Pro4 / CPU: AMD Ryzen 5 PRO 4650G / GPU int. in CPU Radeon RX Vega 7 Renoir / RAM Memory: Corsair Vengeance LPX 16GB
User avatar
mandak
Level 4
Level 4
Posts: 343
Joined: Mon Jul 08, 2024 8:05 am
Location: Livno

Re: Conky theme problems

Post by mandak »

Problem solved.

I found Conky usbinfo-1.1 from Koentje and it works great. Thank you Koentje.
Image

Linux Mint 22 "Wilma" Cinnamon / Samsung Galaxy A55 5G

MB: ASRock B550M Pro4 / CPU: AMD Ryzen 5 PRO 4650G / GPU int. in CPU Radeon RX Vega 7 Renoir / RAM Memory: Corsair Vengeance LPX 16GB
User avatar
Koentje
Level 8
Level 8
Posts: 2080
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Conky theme problems

Post by Koentje »

Glad you like it! :wink:
Image
Post Reply

Return to “Compiz, Conky, Docks & Widgets”