Home Forums Wiki Doc Install Extras Screenshots Source Code Projects Blog Users Groups Register
Glx-Dock / Cairo-Dock List of forums Tips and Tricks | Trucs et Astuces Having the calendar-icon in your dock display the current date
The latest stable release is the *3.4.0* : How to install it here.
Note: We just switched from BZR to Git on Github! (only to host the code and your future pull requests)
Tips and Tricks | Trucs et Astuces

Subjects Author Language Messages Last message
[Locked] Having the calendar-icon in your dock display the current date
Page : 1 2 3 4
Royohboy English 61 Royohboy [Read]
22 October 2009 à 16:29

Royohboy, Friday 16 October 2009 à 17:32


Subscription date : 14 September 2009
Messages : 24
Wow, that was a lot of fun, playing around with Nochka's demo applet Here is what I have come up with so far:

http://mitglied.lycos.de/royohboy/screenshot.png
http://mitglied.lycos.de/royohboy/CalendarPlongeur.png

The applet is little more than a launcher for a calendar application (my favourite is Dates from the Pimlico suite), and it looks best when used as a desklet without any surrounding decoration. Apart from launching the calendar-application when you left-click it you can specify a command to be executed whenever you drop a file onto the applet. THis may come in handy if your favourite calendar-programme supports importing, say, .vcs-files on the command line.

The applet does still require editing the user's crontab in order to reload the applet at midnight by running a DBus command. I guess this might as well be set up as an alarm for the clock applet; however, this is supposed to work only if you also activate the clock applet (and on my desktop, running CD 2.10 it didn't work at all). I think the midnight icon refresh might also be triggered by putting something into the python-script, but as I know nothing about python I didn't quite understand how.

One thing I still find a bit annoying is that you have to run the bash-script of the applet manually to have it in your dock. I suppose this is merely a question of where you put the applet, but I'm afraid I haven't found that out yet.

Anyway, here is the download-link:


Thanks a ton to Nochka85 for the demo applet, and to everybody else for their encouragement

Should anyone take a fancy to my diver's watch clock-skin, here is the link:


BTW, is there a repository where users may submit their custom themes etc.?

fabounet, Friday 16 October 2009 à 17:52


