You are not logged in.

#2381 2025-08-16 16:31:02

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

Re: Show us your conky

unklar wrote:

Hello, my friend, thank you very much for your help!  smile
Your found the error.

circlewriting
It was lines 397 cpu1 and 410 cpu2 of the Lua script.
In both cases, the y-value was changed from 220 to 210.
https://i.imgur.com/rtetZfWt.png

Your tip about not finding the "y-variable" clued me in.
I remember "adjusting" x and y variables for hours on a lot of the LUA scripts I've tweaked so it was an easy find.

Glad I could help.

I don't have the know how to write a LUA script, but given one I can bend fold and mutilate them into shape thanks to mrpeachy, RIP my friend, and falldowm, wherever you are, thanks.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#2382 2025-08-18 02:05:50

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

@loutch

I really don't know why you use Conky to change the wallpaper at a specific time (Day/Night):
https://forums.bunsenlabs.org/viewtopic … 19#p145019

As I said, redshift always knows the exact time when day and night change at your location:
https://forums.bunsenlabs.org/viewtopic … 20#p145020

1) You need to install redshift  (not redshift-gtk):

$ sudo apt install redshift

2) Disable that conky (jour_nuit) at startup and redshift-gtk (if installed)

3) Add the redshift  (command) to startup

4) Open the ~/.config  folder and create a redshift.conf  file inside for your location (Sarreguemines - lat=49.110001; lon=7.070000):

; Global settings
[redshift]
temp-day=5840
temp-night=4480
transition=1
gamma=0.9
location-provider=manual
adjustment-method=vidmode

; The location provider and adjustment method settings
; are in their own sections.
[manual]
lat=49.110001
lon=7.070000

; In this example screen 1 is adjusted by vidmode. Note
; that the numbering starts from 0, so this is actually
; the second screen.
[vidmode]
screen=1

5) Open the /home/loutch/Images  folder and create a new wallpaper.sh  should look like this:

#!/bin/bash

## Day/Night Wallpaper - with RedShift ##

    sleep 8

    if [[ "$(redshift -p | grep 'Period' | awk '{print $2}')" == "Night" ]]; then
         
         xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP1/workspace0/last-image -s /home/loutch/Images/Tahoe-Dark.jpg
         
      else
         
         xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP1/workspace0/last-image -s /home/loutch/Images/Tahoe-Light.jpg         
         
    fi
 
  while sleep 2; do

  mode=$(redshift -p | grep 'Period' | awk '{print $2}')
  
  sleep 58
  
  mode_new=$(redshift -p | grep 'Period' | awk '{print $2}')
  
  if [[ "$mode_new" != $mode ]]; then   

    if [[ "$mode_new" == "Night" ]]; then
         
         xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP1/workspace0/last-image -s /home/loutch/Images/Tahoe-Dark.jpg
         
      else
         
         xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP1/workspace0/last-image -s /home/loutch/Images/Tahoe-Light.jpg         
         
    fi
  
  fi  
    
  done

6) Make the script executable

7) Add command  sh "/home/loutch/Images/wallpaper.sh"  to startup

Done.

LogOut/LogIn or Restart

Try and test with:

$ redshift -p | grep 'Period' | awk '{print $2}'

When the terminal output is Night,  the wallpaper will change in less than a minute.

You no longer have a fixed time (00:00 & 21:00) when Night/Day begins because redshift  knows the exact time (Sunrise/Sunset) for your location (Sarreguemines).

P.S.
Sorry, but I can't test.

Last edited by marens (2025-08-18 03:10:20)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2383 2025-08-18 07:27:25

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

Same problem like your other script in terminal, but it work , wallpaper is changed.

$ redshift -p | grep 'Period' | awk '{print $2}'
En attente de localisation...

@+

Last edited by loutch (2025-08-18 07:33:00)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#2384 2025-08-18 14:46:20

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

^ Don't worry, that's the normal output for the 'redshift -p'  command:

$ redshift -p | grep 'Period' | awk '{print $2}'
Waiting for current location to become available...
Daytime

Now we wait for the night.
Turn on some AccuWeather Conky that has sunrise/sunset data.

Redshift works by gradually adjusting the screen to protect your eyes.
The Transition mode begins about half an hour before sunset.
The Night mode starts about half an hour after sunset.

Your night wallpaper should appear at that time in less than a minute.

Now that you have a redshift.conf  for your location (Sarreguemines), the wallpaper will always change about half an hour after sunset.
Here (in winter) the sun sometimes sets before 16:00, but the redshift  always does its job perfectly.

marens wrote:

Check if this works in the terminal:

$ notify-send "Redshift" "Eyes protection changed" --icon=redshift

