20.x Xfce clock/calendar remove week numbers from calendar

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
User avatar
zcot
Level 9
Level 9
Posts: 2838
Joined: Wed Oct 19, 2016 6:08 pm

20.x Xfce clock/calendar remove week numbers from calendar

Post by zcot »

This instruction comes about due an earlier thread where a user wanted the simple calendar without the week numbers shown: viewtopic.php?f=90&t=365720

This is for Mint Xfce 20.x, add the basic datetime plugin without week numbers.


default 'clock' plugin vs 'datetime' plugin
https://forum.xfce.org/viewtopic.php?id=12710
clock is 102KiB
datetime is 32KiB

I believe with 'clock' it will automatically integrate theme related changes with font, whereas 'datetime' does not, but it does provide the font setting directly in the plugin settings option.


We can just overwrite the 'datetime' plugin easily to eliminate the hardcoded week number display.


-The overall idea
1. Get the source code
2. Make the edit to 1 file
3. Compile
4. Install

1a. Download a tar package, extract it, and you can view the files there with Thunar, also be prepared to visit that extracted path location in terminal.
2a. You can just do a simple edit using Xed, comment out 1 line.
3a. You'll need to install some tools and dependencies to be able to compile.
4a. Just copy/paste commands on terminal, shown below.


This is the quick instruction, if you understand it, otherwise you can walkthrough each step below:
1. https://gitlab.xfce.org/panel-plugins/x ... gin/-/tags (get 0.8.1)
2. comment out the line with GTK_CALENDAR_SHOW_WEEK_NUMBERS in /panel-plugin/datetime.c
( the comment beginning marking is /* and the ending marker is */)
3.

Code: Select all

apt install xfce4-dev-tools libglib2.0-dev libxfce4ui-2-dev libxfce4panel-2.0-dev
./autogen.sh
make
4.

Code: Select all

cd panel-plugin/.libs
sudo cp libdatetime.so /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/
5. add the 'datetime' plugin to the panel, delete the 'clock' plugin


If you want more of the step-by-step instruction:
go here: https://gitlab.xfce.org/panel-plugins/x ... gin/-/tags
download this package: xfce4-datetime-plugin-0.8.1
on the right is the download option, pick one of the tar options, tar.bz2 is the latest-greatest(highest compression I guess, but the file is very small and any .tar option is fine for this case).

Now, go find that file in Thunar probably in the Downloads folder, double-click it,
at the top left, use extract, and change the destination directory, or not, to something like ~/source/ or just extract it to your user home there, -just put it somewhere convenient for you to use with terminal, so the idea is that terminal starts at home(~) so just make it easy so you don't have to type a lot of path commands later. Or just keep the path where it is and it will decompress into ~/Downloads.

