Need help to edit .lua file for next and previous month displays [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
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Need help to edit .lua file for next and previous month displays

Post by Logansfury »

Logansfury wrote: Wed Jan 31, 2024 7:02 am My conkyrc is only displaying last month not current or next, using the .lua you just posted.

May I have the conkyrc you are working with please?
I just edited teh minimum width from 130 to 390 and now I see all 3 calendars :)
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 to edit .lua file for next and previous month displays

Post by Bleys »

Logansfury wrote: Wed Jan 31, 2024 7:02 am My conkyrc is only displaying last month not current or next, using the .lua you just posted.

May I have the conkyrc you are working with please?
Of course you have to adjust min width and height to the displayed months!

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 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 = 530, -- vertikal 5 Monate
	minimum_width = 400, minimum_height = 100, -- horizontal 3 Monate

-- — 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 = [[

]];

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 to edit .lua file for next and previous month displays

Post by Logansfury »

Bleys wrote: Wed Jan 31, 2024 7:29 am
Of course you have to adjust min width and height to the displayed months!
I'm pulling an all-nighter, my mind is a void >.<

Here is my progress: I set bg to fully transparent, translated weekday names to english abbreviations, changed weekend blue color to yellow to better match my color theme. I think it looks beautiful:

Image

Thank you so much and I'm happy to test anything you need run from another's machine for feedback/troubleshooting :)
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Is it possible to change the month and year fonts without affecting the days of the week and day numerals formatting?
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 to edit .lua file for next and previous month displays

Post by Bleys »

Logansfury wrote: Wed Jan 31, 2024 7:38 am Is it possible to change the month and year fonts without affecting the days of the week and day numerals formatting?
yes
Depending on the width of the selected font, it may be necessary to adjust x and y. Line 207
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Bleys wrote: Wed Jan 31, 2024 7:45 am
Logansfury wrote: Wed Jan 31, 2024 7:38 am Is it possible to change the month and year fonts without affecting the days of the week and day numerals formatting?
yes
Depending on the width of the selected font, it may be necessary to adjust x and y. Line 207
WOOT! I put my font into line 207 left everything else alone and restarted the calendars. Month/Year display is still formatted in center of calendars and blends right in with the rest of my GUI text :D

Image
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 to edit .lua file for next and previous month displays

Post by Bleys »

Logansfury wrote: Wed Jan 31, 2024 7:54 am WOOT! I put my font into line 207 left everything else alone and restarted the calendars. Month/Year display is still formatted in center of calendars and blends right in with the rest of my GUI text :D
i'm getting old... Line 207: align="c" -- c=center
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 to edit .lua file for next and previous month displays

Post by Logansfury »

I have had the calendar installed on the Dell Linux Box since early this morning. I have got Neon 80s font in all 3 month and year displays, the weekend days and numerals are now yellow instead of blue, and the box around the current day has been changed from 0.5 alpha red to 255 alpha black. The box was completely lost against my full color wallpaper.

Image

Is it possible to have control of the color of the daily numeral as well as control of color of the box?
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 to edit .lua file for next and previous month displays

Post by Bleys »

Logansfury wrote: Wed Jan 31, 2024 2:20 pm
Is it possible to have control of the color of the daily numeral as well as control of color of the box?
I chose the box because the variant, current day colored, would make the code about 30-40% larger and I wanted to keep the calendar code minimal.

However, you can choose a border instead of a box:
Comment out line 44 (cairo_fill(cr))
Comment in line 43 (cairo_stroke(cr))

In order to be able to set the line thickness, I have added a corresponding line:
Line 42 (cairo_set_line_width(cr,3))

Code: Select all

    	cairo_set_line_width(cr,3)
	cairo_stroke(cr) -- Markierung "Heute" durch Umrandung / Marking today by border
--	cairo_fill(cr) -- Markierung "Heute" durch Hintergrund / Marking today by background
Screen Capture_select-area_20240131212156.jpg
Screen Capture_select-area_20240131212156.jpg (15.32 KiB) Viewed 579 times
Ryzen 5 5600G, 16GB RAM, 2TB M.2 Crucial P3, Asrock Deskmeet X300, Samsung Odyssey 49", Linux Mint 21
User avatar
Bleys
Level 4
Level 4
Posts: 431
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Need help to edit .lua file for next and previous month displays

Post by Bleys »

but I can build a calendar that deals with each day individually. This also offers the possibility to add colors and/or font styles to holidays, dates, anniversaries, etc. individually. But it will take some time.
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Code: Select all

    	cairo_set_line_width(cr,3)
	cairo_stroke(cr) -- Markierung "Heute" durch Umrandung / Marking today by border
--	cairo_fill(cr) -- Markierung "Heute" durch Hintergrund / Marking today by background
I have performed this edit, and switched the box color from black to white. The white box around the white numerals with black dropshadow looks great!