Subscription date : 30 November 2007
Messages : 17118
hoho, nice to see you have succeeded !
to launch it automatically just put it into ~/.config/cairo-dock/third-party/name_of_the_applet
and name the script with the same name.
also, the cron tab could be avoided by using a loop from the glib (but I also don't know python enough )
by the way, how did you do for the month ?
is it written using cairo ?

Royohboy, Friday 16 October 2009 à 20:01


Subscription date : 14 September 2009
Messages : 24
also, the cron tab could be avoided by using a loop from the glib

Do you mean, by having a programme or script asking the system what time it is about every minute or so? I would really like to avoid that as to me it seems terribly inefficient. Crontab seems like the most efficient way to do it on a Linux system, but I agree that it's rather awkward to have users set up a Crontab-command.

by the way, how did you do for the month ?

That is the easiest part of the whole untertaking, actually I used the date command: date +%d will give you the day of the month, and date +%b gives you a short version of the month. The nice thing about using date is that I don't have to worry about localization; on a German computer I'll get "Okt" for October, "Oct" on an English one, and probably on a French computer, too.

Actually, what I tried first was editing the .svg-file, and putting in 'date +%b' and 'date +%d' as you would in a shell-script. It didn't work that way, however. I'm still wondering if it isn't possible in .svg, and whether Gnome/XFCE support this feature for SVG-icons. However, I know very little about SVG.

The script that does all the icon-magic is icon.sh. It is really just an SVG-icon wrapped in a tiny bit of shell-script:

#!/bin/sh

MONTH=$(date +%b)
DAY=$(date +%d)

# generate calendar-icon showing current day and month
printf "[the contents of your SVG-file goes here]"> icon

exit 0

The SVG-file can be made in Inkscape or any other SVG-capable programme. Just make sure to insert $MONTH and $DAY into your SVG-file using a text-editor.

ppmt, Friday 16 October 2009 à 20:21


Subscription date : 29 November 2007
Messages : 3520
I can't wait to test that tonight!!!!

matttbe, Friday 16 October 2009 à 21:13


Subscription date : 24 January 2009
Messages : 12573
Royohboy :
Do you mean, by having a programme or script asking the system what time it is about every minute or so? I would really like to avoid that as to me it seems terribly inefficient. Crontab seems like the most efficient way to do it on a Linux system, but I agree that it's rather awkward to have users set up a Crontab-command.
Why don't you add a bash script that it's launched on another PID and has a 'sleep' function in order to launch again your main script after X seconds ?
You can use this script for example
#!/bin/sh
# By matttbe under GNU-GPL3

hour=`date +%H`
min=`date +%M`
sec=`date +%S`
sleepTime=$(((23-$hour)*3600+(59-$min)*60+$sec))
sleep $sleepTime
sh YOUR_SCRIPT


BTW, is there a repository where users may submit their custom themes etc.?
You can propose your theme here in order to be added in the repository.
I suppose that you speak about your clock theme (or your CD theme seems to be great to )? Excellent idea to share it!
Just a question: who has made this theme and what's the licence? (the respect of licences is very important for themes on our repository )
Thanks.

Royohboy, Friday 16 October 2009 à 22:35


Subscription date : 14 September 2009
Messages : 24
My dear Matttbe, that little bash-script looks very clever Can't wait to see it work at midnight Thank you!

I suppose that you speak about your clock theme (or your CD theme seems to be great to )?

The CD theme is MacOSX by Lord Northam, with an icon here and there taken from the Mac4Lin desktop icon theme.
I mean the clock-theme for which I did the artwork except for the clock-glass which I borrowed from the Glassy theme. I'm thinking about discarding the clock-glass for my theme, however.

Which license would you suggest? Which would cause the least trouble, especially in regard to GPL3 vs. GPL2, etc.? I confess that this is something I have never thought about, and my general attitude in that respect is "whatever you like as long as nobody sells it".

matttbe, Saturday 17 October 2009 à 00:04


Subscription date : 24 January 2009
Messages : 12573
Which license would you suggest? Which would cause the least trouble, especially in regard to GPL3 vs. GPL2, etc.? I confess that this is something I have never thought about, and my general attitude in that respect is "whatever you like as long as nobody sells it".
Ah, these licences
I suggest to you to use the GNU-GPL3 (GPL3 is simply an update of the GPL2 in order to protect better its authors). With this licence, everybody can use your software or your theme for any purpose, everybody has the freedom to change it to suit your needs, the freedom to share it with everybody, and the freedom to share the modifications (and the licence can't be changed!).

But I suggest the Creative Commons by-nc-sa too. For me it's a licence for arts (photography, picture, etc.). The difference between CC and GPL3 is that you may not use your work for commercial purposes. For example it's easier to use an icon on an commercial website and respect the licence than use your bash script on a commercial software.

But for both you can't change the licence and respect the copyright ! (so you can not use a source code under GPL or CC and put it on a commercial software with the whole closed source code)

nochka85, Saturday 17 October 2009 à 00:38


Subscription date : 29 November 2007
Messages : 7408
But I suggest the Creative Commons by-nc-sa too. For me it's a licence for arts (photography, picture, etc.). The difference between CC and GPL3 is that you may not use your work for commercial purposes. For example it's easier to use an icon on an commercial website and respect the licence than use your bash script on a commercial software.


OK ... but he has some code too .... isn't the GNU-GPL3 a better choice ?

matttbe, Saturday 17 October 2009 à 00:50


Subscription date : 24 January 2009
Messages : 12573
Yes, for me it's better to choose this licence here.

Another thing: I have asked Launchpad admin to have another sub-project for all external applets (named cairo-dock-plug-ins-extras). It can be interesting in future to have a package and a BZR branch with these applets and/or an external applets managers (where you can download any stable applets from our server)

nochka85, Saturday 17 October 2009 à 01:05


Subscription date : 29 November 2007
Messages : 7408
I really firstly prefered the second choice (An external applet managers) .... but the problem could be that there's no automatic update ( <- can we do that for the theme manager or gauges for exemple ???)
... So maybe a mixed solution could be fine : External applet manager for the "stable applets" and a package for the applets in dev ( <- to have the updates)

matttbe, Saturday 17 October 2009 à 01:26


Subscription date : 24 January 2009
Messages : 12573
External applet manager for the "stable applets" and a package for the applets in dev ( <- to have the updates)
We can have a packages for stable applet (to install all applets in one shot ).
I think that bzr can be a good help: there will be a main branch (lp:cairo-dock-plug-ins-extras) with all stable applets (and these stable applets can be updated!) and other development sub-branch maintained by the author(s) of the applet.

An external applet manager has to manage all versions (an external applet can maybe work on the 2.1.1 but not on 2.2.1 or inversely)

nochka85, Saturday 17 October 2009 à 01:48


Subscription date : 29 November 2007
Messages : 7408
We can have a packages for stable applet (to install all applets in one shot ).


Ok, but by definition, stable applets are the ones that don't need updates ! So they could be on a server ... And the ones that need updates (in dev) should be in a package to be allways updated

An external applet manager has to manage all versions (an external applet can maybe work on the 2.1.1 but not on 2.2.1 or inversely)


Of course -> That means that the dbus applet needs to be freezed ! .... or we need something to check the versions and alerts if the applet is made for a later version of the dock

ppmt, Saturday 17 October 2009 à 02:40


Subscription date : 29 November 2007
Messages : 3520
Excellent!

I really like this applet.

Now if someone could make it open the calendar view from the Cairo-Clok I would be very happy

I installed the Dates program but for some reason the time is wrong in .It says the date is 17/10 when here in Canada we are still the 16th
Luckily the icon itself is correct!

EDIT: Strange...I was playing with the setting and I selected to pu the applet on the widget layer by mistake...this caused the dock to crash
and since then I can't get the applet Calendar to reappear in the dock
It is no longer in the Accessories menus

Royohboy, Saturday 17 October 2009 à 10:01


Subscription date : 14 September 2009
Messages : 24
ppmt :
.I was playing with the setting and I selected to pu the applet on the widget layer by mistake...this caused the dock to crash and since then I can't get the applet Calendar to reappear in the dock

Have you installed the Calendar-applet in ~/.config/cairo-dock/third-party/Calendar?

Quit Cairo-Dock, delete the stored settings by deleting
~/.config/cairo-dock/current_theme/plug-ins/Calendar

and start Cairo-Dock again. You will loose any changes you made to the configuration of the Calendar applet, but it should appear under "Accessories" again.

ppmt :
Now if someone could make it open the calendar view from the Cairo-Clok I would be very happy

Maybe there is a DBus-command that can send a left-click to an applet or desklet? However, I have tried letting the Firefox icon bounce on left-clicking the calendar-applet by setting the left-click command to
dbus-send --session --dest=org.cairodock.CairoDock /org/cairodock/CairoDock org.cairodock.CairoDock.Animate string:default int32:2 string:any string:firefox string:none
but it didn't work.

I agree with you, however, that it would be counter-intuitive to have to click on the clock to see the calendar when there is a calendar-icon. I'll try to find out if there is a way...

ppmt, Saturday 17 October 2009 à 14:49


Subscription date : 29 November 2007
Messages : 3520
I have tried to delete the ~/.config/cairo-dock/current_theme/plug-ins/Calendar and still the same

Actually now it won't even recreate...it is as if the dock is now ignoring the third-party directory

It did work and then it stopped

Royohboy, Saturday 17 October 2009 à 15:15


Subscription date : 14 September 2009
Messages : 24
Please try the following:

Quit the dock, then uninstall the Calendar applet (delete ~/.config/cairo-dock/current_theme/plug-ins/Calendar and ~/.config/cairo-dock/third-party/Calendar). Restart the dock and quit it again. Install the Calendar applet again. Restart the dock. Is the Calendar applet available again?

I have no idea what the widget layer is - does it have anything to do with Compiz? This is one thing I can't try as I'm using XFCE.

ppmt, Saturday 17 October 2009 à 15:38


Subscription date : 29 November 2007
Messages : 3520
Hi Royohboy,

I have done so several time. It didn't help

I am going to open another thread with some message I found while troubleshooting with Matttbe...

but right the real world is calling me

lylambda, Saturday 17 October 2009 à 16:46


Subscription date : 06 September 2009
Messages : 1635
Congratulation,that evolve fast !
I can't help for the applet codding, but I have some ideas to improve the clock and calendar applet when that will be finnish (soon I'm sure ).

So you know, Clock have this calendar in a balloon :
http://uppix.net/4/3/b/f0559ee0f75ba87f7c32cd0aed3c3.png

I think, this balloon should be go with Royohboy's Calendar applet like that (look the dynamic icon inside the balloon ) :
http://uppix.net/1/c/0/aafa5482c233f4d510d6453042cb5.png

And Clock applet change balloon for others informations, for example new clock's locality :
http://uppix.net/b/e/b/dc27e241fd2a185f58db8d4793207.png

What do you think about that ?

ppmt, Saturday 17 October 2009 à 17:06


Subscription date : 29 November 2007
Messages : 3520
+1 on this

Some news on my side.... I rebooted my computer and guess what..... It is back in the menu so I can reconfigure it

It is getting annoying if you can now fix bug by rebooting linux....it feels like you are on Windows

Anyway I have found another issue but I don't think it is related to the Applet this time.

I have set the cron to reload every minute for the moment and I can see the applet being reloaded but its position moves as well.
The applet is detached, the position is locked

Here is a little video to show it.

http://videobin.org/+ic/l6.html

Royohboy, Saturday 17 October 2009 à 18:09


Subscription date : 14 September 2009
Messages : 24
Lylambda, I really like your suggestion; the bubble with the different time-zones for the clock-applet looks particularly flashy I don't know how to code the calendar-bubble though.

But what does the author of the clock-applet say?

Tips and Tricks | Trucs et Astuces

Subjects Author Language Messages Last message
[Locked] Having the calendar-icon in your dock display the current date
Page : 1 2 3 4
Royohboy English 61 Royohboy [Read]
22 October 2009 à 16:29


Glx-Dock / Cairo-Dock List of forums Tips and Tricks | Trucs et Astuces Having the calendar-icon in your dock display the current date Top

Online users :

Powered by ElementSpeak © 2007 Adrien Pilleboue, 2009-2013 Matthieu Baerts.
Dock based on CSS Dock Menu (Ndesign) with jQuery. Icons by zgegball
Cairo-Dock is a free software under GNU-GPL3 licence. First stable version created by Fabounet.
Many thanks to TuxFamily for the web Hosting and Mav for the domain name.