Can these .sh scripts be edited for more font options? [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

Can these .sh scripts be edited for more font options? [SOLVED]

Post by Logansfury »

Hello everyone,

Here is the 3-month calendar I have settled on:

Image

The current month calendar I was able to make the month and year display at top be in a customized font without damaging the formatting of the day names and columns of numbers.

The .sh scripts for next & previous months however are notable shorter script than current.sh's Can anyone please determine if I can just get the month name and year display for previous and next scripted for individual font color?

current.sh

Code: Select all

#!/bin/bash
YEAR=`date +%_Y`;TDY=`date +%_d`;MTH=`date +%_B`; cal | sed s/"\([^a-zA-Z]\)$MTH"'\b'/'${color white}${font Neon 80s:bold:size=11} '"    $MTH"'${color}'/ | sed s/"\([^0-9]\)$YEAR"'\b'/'${color white}'" $YEAR"'${color white}${font}'/ | sed s/"\([^0-9]\)$TDY"'\b'/'${color red}'" $TDY"'${color white}'/ | sed s/^/'${alignc}'/
here is next.sh:

Code: Select all

#!/bin/bash
YEAR=`date --date='next month' +%_Y`; MONTH=`date --date='next month' +%_m`; MTH=`date --date='next month' +%_B`; cal -m $MONTH $YEAR | sed s/"\([^a-zA-Z]\)$MTH"'\b'/'${color white}'" $MTH"'${color white}'/ | sed s/"\([^0-9]\)$YEAR"'\b'/'${color white}'" $YEAR"'${color white}'/ | sed s/^/'${alignr 30}'/
and previous.sh:

Code: Select all

#!/bin/bash
YEAR=`date --date='1 month ago' +%_Y`; MONTH=`date --date='1 month ago' +%_m`;MTH=`date --date='1 month ago' +%_B`; cal -m $MONTH $YEAR | sed s/"\([^a-zA-Z]\)$MTH"'\b'/'${color white}'" $MTH"'${color white}'/ | sed s/"\([^0-9]\)$YEAR"'\b'/'${color white}'" $YEAR"'${color white}'/ | sed s/^/'${offset 30}'/
Thanks for reading and for anyone that has time to do an edit here :)
Last edited by Logansfury on Tue Jan 30, 2024 2:50 pm, edited 1 time in total.
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: Can these .sh scripts be edited for more font options?

Post by Koentje »

Can you post the conky script again?
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can these .sh scripts be edited for more font options?

Post by Logansfury »

Koentje wrote: Tue Jan 30, 2024 9:34 am Can you post the conky script again?
before I do so, I have an emergency >.<

I asked chatgpt3.5 earlier to put neon 80s font into the previous and nextmonth .sh files. It gave me this script:

Code: Select all

#!/bin/bash

YEAR=$(date --date='next month' +%_Y)
MONTH=$(date --date='next month' +%_m)
MTH=$(date --date='next month' +%_B)

cal -m $MONTH $YEAR | \
sed s/"\([^a-zA-Z]\)$MTH"'\b'/'${color white}${font Neon\ 80s:bold:size=11} '"$MTH"'${color}${font}'/ | \
sed s/"\([^0-9]\)$YEAR"'\b'/'${color white}${font Neon\ 80s:bold:size=11} '"$YEAR"'${color}${font}'/ | \
sed s/^/'${alignr 30}'/
ever since I ran this, my linux box is fried and tells me next month is march. I think this part:

YEAR=$(date --date='next month' +%_Y)
MONTH=$(date --date='next month' +%_m)
MTH=$(date --date='next month' +%_B)

has reset my computer calendar and messed up the next month calculation.

Can you give me a bash script to run to correct this? Can you see what the bot did wrong?
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: Can these .sh scripts be edited for more font options?

Post by Logansfury »

Is this a case for timeshift?
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: Can these .sh scripts be edited for more font options?

Post by Koentje »

man date explains how you can set your date again. Or click on the clock in your panel and click settings time & date to correct it.

And don't use that chatgpt for everything!! It can be wrong also..
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can these .sh scripts be edited for more font options?

Post by Logansfury »

Koentje wrote: Tue Jan 30, 2024 9:43 am man date explains how you can set your date again. Or click on the clock in your panel and click settings time & date to correct it.

And don't use that chatgpt for everything!! It can be wrong also..
I see the truth of it. Stupid bot.

My current time is fine. The top panel display, the Mizar clock, and the current month in the calendar are all correct. What the comp is messing up is by adding 2 instead of 1 to determining next month. I dont see anything about this in the man page.
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: Can these .sh scripts be edited for more font options?

Post by Koentje »

Send the conky conf please..
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can these .sh scripts be edited for more font options?

Post by Logansfury »

Koentje wrote: Tue Jan 30, 2024 10:01 am Send the conky conf please..
here ya go. I did a timeshift. My next month calculation is still broken. I'm in a panic.

Code: Select all