If it works, I will post a script that notifies you when it is Day / Transition / Night.
The Transition usually takes about 55 minutes because the redshift protects the eyes and gradually adjusts the desktop.


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2385 2025-08-19 02:24:20

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

Sorry, @loutch.

I can't test wallpaper.sh  but I can test the redshift.conf  file.

$ redshift
Waiting for initial location to become available...
Location: 49.11 N, 7.07 E

This file ~/.config/redshift.conf  definitely works for your location:

; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5840
temp-night=4480

; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1

; Set the screen brightness. Default is 1.0.
;brightness=0.9
; It is also possible to use different settings for day and night
; since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel
; individually)
gamma=0.88
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6

; Set the location-provider: 'geoclue', 'geoclue2', 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual

; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API.
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=vidmode

; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=49.110001
lon=7.070000

; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings.
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the
; second screen. If this option is not specified, Redshift will try
; to adjust _all_ screens.
[randr]
screen=1

I apologize for the inconvenience, I should have checked earlier.
Now we wait again for the night to check wallpaper.sh.  smile


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2386 2025-08-21 13:54:32

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

I found 4 images from original macos tahoe

Made this  script

#!/bin/bash
# Kill if already running
if pidof -o %PPID -x "${0##*/}"; then
  exit 1
fi
# Start loop
while :
do
# What time is it?
  CURRENT_TIME=$(date +%H%M)
  if [ -n "$NEXT_TIME" ] && [ "$CURRENT_TIME" -lt "$NEXT_TIME" ]; then
    sleep 60
    continue
  fi
