Need help with Conky Mizar clock widget please [SOLVED]

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
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Koentje »

Logansfury wrote: Mon Jan 22, 2024 11:21 pm That sounds like a fun project to set up!

I would be happy for the scripts and instructions when you've time :)
Ok, will do!
But it's 5 in the morning and i think i'm going to sleep for a few hours... ;)
Image
User avatar
Bleys
Level 4
Level 4
Posts: 431
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Need help with Conky Mizar clock widget please

Post by Bleys »

zcot wrote: Mon Jan 22, 2024 11:30 pm
Bleys wrote: Mon Jan 22, 2024 12:06 pm
What desktop are you on? and that's Mint 21?
Mint 21.3 Cinnamon
Screen Capture_select-area_20240123061359.jpg
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Koentje »

Very cool desktop, Bleys! 8)
Image
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Koentje »

Logansfury wrote: Mon Jan 22, 2024 11:21 pm That sounds like a fun project to set up!

I would be happy for the scripts and instructions when you've time :)
If you're still interested, i have customized the script so you have to do minimal work to get it running. It uses webfsd as a simple http server.

readme.txt

Code: Select all


***  INXI-REPORT VERSION 1.1  ***

Inxi-report is a small http server that presents an inxi report of your system to the world.
You can use this on forums with a button in your signature. This way if you have troubles
with your computer anybody can see your system specs in a click. A fresh report every hour!

* inxi-report.sh
  This bash script needs to be started at desktop login via "autostart programs" or at boot
  via /etc/rc.local. It's a loop that makes a fresh report every hour of the day.

* inxi-report.conf
  A few settings for server port, server docroot and inxi commandline.

* server
  This starts the webfsd server and can only be started from within inxi-report.

* server.log
  Shows all connect activity from server

* inxi.png
  If this png file is present, it will be copied to the docroot of the server at every start.
  This way you can use your own inxi.png as button in your signature.

  This script depends on webfsd, aha and inxi. You can install them in one pass with:
   sudo apt install webfsd aha inxi


  At the forum use the following BBCode in your signature to show the inxi button with link to
  your inxi-report:

  [url=http://<ip>:<port>/index.html][img]https://www.cobrasoft.nl/pics/inxi/pinxi.png[/img][/url]

  <ip>   = your wan IP address or DDNS name
  <port> = port number to your server

  If you want another png file to show as button, change the url to that image between the [img] tags.


Have fun!

Scripted by Koentje  (lowrida007@gmail.com)  (c) Cobrasoft


Download
inxi-report-v1.1.tar.gz
(7.22 KiB) Downloaded 37 times
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

If you're still interested, i have customized the script so you have to do minimal work to get it running. It uses webfsd as a simple http server.
Good Evening,

I have been under the weather all day so I just now got to the comp and saw this. A few noob questions:

I have created a readme.txt file and pasted your provided code into it. I am unsure where on my system it needs to go. I'm assuming the folder the tar.gz creates?

I have downloaded the tar.gz. After extraction, where do I place the folder it creates?

are any terminal commands necessary to get it going once everything is extracted and placed where it needs to be?

Thanks :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

Bleys,

That is a beautiful GUI!

May I ask if you can share the code for the calendar?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Koentje »

Logansfury wrote: Tue Jan 23, 2024 11:51 pm I have created a readme.txt file and pasted your provided code into it. I am unsure where on my system it needs to go.
:lol: :lol: :lol: Thanks for the laugh!
No that was just a copy/paste out of the readme.txt for explanation. Nothing code about it. ;)

I have downloaded the tar.gz. After extraction, where do I place the folder it creates?
You can place it anywhere you want. Preferable in your home folder.
are any terminal commands necessary to get it going once everything is extracted and placed where it needs to be?
That's were the readme.txt is for! Read it!
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

LOL

I think were on the same page now.

I'll hit the readme.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Koentje »