now open terminal, and change to that location.
cd source
you can use autocomplete on paths(and commands) with the TAB keyboard key, so you type: cd sou(press TAB)xfc(press TAB)
cd Downloads (if you didn't change to a specific path to extract the files)

Now, you are in that plugin package directory: ~/source/xfce4-datetime-plugin-xfce4-datetime-plugin-0.8.1 (or ~/Downloads/xfce4-datetime-plugin-xfce4-datetime-plugin-0.8.1)


If you read the README you can follow along to build the package.

Before you do that you need to install some necessary tools and dependencies.

copy/paste this command to terminal:

Code: Select all

apt install xfce4-dev-tools libglib2.0-dev libxfce4ui-2-dev libxfce4panel-2.0-dev

Now it's time to edit the source code file and remove the hard-coded "show-week-numbers" line.
Use Thunar, open the file under that location under /panel-plugin/datetime.c

line 292: GTK_CALENDAR_SHOW_WEEK_NUMBERS |
(you could just use Find with CTRL+F and paste SHOW_WEEK_NUMBERS

The whole block looks like this:

Code: Select all

  display_options = GTK_CALENDAR_SHOW_HEADING |
    GTK_CALENDAR_SHOW_WEEK_NUMBERS |
    GTK_CALENDAR_SHOW_DAY_NAMES;
Take that line and make it like this:/* GTK_CALENDAR_SHOW_WEEK_NUMBERS | */

so, now the block should look like this:

Code: Select all

  display_options = GTK_CALENDAR_SHOW_HEADING |
/*    GTK_CALENDAR_SHOW_WEEK_NUMBERS | */
    GTK_CALENDAR_SHOW_DAY_NAMES;
Save it, and close the file.

That is done, this will enable the plugin to start without showing the week numbers now, after compile and install.


next, start the config operation and then make it. Use these 2 terminal commands:

Code: Select all

./autogen.sh
make
so it's done, the plugin is built, without week numbers, in this source code location directories.


Next, get it installed. Do it this manual way instead of the default, because the paths are not set correctly and it's not going to work without comprehensive knowledge of the ./configure system, variables and paths:


Change to the sub folder where the plugin file is now located with this terminal command:

Code: Select all

cd panel-plugin/.libs
remember you can use TAB for autocomplete.
You can also use copy/paste from here to there.

put the .so here:
/usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/ <- libdatetime.so
use(copy/paste) for the terminal command:

Code: Select all

sudo cp libdatetime.so /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/

now restart the panel with command:

Code: Select all

xfce4-panel -r
now add the 'datetime' plugin, and you can remove the 'clock' plugin
-right click the panel on an empty area -> click panel -> click add new items -> add 'datetime', close the window
-right click the original clock -> click remove
Dullard du Jour
Level 5
Level 5
Posts: 519
Joined: Fri Dec 23, 2022 10:43 am

Re: 20.x Xfce clock/calendar remove week numbers from calendar

Post by Dullard du Jour »

Thank you for this tip. I just followed the first method and used the 0.8.3 and it all went well. :) In the last 37 years, I have known only 2 people that purchased desk calendars with the 'week' field. Don't understand why its use is not optional on XFCE.
michael-hi
Level 4
Level 4
Posts: 302
Joined: Sun Mar 19, 2017 2:31 pm

Re: 20.x Xfce clock/calendar remove week numbers from calendar

Post by michael-hi »

Dullard du Jour wrote: Fri Mar 22, 2024 3:24 pm In the last 37 years, I have known only 2 people that purchased desk calendars with the 'week' field. Don't understand why its use is not optional on XFCE.
You may be in luck because it seems that it is now optional - or will be. :D The fix "Add option to toggle week numbers" was incorporated in version 4.19.2 of xfce4-panel six months ago:
https://gitlab.xfce.org/xfce/xfce4-pane ... aster/NEWS

This refers to the standard Clock widget in the panel, rather than the alternative DateTime plugin which is more the focus of this thread. You can still add the DateTime plugin to the panel but I believe the development of it has stopped after its function was merged with the Clock plugin. They are/were very similar anyway.

However, these interim development updates may not get added to distros, so we'll probably have to wait for Xfce 4.20 to come out and then subsequently be incorporated in Mint. Maybe next year sometime?

No need to wait though, because in the latest versions of Mint Xfce it's now simpler to show a calendar without week numbers - and without the need to recompile anything. Since this thread was started, the standard Clock widget has gained a new 'Command' field in its Properties. Just enter in it the command zenity --calendar and you will get a small calendar without week numbers in the middle of the screen whenever you click on the clock. Click OK or press Enter, Esc or the spacebar to clear it.

That is using zenity which is already included in Mint. If you install yad

Code: Select all

sudo apt install yad
which is similar but slightly more sophisticated, you can use a command provided by ToZ in a 2019 post on the Xfce forums:

Code: Select all

yad --calendar --geometry +1150+650 --no-buttons --undecorated --close-on-unfocus --skip-taskbar
This gives a calendar more like the existing one but again without week numbers. The only difference I can see is that you do have to click away from the widget to clear the calendar (rather than clicking the clock a second time). I have chosen the x y co-ordinates to suit my smallish laptop screen but yours may be different. The numbers in the original post were +1673+0 but anyway I hope this is of interest to somebody... :)
Dullard du Jour
Level 5
Level 5
Posts: 519
Joined: Fri Dec 23, 2022 10:43 am

Re: 20.x Xfce clock/calendar remove week numbers from calendar

Post by Dullard du Jour »

Well, now...that is neat. I appreciate the info. I just created a launcher for zenity and will use it for awhile. Later this evening I will tinker with yad and see how it works for me. Thanks!
Post Reply

Return to “Tutorials”