Thank you Bleys!
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Bleys wrote: Wed Jan 31, 2024 4:32 pm but I can build a calendar that deals with each day individually. This also offers the possibility to add colors and/or font styles to holidays, dates, anniversaries, etc. individually. But it will take some time.
I will be happy to test out any features you care to take the time to code :)
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Logansfury wrote: Wed Jan 31, 2024 4:34 pm

Code: Select all

    	cairo_set_line_width(cr,3)
	cairo_stroke(cr) -- Markierung "Heute" durch Umrandung / Marking today by border
--	cairo_fill(cr) -- Markierung "Heute" durch Hintergrund / Marking today by background
I have performed this edit, and switched the box color from black to white. The white box around the white numerals with black dropshadow looks great!

Thank you Bleys!
I gave a shot at editing set_line_width to cr,2 from cr,3 and the box looks much sharper!
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 to edit .lua file for next and previous month displays

Post by Koentje »

Bleys, can you translate your comments in the script to english? I can read them, but makes it much easier for our english users.
Image
User avatar
Bleys
Level 4
Level 4
Posts: 431
Joined: Wed Apr 20, 2022 4:17 am
Location: Essen, Germany

Re: Need help to edit .lua file for next and previous month displays

Post by Bleys »

Koentje wrote: Wed Jan 31, 2024 7:54 pm Bleys, can you translate your comments in the script to english? I can read them, but makes it much easier for our english users.
Of course. I still have to clean up the code and I'll also adapt the descriptions. And then I'll post the result in my gists.
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Bleys wrote: Wed Jan 31, 2024 10:15 pm
Koentje wrote: Wed Jan 31, 2024 7:54 pm Bleys, can you translate your comments in the script to english? I can read them, but makes it much easier for our english users.
Of course. I still have to clean up the code and I'll also adapt the descriptions. And then I'll post the result in my gists.
Bleys I have seen your desktops on the 2024 "show off your desktop" thread. You make some of the most exquisite .lua conkys I have ever seen.

I really appreciate the time and work you are going to to share these and I'm sure a lot of thread lurkers are benefiting as well :)
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Bleys wrote: Wed Jan 31, 2024 10:15 pm Of course. I still have to clean up the code and I'll also adapt the descriptions. And then I'll post the result in my gists.

Hey Bleys,

Forgive my ignorance, but what does "I'll post the result in my gists" mean? I draw a complete blank at "gists" Is that referring to posting here or to a repository for scripts that you maintain?

Also for anyone following the thread to get their own calendar, I have made a little addition to the calendar display - Day and Week # of current Year:

Image

This is it's own little conky, based on the .conf file that defines the font, color, and sizes for my Minimalis display:

Code: Select all

conky.config = {
    alignment = 'top_middle',
    background = true,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'gray',
    default_outline_color = 'black',
    default_shade_color = 'white',
    color0 = '#ffffff',
    color1 = '#ff0000',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = true,
    draw_shades = false,
    extra_newline = false,
    font = 'Neon 80s:size=10',
    gap_x = 476,
    gap_y = 60,
    minimum_height = 40,
    minimum_width = 380,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_transparent = true,
    own_window_argb_visual = true,
    own_window_type = 'desktop',
    own_window_hints ='undecorated,sticky,skip_taskbar,skip_pager,below',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}
conky.text = [[

${color1}${font}Week: ${color0}${font}${time %U}${color1} Day: ${color0}${time %j}${color1} of ${color0}${time %Y}

]];
Everyone feel free to use the above if you wish the floating text with the date info.

The output confuses me however. If Jan 1-7 was week 1, Jan 8-14 week 2, Jan 15-21 week 3, Jan 22-28 week 4 and we are currently in Jan 29-Feb 4 which seems to me to be the 5th week of the year. For some reason this script as well as web resources all agree this is the 4th week of the year and not the 5th. The only thing that makes sense is something I caught online about some counts waiting for the first sunday of the week as they consider this the first day of that week. In this case Jan 7-13 week 1, Jan 14-20 week 2, Jan 21-27 week 3 and Jan 28-Feb 3 makes this the last day of week 4 by this calculation. I believe this must be what the

Code: Select all

time %U
command must be using to determine week of the year number.

Anyhow, enjoy the little conky to anyone that chooses to use any part of 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 to edit .lua file for next and previous month displays

Post by Bleys »

Logansfury wrote: Sat Feb 03, 2024 7:34 pm Hey Bleys,

Forgive my ignorance, but what does "I'll post the result in my gists" mean? I draw a complete blank at "gists" Is that referring to posting here or to a repository for scripts that you maintain?
https://gist.github.com/rdschmidt
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 to edit .lua file for next and previous month displays

Post by Logansfury »

Bleys wrote: Sat Feb 03, 2024 7:46 pm https://gist.github.com/rdschmidt
Far out, I suspected something to do with Github! Thanks for the confirmation.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”