I would place all files in ~/.inxi-report and in that folder make a subfolder www. Then in inxi-report.conf set the docroot path to "$HOME/.inxi-report/www" subfolder. This way you keep it all in one main folder.
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

My ISP has after 30+ years of controlling ports thru going to the router via any web-browser, decided to go app route. But they didn't merely add an android app for controlling the router, oh no, the idiots REMOVED all router controls from the webpage and replaced the controls with a message that all changes must now be done thru the app.

So I fired up the app, clicked everything that could be selected, and nothing makes any reference to controlling ports whatsoever. Im on the phone with my ISP now with a service rep that doesn't know how to do it either and is trying to figure out where to transfer me....

I got my button active on my profile, but with the port closed, clicking it led to an error page that displayed my wan IP. I didn't like that at all so I removed the button code from my sig until such time as I can resume control of my ports.

Stupid ISP....
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

OK I got the port issue resolved, but the button now displays my public IP when hovered over, and doesn't display and inxi output when I click on it >.<
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Bleys
Level 4
Level 4
Posts: 431
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Bleys »

Logansfury wrote: Wed Jan 24, 2024 1:55 am Bleys,

That is a beautiful GUI!

May I ask if you can share the code for the calendar?
There you go:
conkyrc:

Code: Select all

conky.config = {
-- — Conky settings

	background = false,
	update_interval = 1,
	total_run_times = 0,
	no_buffers = true,
	
	draw_graph_borders = true,
	draw_outline = false,

-- — Window specifications with Background

--	own_window = true,
--	own_window_type = desktop,
--  	own_window_transparent = false,
--	own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
--	own_window_argb_visual = true,
--	own_window_argb_value = 0,
--	own_window_colour = '000000', 
	

-- — Window specifications with Shadow

	own_window = true,
    	own_window_transparent = true,
	own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',

--  end 
	
	double_buffer = true,
	minimum_width = 130, minimum_height = 100, --ring

-- — Position on Desktop / Lage auf dem Desktop festlegen
	alignment = 'top_left',
	gap_x = 50,
	gap_y = 50,
	
	border_inner_margin = 10,

-- Lua Load
    	lua_load = './cal.lua',
	lua_draw_hook_post = 'main',

};
conky.text = [[

]];

cal.lua:

Code: Select all

--[[
2023 Bleys
Screenshot ist im ersten Kommentar. (gist.github)
Änderungen des Font (Ubuntu Mono) und/oder der Schriftgröße erfordern auch eine Anpassung der Berechnung der Hintergrund Berechnung!
Das sollte man nur machen wenn man weis was man tut...

Screenshot in first Comment
Changing the font (Ubuntu Mono) and font size also requires an adjustment of the background calculation for the current day!
Only change if you know what you are doing!

mainx, mainy innerhalb der Funktion calendar bestimmen die Position des Kalenders.
mainx, mainy within the calendar function determine the position of the calendar.

--    color=0xffffff   --weiß / white
--    color=0x000000   --schwarz / black
--    color=0x0000ff   --blau / blue
--    color=0xffff00   --gelb / yellow
--    color=0xff0000   --rot / red
--    color=0x00ff00   --grün / green

]]
require 'cairo'
require "math"
function rgb_to_rgba(color,alpha)
	return ((color / 0x10000) % 0x100) / 255., ((color / 0x100) % 0x100) / 255., (color % 0x100) / 255., alpha
end
function draw_day(cr,xx,yy,bcolor,balpha) -- zeichne Hintergrund für aktuellen Tag / draw current Day Background 
    local corner_r=20
    local bg_color=0xff0000   --rot / red (Farbe/Color))
    local bg_alpha=0.5
	local w=15
	local h=12
    local x=xx
    local y=yy
	cairo_set_source_rgba(cr,rgb_to_rgba(bcolor,balpha))	
	cairo_move_to(cr,x,y)
	cairo_line_to(cr,x+w,y)
	cairo_line_to(cr,x+w,y+h)
	cairo_line_to(cr,x,y+h)
	cairo_line_to(cr,x,y)
	cairo_close_path(cr)