# Depending on time set WALL_CHOICE & NEXT_TIME
  if [ "$CURRENT_TIME" -ge 0500 ] && [ "$CURRENT_TIME" -lt 0659 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Dawn.png
    NEXT_TIME=0700
  elif [ "$CURRENT_TIME" -ge 0700 ] && [ "$CURRENT_TIME" -le 1959 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Day.png
    NEXT_TIME=2000
elif [ "$CURRENT_TIME" -ge 2000 ] && [ "$CURRENT_TIME" -le 2059 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Dusk.png
    NEXT_TIME=2100
elif [ "$CURRENT_TIME" -ge 2100 ] && [ "$CURRENT_TIME" -le 0459 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Night.png
    NEXT_TIME=0500
  fi
# Set the chosen wallpaper
  xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitoreDP1/workspace0/last-image -s "$WALL_CHOICE"
# Sleep
  sleep 60
done

Work great on opening session & when i click at the script.sh but not when session is open since a few hours.

any idea??

tanks
@+

Last edited by loutch (2025-08-21 18:08:12)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#2387 2025-08-24 02:15:50

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

loutch wrote:

any idea??

I didn't see that the post had been edited in the meantime.

I think these lines are wrong:

elif [ "$CURRENT_TIME" -ge 2100 ] && [ "$CURRENT_TIME" -le 0459 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Night.png
    NEXT_TIME=0500

The "$CURRENT_TIME" cannot be greater (or equal) than 2100 and less (or equal) than 0459 at the same time.

It might help if you use the OR (||) instead of the AND (&&) operator:

elif [ "$CURRENT_TIME" -ge 2100 ] || [ "$CURRENT_TIME" -le 0459 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Night.png
    NEXT_TIME=0500

It's probably better to specify a range between 0000 and 0500 at the beginning:

# Depending on time set WALL_CHOICE & NEXT_TIME
  if [ "$CURRENT_TIME" -ge 0000 ] && [ "$CURRENT_TIME" -lt 0500 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Night.png
    NEXT_TIME=0500
  elif [ "$CURRENT_TIME" -ge 0500 ] && [ "$CURRENT_TIME" -lt 0700 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Dawn.png
    NEXT_TIME=0700
  elif [ "$CURRENT_TIME" -ge 0700 ] && [ "$CURRENT_TIME" -lt 2000 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Day.png
    NEXT_TIME=2000
  elif [ "$CURRENT_TIME" -ge 2000 ] && [ "$CURRENT_TIME" -lt 2100 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Dusk.png
    NEXT_TIME=2100
  elif [ "$CURRENT_TIME" -ge 2100 ] && [ "$CURRENT_TIME" -le 2359 ]; then
    WALL_CHOICE=/home/romuald/.conky/wallpaper/Tahoe/Night.png
    NEXT_TIME=0000
  fi

Also check the username (romuald) and the path.
In the previous script:

WALL_CHOICE=/home/loutch/Images/ ...

If people would know how little brain is ruling the world, they would die of fear.

Offline

#2388 2025-08-24 14:44:17

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

Re: Show us your conky

@marens,

Pmu9ca4t.png
I need your help with awk again.  wink

lsb_release -d | cut -d '-' -f2
Description:	BunsenLabs GNU/Linux 13 (Carbon)
lsb_release -d | awk '{$1=""; print $5}'
(Carbon)

How do I get rid of the two brackets?

Edit: or

lsb_release -sirc
Bunsenlabs
13
carbon

?

Edit2: Found it, would you agree?  big_smile

lsb_release -sc
carbon

Last edited by unklar (2025-08-24 15:01:19)

Offline

#2389 2025-08-24 14:58:40

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

unklar wrote:

@marens,

https://i.imgur.com/Pmu9ca4t.png
I need your help with awk again.  wink

lsb_release -d | cut -d '-' -f2
Description:	BunsenLabs GNU/Linux 13 (Carbon)
lsb_release -d | awk '{$1=""; print $5}'
(Carbon)

How do I get rid of the two brackets?

...

lsb_release -d | awk '{$1=""; print $5}' | sed 's/(//' | sed 's/)//'

EDIT
Or in capital letters:

$ echo 'Description:  BunsenLabs GNU/Linux 13 (Carbon)' | awk '{$1=""; print $5}' | sed 's/(//' | sed 's/)//' | awk '{print toupper($0)}'
CARBON

Last edited by marens (2025-08-24 15:20:20)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2390 2025-08-24 15:21:46

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

Re: Show us your conky

unklar wrote:

Found it, do you agree with me?

I am a fan of ‘brevity’ in Conky.

Thank you.  smile
(my font only allows capital letters).

Last edited by unklar (2025-08-24 15:26:02)

Offline

#2391 2025-08-24 17:12:51

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

^ You're thinking like this, 'young man'?  big_smile
https://forums.bunsenlabs.org/viewtopic … 37#p142037


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2392 2025-08-24 17:30:05

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

Re: Show us your conky

marens wrote:

^ You're thinking like this, 'young man'?  big_smile
https://forums.bunsenlabs.org/viewtopic … 37#p142037

good.gif

Yeah, those “young things”...  lauUCab.png

Offline

#2393 2025-08-28 14:32:37

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

Re: Show us your conky

In my archives, I found a Conky that I had never tested before.
Here is the link and the original files.

Surprisingly, it worked pretty painlessly with LUA on Carbon. I had to change the syntax1.10;
the many ‘offsets’ for the pixel spacing (that shifts everything too often), it's much easier with ‘goto’   wink  and I didn't have the image for the background either.
Marcello, my grandson, helped me out with Gimp. Great job!

fonts
AngelicWar
space age
saxmono

jgRk5o5t.png
marco.png
FIDPdJnt.png

conkyrc_lua10   As a special treat, I have included a glyph collection from @Sector11  big_smile  .

conky.config = {
--Fonctionnement de conky 
	total_run_times = 0,--Temps en secondes ; 0 = toujours actif
	background = true,--Pour que conky tourne en arrière plan ; no = pour les tests

--Réglages système
	cpu_avg_samples = 1,--Nb d'échantillons pour calculer la moyenne d'utilisation CPU
	net_avg_samples = 2,--Nb d'échantillons pour calculer la moyenne d'utilisation CPU

--Mémoire
	double_buffer = true,--Éviter le clignotement
	no_buffers = true,--Soustraire les mémoires tampons de la mémoire utilisée
	text_buffer_size = 1024,--Taille du cache pour le texte

--Affichage
	out_to_console = false,--Affiche le texte sur la sortie standard
	update_interval = 1,--Taux de rafraîchissement de la fenêtre (s)

--Fenêtre conky
	alignment = 'bottom_right',--left',--Alignement
-----
	minimum_width = 664, minimum_height = 600,--Taille minimum (px) ; largeur / hauteur
	maximum_width = 664,--Largeur maximum (px)
-----
	gap_x = 0,--Écart avec le bord gauche / droit
	gap_y = 0,--Écart avec le bord haut / bas
-----
	draw_shades = false,--Afficher les ombres
	draw_outline = false,--Afficher les contours de fenêtre
	draw_borders = false,--Afficher des contours autour des blocs de texte
	border_width = 1,--Largeur du contour
	border_inner_margin = 1,--Largeur des marges
-----
	own_window = true,--Utiliser sa propre fenêtre
	own_window_type = 'normal',--Type de fenêtre ; normal / override / desktop
	own_window_transparent = true,--Pseudo transparence
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',

--Mise en forme
	use_xft = true,--Utiliser Xft (polices lissées etc)
	xftalpha = .1,--Utiliser Xft
	override_utf8_locale = true,--Force l'UTF8
	uppercase = false,--Tout le texte en majuscule
	use_spacer = 'right',--Ajoute des espaces après certains objets (qu'avec des polices fixes)
-----
	font = 'saxmono:size=10',--Police par défaut
-----
	stippled_borders = 5,--Taille des pointillés

--Couleurs
	default_color = '#FFFFFF',--Couleur par défaut
	default_shade_color = '#333333',--Couleur des ombres
	default_outline_color = 'black',--Couleur des contours
-----
	color1 = '#cdced0',--Gris
	color2 = '#43b6b8',--Bleu
	color3 = '#ff6f00',--Orange

--Prise en charge du LUA
	lua_load = '/home/unklar/.conky/fin84/lua_perso',
	lua_draw_hook_post = 'cairo_draw',

--glyphen from @Sector11
--# │ ─ ┌ ┬ ┐ └ ┴ ┘ ├ ┼ ┤
--# ║ ═ ╔ ╦ ╗ ╚ ╩ ╝ ╠ ╬ ╣

--# ↑ ↓ → ← ↔ ► ◄ ▲ ▼ « »
--# ░  ▒  ▓ ☺ ☻ ♥ ♦ ♣ ♠
--# • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼
--# ¼ ½ ¾ ® ©

--#      	0 	1 	2 	3 	4 	5 	6 	7 	8 	9 	A 	B 	C 	D 	E 	F
--#U+250x 	─ 	━ 	│ 	┃ 	┄ 	┅ 	┆ 	┇ 	┈ 	┉ 	┊ 	┋ 	┌ 	┍ 	┎ 	┏
--#U+251x 	┐ 	┑ 	┒ 	┓ 	└ 	┕ 	┖ 	┗ 	┘ 	┙ 	┚ 	┛ 	├ 	┝ 	┞ 	┟
--#U+252x 	┠ 	┡ 	┢ 	┣ 	┤ 	┥ 	┦ 	┧ 	┨ 	┩ 	┪ 	┫ 	┬ 	┭ 	┮ 	┯
--#U+253x 	┰ 	┱ 	┲ 	┳ 	┴ 	┵ 	┶ 	┷ 	┸ 	┹ 	┺ 	┻ 	┼ 	┽ 	┾ 	┿
--#U+254x 	╀ 	╁ 	╂ 	╃ 	╄ 	╅ 	╆ 	╇ 	╈ 	╉ 	╊ 	╋ 	╌ 	╍ 	╎ 	╏
--#U+255x 	═ 	║ 	╒ 	╓ 	╔ 	╕ 	╖ 	╗ 	╘ 	╙ 	╚ 	╛ 	╜ 	╝ 	╞ 	╟
--#U+256x 	╠ 	╡ 	╢ 	╣ 	╤ 	╥ 	╦ 	╧ 	╨ 	╩ 	╪ 	╫ 	╬ 	╭ 	╮ 	╯
--#U+257x 	╰ 	╱ 	╲ 	╳ 	╴ 	╵ 	╶ 	╷ 	╸ 	╹ 	╺ 	╻ 	╼ 	╽ 	╾ 	╿


};

conky.text = [[
${image $HOME/.conky/fin84/image/marco.png -p -8,44 -s 660x600}
${color1}${font AngelicWar:size=23}${alignc}${offset 18}${execi 86400 lsb_release -d | cut -f2} Inside${font}



${goto 410}${voffset 65}Core 2
${goto 410}${cpu cpu2}${goto 444}%

${goto 90}${voffset 142}Core 1
${goto 90}${cpu cpu1}${goto 110}%

${voffset -85}${font space age:size=13}${goto 280}${execi 86400 lsb_release -sc}${font}

${goto 290}${color2}${uptime}
${goto 293}${color3}${if_existing /proc/net/route wlp3s0}${execi 60 aptitude search "~U" | wc -l | tail}${else}0${endif} ${color1}updates
${goto 280}${exec uname -r | cut -d '-' -f1}
${goto 275}▲ ${if_existing /proc/net/route wlp3s0}Connected${else}Disconnected${endif} ▼

${goto 410}${voffset 98}RAM
${goto 395}${voffset 13}${memperc}%${goto 462}${swapperc}%
${goto 435}${voffset 22}Swap
]];

lua_perso

dofile '/home/unklar/.conky/fin84/CCK.lua'

require 'cairo'
require 'cairo_xlib'

local bleu = CCK_couleur_rgba(0, 0.5, 0.5, 1)	--rouge, vert, bleu, 1 : couleur affichée
local rouge = CCK_couleur_rgba(1, 0, 0, 1)
local orange = CCK_couleur_rgba(1, 0.5, 0, 1)
local gris = CCK_couleur_rgba(0.2, 0.2, 0.2, 1)
local noir = CCK_couleur_rgba(0, 0, 0, 0)		--rouge, vert, bleu, 0 : couleur non affichée

--local blanc = CCK_couleur_rgba(1, 1, 1, 0.7)

local disqueCPU = CCK_disque(100, 6, 76, 2, bleu, orange, rouge, gris)	-- /s-divisions, largeur tiret, diamètre, espace
local disqueCore = CCK_disque(100, 6, 38, 1, bleu, orange, rouge, noir)

local jaugeMEM = CCK_jauge_vertical(1, 20, 10, 1, 1, bleu, orange, rouge, gris)	-- colonne, /s-divisions, largeur colonne, diamètre, espace

function conky_cairo_draw()
    if conky_window == nil then return end
    if cs == nil or cairo_xlib_surface_get_width(cs) ~= conky_window.width or cairo_xlib_surface_get_height(cs) ~= conky_window.height then
        if cs then cairo_surface_destroy(cs) end
        cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    end
    if cr then cairo_destroy(cr) end
    cr = cairo_create(cs)
    
    local core0 = tonumber(conky_parse('${cpu cpu0}'))
    if core0 == nil
    then
        CCK_dessine_disque(cr, 246, 198, disqueCPU, 0)		--écart avec bord gauche, écart avec haut
        CCK_dessine_disque(cr, 61, 239, disqueCore, 0)
        CCK_dessine_disque(cr, 397, 44, disqueCore, 0)
    else
        local core1 = tonumber(conky_parse('${cpu cpu1}'))
        local core2 = tonumber(conky_parse('${cpu cpu2}'))
        CCK_dessine_disque(cr, 246, 273, disqueCPU, core0)	--écart avec bord gauche, écart avec haut
        CCK_dessine_disque(cr, 70, 306, disqueCore, core1)
        CCK_dessine_disque(cr, 392, 128, disqueCore, core2)
    end

    local ram = tonumber(conky_parse('${memperc}'))
    local swap = tonumber(conky_parse('${swapperc}'))
    if ram ==  nil
    then
	CCK_dessine_jauge_vertical(cr, 418, 515, jaugeMEM, 0)
	CCK_dessine_jauge_vertical(cr, 448, 515, jaugeMEM, 0)
    else
	CCK_dessine_jauge_vertical(cr, 419, 515, jaugeMEM, ram)
	CCK_dessine_jauge_vertical(cr, 448, 515, jaugeMEM, swap)
    end
	
end

CCK.lua

--****************************
--#
--#    Conky Cairo Kit v1.1
--#        by Vermouth :)
--#
--***********************************************************************************
--#
--#    Les fonctions à utiliser sont celle qui commence par "CCK_".
--#    Ce fichier est à inclure dans votre script lua (au début) comme cela: 
--#        dofile "leCheminAbsolu"
--#
--#    Utilisation:
--#        Il faut d'abord créer un CCE (Conky Cairo Element) grâce aux
--#        fonction CCK_jauge_Vertical, CCK_jauge_horizontal
--#        et CCK_disque.
--#        Puis on les dessines grâve aux fonctions CCK_dessine_jauge_Vertical,
--#        CCK_dessine_jauge_horizontal et CCK_dessine_disque.
--#
--#        Vous pouvez créer des couleurs grâce à la fonction CCK_couleur_rgba.
--#
--***********************************************************************************

require 'cairo'
require 'cairo_xlib'

--###############################
--# Variable Divers
--###############################
--variable d'indice
local CCK_ESPACEMENT = 1
local CCK_COULEUR_DEBUT = 2
local CCK_COULEUR_MILLIEU = 3
local CCK_COULEUR_FIN = 4
local CCK_COULEUR_VIDE = 5
local CCK_DEGRADE = 6

--###############################
--# Couleurs
--###############################
--indice rgba
local r = 1;
local g = 2;
local b = 3;
local a = 4;
--fonction pour créer une couleur rgba
function CCK_couleur_rgba(cr, cg, cb, ca)
    t={};
    t[r]=cr;
    t[g]=cg;
    t[b]=cb;
    t[a]=ca;
    return t;
end
--divers
function add_stop_color(degrade, offset, couleur)
    cairo_pattern_add_color_stop_rgba (degrade, offset,
        couleur[r], couleur[g], couleur[b], couleur[a]);
end


--###############################
--# Jauge
--###############################
--variable d'indice
local JAUGE_NB_COLONNE = 7
local JAUGE_NB_LIGNE = 8
local JAUGE_LARGEUR = 9
local JAUGE_HAUTEUR = 10
--créer une jauge
function jauge(nb_colonne, nb_ligne, largeur_case, hauteur_case, espacement, couleur_vide)
    param = {}
    param[JAUGE_NB_COLONNE] = nb_colonne
    param[JAUGE_NB_LIGNE] = nb_ligne
    param[JAUGE_LARGEUR] = largeur_case
    param[JAUGE_HAUTEUR] = hauteur_case
    param[CCK_ESPACEMENT] = espacement
    param[CCK_COULEUR_VIDE] = couleur_vide
    
    return param
end

function CCK_jauge_vertical(nb_colonne, nb_ligne, largeur_case, hauteur_case, espacement,
        couleur_bas, couleur_millieu, couleur_haut, couleur_vide)
    param = jauge(nb_colonne, nb_ligne, largeur_case, hauteur_case, espacement, couleur_vide)
    
    degrade = cairo_pattern_create_linear(0, 0, 0, nb_ligne*hauteur_case + (nb_ligne-1)*espacement);
    add_stop_color(degrade, 0, couleur_haut);
    add_stop_color(degrade, 0.5, couleur_millieu);
    add_stop_color(degrade, 1, couleur_bas);
    param[CCK_DEGRADE] = degrade
    
    return param
end

function CCK_jauge_horizontal(nb_colonne, nb_ligne, largeur_case, hauteur_case, espacement,
        couleur_gauche, couleur_millieu, couleur_droite, couleur_vide)
    param = jauge(nb_colonne, nb_ligne, largeur_case, hauteur_case, espacement, couleur_vide)
    
    degrade = cairo_pattern_create_linear(0, 0, nb_colonne*largeur_case + (nb_colonne-1)*espacement, 0);
    add_stop_color(degrade, 0, couleur_gauche);
    add_stop_color(degrade, 0.5, couleur_millieu);
    add_stop_color(degrade, 1, couleur_droite);
    param[CCK_DEGRADE] = degrade
    
    return param
end

--dessiner une jauge
function CCK_dessine_jauge_vertical(cr, x, y, jauge, pc)
    cairo_save(cr)
    cairo_translate(cr, x, y)
    
    local nb_case = jauge[JAUGE_NB_COLONNE]*jauge[JAUGE_NB_LIGNE]
    local sautH = jauge[JAUGE_LARGEUR]+jauge[CCK_ESPACEMENT]
    local sautV = jauge[JAUGE_HAUTEUR]+jauge[CCK_ESPACEMENT]
    local X = 0
    local Y = 0
    local case_pleine = math.floor(nb_case*(tonumber(pc)/100))
    local case_vide = nb_case - case_pleine
    
    
    --toute les lignes vides
    local count = case_vide
    while count >= jauge[JAUGE_NB_COLONNE] do
        for i = 0,(jauge[JAUGE_NB_COLONNE]-1) do
            cairo_rectangle(cr, i*sautH, Y, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
        end
        Y = Y+sautV
        count = count-jauge[JAUGE_NB_COLONNE]
    end
    cairo_set_source_rgba(cr, jauge[CCK_COULEUR_VIDE][r], jauge[CCK_COULEUR_VIDE][g], jauge[CCK_COULEUR_VIDE][b], jauge[CCK_COULEUR_VIDE][a])
    cairo_fill(cr)
    
    
    --ligne ni vide ni remplie
    local reste = math.fmod(case_pleine, jauge[JAUGE_NB_COLONNE])
    if reste > 0 then
        for i = 1,reste do
            cairo_rectangle(cr, X, Y, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
            X = X+sautH
            count = count-1
        end
        cairo_set_source(cr, jauge[CCK_DEGRADE])
        cairo_fill(cr)
        
        for i = reste,(jauge[JAUGE_NB_COLONNE]-1) do
            cairo_rectangle(cr, X, Y, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
            X = X+sautH
            count = count-1
        end
        cairo_set_source_rgba(cr, jauge[CCK_COULEUR_VIDE][r], jauge[CCK_COULEUR_VIDE][g], jauge[CCK_COULEUR_VIDE][b], jauge[CCK_COULEUR_VIDE][a])
        cairo_fill(cr)
        
        Y = Y+sautV
    end
    
    
    --ligne pleine
    cairo_set_source(cr, jauge[CCK_DEGRADE])
    count = case_pleine
    while count >= jauge[JAUGE_NB_COLONNE] do
        for i = 0,(jauge[JAUGE_NB_COLONNE]-1) do
            cairo_rectangle(cr, i*sautH, Y, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
        end
        Y = Y+sautV
        count = count-jauge[JAUGE_NB_COLONNE]
    end
    cairo_fill(cr)
    
    cairo_restore(cr)
end

function CCK_dessine_jauge_horizontal(cr, x, y, jauge, pc)
    cairo_save(cr)
    cairo_translate(cr, x, y)
    
    local nb_case = jauge[JAUGE_NB_COLONNE]*jauge[JAUGE_NB_LIGNE]
    local sautH = jauge[JAUGE_LARGEUR]+jauge[CCK_ESPACEMENT]
    local sautV = jauge[JAUGE_HAUTEUR]+jauge[CCK_ESPACEMENT]
    local X = 0
    local Y = 0
    local case_pleine = math.floor(nb_case*(tonumber(pc)/100))
    local case_vide = nb_case - case_pleine
    
    
    --toute les colonne vides
    local count = case_pleine
    while count >= jauge[JAUGE_NB_LIGNE] do
        for i = 0,(jauge[JAUGE_NB_LIGNE]-1) do
            cairo_rectangle(cr, X, i*sautV, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
        end
        X = X+sautH
        count = count-jauge[JAUGE_NB_LIGNE]
    end
    cairo_set_source(cr, jauge[CCK_DEGRADE])
    cairo_fill(cr)
    
    
    --colonne ni vide ni remplie
    local reste = math.fmod(case_pleine, jauge[JAUGE_NB_LIGNE])
    if reste > 0 then
        for i = 1,reste do
            cairo_rectangle(cr, X, Y, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
            Y = Y+sautV
            count = count-1
        end
        cairo_set_source(cr, jauge[CCK_DEGRADE])
        cairo_fill(cr)
        
        for i = reste,(jauge[JAUGE_NB_LIGNE]-1) do
            cairo_rectangle(cr, X, Y, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
            Y = Y+sautV
            count = count-1
        end
        cairo_set_source_rgba(cr, jauge[CCK_COULEUR_VIDE][r], jauge[CCK_COULEUR_VIDE][g], jauge[CCK_COULEUR_VIDE][b], jauge[CCK_COULEUR_VIDE][a])
        cairo_fill(cr)
        
        X = X+sautH
    end
    
    
    --colonne pleine
    count = case_vide
    while count >= jauge[JAUGE_NB_LIGNE] do
        for i = 0,(jauge[JAUGE_NB_LIGNE]-1) do
            cairo_rectangle(cr, X, i*sautV, jauge[JAUGE_LARGEUR], jauge[JAUGE_HAUTEUR])
        end
        X = X+sautH
        count = count-jauge[JAUGE_NB_LIGNE]
    end
    cairo_set_source_rgba(cr, jauge[CCK_COULEUR_VIDE][r], jauge[CCK_COULEUR_VIDE][g], jauge[CCK_COULEUR_VIDE][b], jauge[CCK_COULEUR_VIDE][a])
    cairo_fill(cr)
    
    cairo_restore(cr)
end


--###############################
--# Disque
--###############################
--variable d'indice
local DISQUE_NB_MORCEAU = 11
local DISQUE_EPAISSEUR = 12
local DISQUE_RAYON = 13
local DISQUE_COULEURS = 14
--créer un disque
function CCK_disque(nb_morceau, epaisseur, rayon, espacement,
        couleur_debut, couleur_millieu, couleur_fin, couleur_vide)
    param = {}
    
    param[DISQUE_NB_MORCEAU] = nb_morceau
    param[DISQUE_EPAISSEUR] = epaisseur
    param[DISQUE_RAYON] = rayon
    param[CCK_ESPACEMENT] = espacement
    param[CCK_COULEUR_VIDE] = couleur_vide
    
    couleurs = {}
    local temp = nb_morceau/2
    local i = 0;
    while i < temp do
        local ratio_1 = i/(temp)
        local ratio = 1-ratio_1--ratio^-1
        couleurs[i] = {}
        couleurs[i][r] = couleur_debut[r]*ratio + couleur_millieu[r]*ratio_1
        couleurs[i][g] = couleur_debut[g]*ratio + couleur_millieu[g]*ratio_1
        couleurs[i][b] = couleur_debut[b]*ratio + couleur_millieu[b]*ratio_1
        couleurs[i][a] = couleur_debut[a]*ratio + couleur_millieu[a]*ratio_1
        i = i +1;
    end
    
    temp = nb_morceau-temp
    local j = 0
    while j < temp do
        local ratio_1 = j/temp
        local ratio = 1-ratio_1--ratio^-1
        couleurs[i] = {}
        couleurs[i][r] = couleur_millieu[r]*ratio + couleur_fin[r]*ratio_1
        couleurs[i][g] = couleur_millieu[g]*ratio + couleur_fin[g]*ratio_1
        couleurs[i][b] = couleur_millieu[b]*ratio + couleur_fin[b]*ratio_1
        couleurs[i][a] = couleur_millieu[a]*ratio + couleur_fin[a]*ratio_1
        i = i +1;
        j = j+1
    end
    param[DISQUE_COULEURS] = couleurs
    
    return param
end

--dessiner un disque
local rpd = math.pi/180.0--radiant par degré
function CCK_dessine_disque(cr, x, y, disque, pc)
    cairo_save(cr)
    cairo_translate(cr, x, y)
    
    local X = disque[DISQUE_RAYON]+(disque[DISQUE_EPAISSEUR]/2);
    local Y = X;
    local couleurs_disque = disque[DISQUE_COULEURS]
    cairo_set_line_width(cr,disque[DISQUE_EPAISSEUR])
    local taille_morceau_disque = (360/disque[DISQUE_NB_MORCEAU])-disque[CCK_ESPACEMENT]
    local tmp = pc/(100/disque[DISQUE_NB_MORCEAU])
    
    local count = 0
    local angle = 0
--~     cairo_set_source(cr, degrade_disque)
    cairo_set_source_rgba(cr, 1, 0, 0, 1);
    while count < tmp do
        cairo_arc(cr, X, Y, disque[DISQUE_RAYON], angle*rpd, (angle+taille_morceau_disque)*rpd)
        cairo_set_source_rgba(cr, couleurs_disque[count][r],
        couleurs_disque[count][g],
        couleurs_disque[count][b],
        couleurs_disque[count][a])
        angle = angle+taille_morceau_disque+disque[CCK_ESPACEMENT]
        cairo_stroke(cr)
        count=count+1
    end
    
    cairo_set_source_rgba(cr, disque[CCK_COULEUR_VIDE][r], disque[CCK_COULEUR_VIDE][g], disque[CCK_COULEUR_VIDE][b], disque[CCK_COULEUR_VIDE][a]);
    while count < disque[DISQUE_NB_MORCEAU] do
        cairo_arc(cr, X, Y, disque[DISQUE_RAYON], angle*rpd, (angle+taille_morceau_disque)*rpd)
        angle = angle+taille_morceau_disque+disque[CCK_ESPACEMENT]
        cairo_stroke(cr)
        count=count+1
    end
    
    cairo_restore(cr)
end

Have fun!

Last edited by unklar (2025-08-28 14:43:50)

Offline

#2394 2025-08-28 17:32:40

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

^ It looks very good on a light green background.
Your grandson is talented.

However, I must admit, I wasn't expecting the Ubuntu logo.
I thought the words Ubuntu and @unklar couldn't be in the same sentence.  big_smile

EDIT
I downloaded the image marco.png and played around a bit in the HOME folder using ImageMagick:

$ convert -define modulate:colorspace=HSB marco.png -modulate 100,100,200 test-red.png

$ convert -define modulate:colorspace=HSB marco.png -modulate 100,100,220 test-yellow.png

$ convert -define modulate:colorspace=HSB marco.png -modulate 100,100,120 test-blue.png

test-red.png  test-yellow.png  test-blue.png

And of course gray:

$ convert marco.png -colorspace gray test-gray.png

test-gray.png

Thanks to the grandson, you can now set a logo for any background.

Last edited by marens (2025-08-29 01:58:20)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2395 2025-08-29 10:32:49

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

Re: Show us your conky

Excellent!
All saved. Thank you very much.  smile

marens wrote:

Your grandson is talented.

Oh yes, at ‘only’ 15 years old, he beats all the members of the family. We are very proud of him.

I thought the words Ubuntu and @unklar couldn't be in the same sentence.  big_smile

Correctly identified, you are a ‘fox’.  big_smile
However, I would like to emphasize(!) that *ubuntu* has the best wiki in the world(and, very good people).

Offline

#2396 2025-08-29 13:24:20

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

unklar wrote:

However, I would like to emphasize(!) that *ubuntu* has the best wiki in the world(and, very good people).

People often forget or don't know that Ubuntu is based on Debian.
https://en.wikipedia.org/wiki/Ubuntu

Ubuntu wrote:

Ubuntu is an ancient African word meaning ‘humanity to others’. It is often described as reminding us that ‘I am what I am because of who we all are’. We bring the spirit of Ubuntu to the world of computers and software.

https://ubuntu.com/about

I like this way of thinking.

It's true that I don't like the British company Canonical being involved in the project.
There have been some strange attempts in the past, but advanced users immediately issued a warning and it all ended with many apologies.

It is still free open source software.  smile


If people would know how little brain is ruling the world, they would die of fear.

Offline

#2397 2025-08-30 01:30:37

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,547
Website

Re: Show us your conky

marens wrote:

It's true that I don't like the British company Canonical being involved in the project.

Canonical belongs to the South African Mark Shuttleworth who founded Ubuntu, so it's hard to avoid their being "involved" in the project. smile


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#2398 2025-08-30 02:48:21

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 827

Re: Show us your conky

^ Yes, you're right.

For me:
Ubuntu = Canonical + Community

Companies are not charities and exist to make a profit.
As far as I know, Canonical is doing well, but it has to take care of the community.
The community is here to care about user privacy and to help Canonical developers with ideas, solutions, and advice.

So far everything seems fine.


If people would know how little brain is ruling the world, they would die of fear.

Offline

Board footer

Powered by FluxBB