-- needs package cal (provided by ncal) - sudo apt install ncal
conky.config = {
	own_window = true,
	own_window_type = 'normal',
	own_window_transparent = true,
	own_window_argb_visual = true,
    own_window_hints = 'skip_taskbar,skip_pager,undecorated,below',
	own_window_class = 'Conky',
	own_window_argb_visual = true,
	background = true,
	update_interval = 60,
	double_buffer = true,
	alignment = 'top_left',
	gap_x = 150,-- left | right
	gap_y = -20,-- up | down
    minimum_width = 518, minimum_height = 174,
    maximum_width = 518,
	use_xft = true,
	draw_outline = false,
	draw_shades = true,	
	font = 'Monaco:size=9',
	default_color = 'e82127',
};
conky.text = [[
${voffset 32}${execpi 60 ./previousmonth.sh}
${voffset -121}${execpi 60 ./currentmonth.sh}
${voffset -120}${execpi 60 ./nextmonth.sh}
# ${alignc}${voffset 3}${color white}${font Monaco:bold:size=10}${time %A %B %e, %Y}${font}${color}
]];
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: Can these .sh scripts be edited for more font options?

Post by Logansfury »

I just did a man ncal. and found the command ncal -3 to display prev/current/next month in the terminal. I did command and I got back dec, jan,feb.

So ncal wasnt broken, somehow conky itself was?
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: Can these .sh scripts be edited for more font options?

Post by Koentje »

Can yo also send the monaco font you use..
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can these .sh scripts be edited for more font options?

Post by Logansfury »

Koentje wrote: Tue Jan 30, 2024 10:23 am Can yo also send the monaco font you use..
here ya go!

https://www.mediafire.com/file/f8zg2ql3 ... o.ttf/file
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: Can these .sh scripts be edited for more font options?

Post by Logansfury »

I'm temporarily using this:

Code: Select all

-- needs package cal (provided by ncal) - sudo apt install ncal
conky.config = {
	own_window = true,
	own_window_type = 'normal',
	own_window_transparent = true,
	own_window_argb_visual = true,
    own_window_hints = 'skip_taskbar,skip_pager,undecorated,below',
	own_window_class = 'Conky',
	own_window_argb_visual = true,
	background = true,
	update_interval = 60,
	double_buffer = true,
	alignment = 'top_left',
	gap_x = 190,-- left | right
	gap_y = -140,-- up | down
    minimum_width = 518, minimum_height = 174,
    maximum_width = 518,
	use_xft = true,
	draw_outline = false,
	draw_shades = true,	
	font = 'Monaco:size=9',
	default_color = 'ffffff',
};
conky.text = [[
${execi 600 ncal -3}
]];
to put a 3 month cal with correct next month showing. Unfortunately I've lost my red colored current day and the formatting of month and year fonts >.<
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: Can these .sh scripts be edited for more font options?

Post by Koentje »

Yeah, if it was that easy haha.... those scripts provide the colors and alignment! I have been fighting with it for the last couple of hours.
Now i have that same strange problem with the 3rd month! :x
This is what i have got so far
Schermafdruk van 2024-01-30 18-27-11.png

There is only 1 bug to fix, after the colored day the font does not go back to normal..
Image
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Can these .sh scripts be edited for more font options?

Post by Koentje »

Btw yes, background has a color, because then i can see what i'm doing in the conky window. Here is without color..
Schermafdruk van 2024-01-30 18-30-08.jpg


And i think i fixed the 3rd month problem. Very easy you see.. next month is this month +1!! :mrgreen:
Image
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Can these .sh scripts be edited for more font options?

Post by Koentje »

I know what the problem is with the month thing. It looks for this day next month. Since there is NO 30th februari it looks for the next month, and that's march!

This solves it:
date --date="$(date +%Y-%m-15) +1 month" +'Next month is %B!'

Now if looks for the 15th of next month and that does exist, so it's februari! ;)
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can these .sh scripts be edited for more font options?

Post by Logansfury »

I just put that line in my .sh file so now it looks like this:

Code: Select all

#!/bin/bash
YEAR=`date --date='next month' +%_Y`; MONTH=`date --date='next month' +%_m`; MTH=`date --date="$(date +%Y-%m-15) +1 month" +'Next month is %B!'`; cal -m $MONTH $YEAR | sed s/"\([^a-zA-Z]\)$MTH"'\b'/'${color white}'" $MTH"'${color white}'/ | sed s/"\([^0-9]\)$YEAR"'\b'/'${color white}'" $YEAR"'${color white}'/ | sed s/^/'${alignr 30}'/
Im still displaying March. Did I mispaste?
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: Can these .sh scripts be edited for more font options?

Post by Koentje »

Problem is also in your conky config... there are some settings that do not allow change of fonts via bash script. I took one of my own configs and now it works like a charme! I also made from the 3 bash scripts, one script that can be called with an arg.
calendar.sh current shows current month, etc.

I need to do some small aligments and then it's finished!
Image
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can these .sh scripts be edited for more font options?

Post by Logansfury »

Far out and thank you :)

Patiently standing by!
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: Can these .sh scripts be edited for more font options?

Post by Logansfury »

Koentje wrote: Tue Jan 30, 2024 1:25 pm Now i have that same strange problem with the 3rd month! :x
While I would never wish difficulties on anyone, this is gratifying to read. You never went near chatgpt3.5, so my interaction with the bot at the time of the wrong month display was coincidence.

This is great that we have uncovered an issue the author of this prob never realized he had when he offered this publicly on github. Was the issue related at all to leap year?
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: Can these .sh scripts be edited for more font options?

Post by Koentje »

Unpack it in your ~/.conky folder. You get a 3-month-calendar folder.
Schermafdruk van 2024-01-30 19-23-50.png

3-months-calendar.tar.gz
(1.69 KiB) Downloaded 24 times
Image
Post Reply

Return to “Compiz, Conky, Docks & Widgets”