--	cairo_stroke(cr) -- Markierung "Heute" durch Umrandung / Marking today by border
	cairo_fill(cr) -- Markierung "Heute" durch Hintergrund / Marking today by background
end
function draw_bg(cr,color,alpha,typ) -- zeichne Hintergrund Conky Fenster / draw Conky Area Background
    local corner_r=0
    local bg_color=color 
    local bg_alpha=alpha
	local w=conky_window.width
	local h=conky_window.height
	cairo_set_source_rgba(cr,rgb_to_rgba(bg_color,bg_alpha))
	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)
	
    if typ==1 then
	    cairo_fill(cr)
    else
        cairo_stroke(cr)
    end
end 

function write_text(cr, x, y, text, f)
--write_text(cr, x, y, text, {})
--font attributes (Schriftattribute zuweisen oder default Werte annehmen)
      local font=f.font or "Noto Sans"
      local size=f.size or 10
      local align=f.align or 'l'
      local bold=f.bold or false
      local ital=f.italic or false
      local color=f.color or "0xffffff"
      local slant=CAIRO_FONT_SLANT_NORMAL
      if ital then slant=CAIRO_FONT_SLANT_ITALIC end
      local weight=CAIRO_FONT_WEIGHT_NORMAL
      if bold then weight=CAIRO_FONT_WEIGHT_BOLD end

--Text Size (Textgröße für die Plazierung bestimmen.)
      local x_a=0
      local y_a=0
      local te = cairo_text_extents_t:create()
      tolua.takeownership(te)
      cairo_select_font_face (cr, font, slant, weight)
      cairo_set_font_size (cr, size)
      cairo_text_extents (cr, text, te)

--Text Position
      if align=='c' then
        x_a = -(te.width/2+te.x_bearing)
        y_a = -(te.height/2+te.y_bearing)
      end
      if align=='r' then
        x_a = -(te.width+te.x_bearing)
        --y_a = -(te.height+te.y_bearing)
      end

--Schadow 1 Pixel (Schatten für den Text um 1 Pixel versetzt)
      cairo_set_source_rgba(cr, rgb_to_rgba(0x000000,1))

      cairo_move_to (cr, x+1+x_a, y+1+y_a)
      cairo_show_text (cr, text)
      cairo_stroke(cr)

-- Now Text on Top (nun den Text oben drauf)
      cairo_set_source_rgba(cr, rgb_to_rgba(color,1))
      cairo_move_to (cr, x+x_a, y+y_a)
      cairo_show_text (cr, text)
      cairo_stroke(cr)
end

function calendar(cr)
-- x, y Koordinaten für den Kalender (oben, links) / x, y coordinates for the calendar (top, left)
    local mainx=10
    local mainy=32
-- End(e) x,y
-- Parameter Grid Berechnung Monat / Parameters grid calculation month
    local time=os.time{year=os.date("%Y"), month=os.date("%m"), day=1}
    local weekday=os.date("%w", time)
    local mon=tonumber(os.date("%m"))+1
    local time=os.time{year=os.date("%Y"), month=mon, day=0}
    local lastday=tonumber(os.date("%d", time))
    local day=tonumber(os.date("%d"))
    local weekday=tonumber(weekday)
    local start=1
    local posabsbg=0
    if weekday == 0 then
        start=-5
        posabsbg=day+6
    else
        start=(weekday-2)*-1
        posabsbg=day+weekday-1
    end
    local count=0
    local week=1
    local wd={}
    local we={}
    local workdays=""
    local weekend=""
    local bcolor=0xff0000 -- Farbe aktueller Tag / Color current Day
    local balpha=0.5 -- Alpha aktueller Tag /Alpha current Day
-- Ende Berechnung / end Calculation
-- Berechnung aktueller Tag Hintergrund / calculate current day Background
    local yposbg=math.floor(((posabsbg-posabsbg%7)/7)*12+mainy+20)
    if math.floor(posabsbg%7)==0 then yposbg=math.floor(((posabsbg-posabsbg%7)/7-1)*12+mainy+20) end
    local xposbg=math.floor((posabsbg%7)*18+mainx-13)
    if math.floor(posabsbg%7)==0 then xposbg=math.floor((posabsbg%7+7)*18+mainx-13) end
    draw_day(cr,xposbg,yposbg,bcolor,balpha) -- Funktion Hintergrund aktueller Tag / Function Highlight current Day
-- Ende Berechnung aktueller Tag Hintergrund / calculate today Background
-- Monatsübersicht zusammenstellen / Compile monthly overview
    for i=start,lastday do
        if i<1 then -- old Month
            if (start==-5 and i==0) then -- Weekend
                weekend=weekend.."   "
            else -- Work Days
                workdays=workdays.."   "
            end
        else
            if i<10 then
                if count<5 then
                    workdays=workdays.."  "..i
                else
                    weekend=weekend.."  "..i
                end
            else
                if count<5 then
                    workdays=workdays.." "..i
                else
                    weekend=weekend.." "..i
                end
            end
        end
        count=count+1
        if ( count == 7 or i == lastday ) then
            wd[week]=workdays
            we[week]=weekend
            week=week+1
            workdays=""
            weekend=""
            count=0
        end
    end
-- Ende Monatsübersicht zusammenstellen / End Compile monthly overview
-- Schreiben... / write...
    write_text(cr, mainx+66, mainy-16, os.date("%B").." "..os.date("%Y"), {font="Dyuthi", size=14, align="c"}) 
    write_text(cr, mainx+1, mainy+17, " Mo Di Mi Do Fr ", {font="Ubuntu Mono", size=12, bold=true, align="l"})     
    write_text(cr, mainx+91, mainy+17, " Sa So", {font="Ubuntu Mono", size=12, bold=true, color="0x0ab1ff", align="l"}) 
    for w=1,week do
        wy=mainy+30+((w-1)*12)
        wx=mainx+90
        write_text(cr, mainx, wy, wd[w], {font="Ubuntu Mono", size=12, align="l"})
        write_text(cr, wx, wy, we[w], {font="Ubuntu Mono", size=12, align="l", color="0x1e90ff"}) -- Farbe/Color WE
    end
-- Ende Schreiben / End write
end

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)	
	local cr=cairo_create(cs)		
	local updates=conky_parse('${updates}')
	update_num=tonumber(updates)
	if update_num>5 then
        color=0xffffff  alpha=0.1   typ=1
        draw_bg(cr,color,alpha,typ) -- Funktion Hintergrund Conky Bereich / Function Backgrounds Conky Area
        color=0xffffff  alpha=0.8   typ=2
--        draw_bg(cr,color,alpha,typ) --zeichne Linie um den Bereich / Draw line around Conky Area
        calendar(cr) -- Hauptfunktion erzeuge / Main
	end

   cairo_surface_destroy(cs)
   cairo_destroy(cr)
end
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

Bleys wrote: Wed Jan 24, 2024 8:44 am There you go:
Thank you so much for the code!

I had a mispaste that set me back for a bit then I discovered it and now the calendar is running beautifully
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Koentje »

Logansfury wrote: Wed Jan 24, 2024 8:38 am OK I got the port issue resolved, but the button now displays my public IP when hovered over, and doesn't display and inxi output when I click on it >.<
Is it ok if we figure this out via pm?
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

Is it ok if we figure this out via pm?
Absolutely!
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help with Conky Mizar clock widget please [SOLVED]

Post by Logansfury »

Bleys wrote: Wed Jan 24, 2024 8:44 am There you go:
I'm having a few customization issues, going to open a new thread dedicated to the calendar
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”