Adjustable Clock

Plasma 4 Extensions

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

28
8 .4
Description:

Plasmoid to show date and time in adjustable format using rich text.
Developed and tested on KDE 4.11 with Qt 4.8 (Kubuntu 13.10).

Source (main repository, with more frequent updates) is located at:
https://github.com/Emdek/plasmoid-adjustable-clock

Warning!
Version 4.0 (and newer) is not backwards compatible with 3.x, all custom formats need to be exported and manually converted.

QML themes support is currently considered as experimental, behavior and available API are not yet stable and most probably will be changed with next release.

Tips:
- to change tool tip text you need to set options toolTipExpressionMain and toolTipExpressionSub in applets configuration file (usually located at ~/.kde4/share/config/plasma-desktop-appletsrc), in group containing line plugin=adjustableclock;
- you can use advanced WebKit features (all of these that work with for example rekonq should work here too), for example use CSS to create reflections:

-webkit-box-reflect:below 5px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.5, transparent), to(white));

And much more. ;-)

If you created interesting theme and want to share it then post in comments!

Features:
- fully custom date and time using JavaScript API to obtain date and time components;
- multiple clock themes utilizing various designs;
- possibility to use rich text editor or edit source directly (HTML and CSS or QML) to adjust theme;
- context menu with actions to copy formatted (adjustable expressions) date and time to clipboard;
- fast copy to clipboard of adjustable date and time expression after middle mouse click on the clock or activation of keyboard shortcut;
- adjustable tool tip (hidden option, toolTipExpressionMain and toolTipExpressionSub keys);
- standard clock calendar.

If you have found bugs or have suggestions you can contact me via email, message or using comments, before you will vote bad. And remember that not everybody has enough time for fast replying. ;-)
Last changelog:

7 years ago

4.1.4 (01.11.2013):
- fixed week number not being updated;
- added missing title of "Insert Component" dialog.

4.1.3 (27.09.2013):
- ensure that component values are always up to date;
- adjust timestamp for time zone offset;
- do not allow for accidental nesting of components in editor;
- added option to hide date in Train Clock theme;
- added workaround to ensure that hands of SVG Clock have correct initial positions as soon as possible.

4.1.2 (01.06.2013):
- ensure that center of SVG Clock theme is always valid;
- improve resizing in vertical panels.

4.1.1 (25.05.2013):
- fixed WYSIWYG editor for HTML themes;
- fixed missing dialog for "Insert Component" actions.

4.1 (15.05.2013):
- added SVG Clock theme (analog clock that uses Plasma theme);
- added experimental support for QML themes (alpha state);
- added simple file templates for new themes;
- move theme editor to own dialog;
- move theme specific actions to context menu;
- added ability to install and export themes (Plasma Package ZIP);
- some other improvements and fixes.

C

Emdek

8 years ago

Got it, thanks. :-)
I will try to find some free time to test it during this week, in case of no activity feel free to send me message (here, by email, on github or elsewhere).

Well, it is already scriptable, it is just not so trivial after themes become more advanced. ;-)

Report

C

Emdek

8 years ago

Sorry for next delay, but apparently I'm extremely busy recently. :-/
I'm unable to open that scripting console, it is application name or binary name, or there is some special command known only for KRunner (hopefully not translated...)?
And I can only tell that your approach is still wrong, here is example configuration file layout with two formats (test and test2):
http://paste.kde.org/614522/

Report

nowardev

8 years ago

well you need to configure krunner and turn on desktop console plugin

http://wstaw.org/m/2012/11/26/plasma-desktopwu5011.png

or if you can't there is a shell command that works for sure , type in konsole :

qdbus org.kde.plasma-desktop /MainApplication showInteractiveConsole

there is no problem for delay cuz i have already done plasma panels collections 2 it would say i will use your widget when we will be able to script it ;)

Report

C

Emdek

8 years ago

You should update to current version, which is already "old". ;-)
There are big chances that old one doesn't react at all or does it improperly in case of configuration changes done from outside.

And if no one want to maintain this package in Debian then it should be dropped, since it makes even more harm to have so outdated one there...

Report

nowardev

8 years ago

ok upgraded but ... no changes how should i do ?

it's faster if you do because i can't undestand your way.

i have tested this : with and without the array Configuration

you could just try it out : alt f2 >> desktop console => copy and paste the code it's not a pain it just add an empty panel and it tries to add your widget with some config


var panel = new Panel
panel.location = 'bottom' //panel.location = 'top'



var applet = panel.addWidget("adjustableclock")

applet.currentConfigGroup = new Array('Configuration')


applet.writeConfig("timeFormatNames","Default 2")


applet.writeConfig("timeFormatStrings",'<html><body><div style="text-align:center; margin:5px; white-space:pre;"><span style="color:#ffffff;"><b style="font-size: 27px; "><span style="font-size: 32px; "><span style="font-family:\'Ubuntu\';">%d %x</span><span style="font-family: Ubuntu; font-size: 40px; "> </span></span><big style="font-size: 56px; "><span style="font-family:\'Ubuntu\';">%H:%M</span></big></b></span></div>')

panel.reloadConfig()

Report

pallegro

8 years ago

thanks for this

Report

9

quinnuendo

8 years ago

With my current desktop setup, I found it really usefull to have a clock with really big digits in my vertical sidebar. So I am using the whole width of it for just the two digits that are the hours, and then bellow the minutes. A bit smaller is the date and the day of the week, which I also sometimes find handy :)

html:
<div style="text-align: center; font-family:Droid Sans">
<span class="gen shadowed clock">%h</span><br>
<span class="gen shadowed clock" style="font-size:12px">o o<br></span>
<span class="gen shadowed clock">%m<br></span>
<span class="gen shadowed" style="font-size: 40px;">%!$w</span><br>
<span class="gen shadowed" style="font-size: 30px;">%d/%M</span>
</div>

css:
.shadowed {text-shadow:black 0.04em 0.04em 0em, #bbf 0em 0.0em 0.3em}
.clock {font-size: 60px; font-weight:bold}
.gen {color:#ccc}

Could be a bit more elegant with the font sizes not hard coded, but it works. The important part anyway are the relative sizes, since the plasmoid gets resized to fit in the sidebar.

Report

gldvorak

8 years ago

The clock displayed the way I want it to look!

<div style="text-align: center; color:#FFFF00;">
<span style="font-size: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%h:%m:%s&nbsp;&nbsp;%p&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span style="font-size: 14px;"><br>%!$w,&nbsp;%!$M&nbsp;%!d,&nbsp;%Y</span>
<span style="font-size: 12px;"><br>%!$z&nbsp;UTC&nbsp;%!z</span><br>
</div>

This displays on three lines and shows only the time zone city.

Report

gldvorak

8 years ago

I am tryingwithout success so far to truncate the width of text, for example, display Monday as Mon and September as Sep.

Report

gldvorak

8 years ago

<div style="text-align: center; color:#FFFF00;">
<span style="font-size: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%h:%m:%s&nbsp;&nbsp;%p&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span style="font-size: 14px;"><br>%$w,</span>
<span style="font-size: 14px;"><br>%$M&nbsp;%!d,&nbsp;%Y</span>
<span style="font-size: 12px;"><br>%$z&nbsp;UTC&nbsp;%!z</span><br>
</div>

Note that I use nonbreaking spaces to keep from having line wraps where I do not want them. I use a rather tall panel where this clock is located.

Report

gldvorak

8 years ago

Note: Everything changes size as one scrolls through the time zones!

Returns the letter—Size changes as time zones are changed!
%a b B c C e f F g G i I j J k K l L n N o O P q Q r u v V x X y
%$a b B c C e f F g G i I j J k K l L n N o O P q Q r u v V x X y
%!a b B c C e f F g G i I j J k K l L n N o O P q Q r u v V x X y

Useful codes—Size changes as time zones are changed, except where noted!
%A or %$A Fri, Sep 14, 12 09:44 PM
%!A Fri, 09/14/12 09:44 PM
%D or %$D or %!D—258 Days into the year
%d or %$d or %!d—14 Day number, two digits
%E or %$E or %!E—returns nothing!
%H or %$H or %!H returns nothing!
%h or %$h—09 Hour
%!h—9 Hour
%M—09 Month number, two digits—Size does not change
%$M—Month name—Size does not change
%!M—9 Month number, one digit—Size does not change
%$m or %m—05 Minute, two digits—Size does not change
%!m—5 Minute—Size does not change,
%$p or %p—am/pm
%$R or %R or %!R—09:44 AM/PM
%$S or %S or %!S —nn:nn AM/PM,
The values change with the time zones but do not correspond with anything! The size does not change.
%$s or %s or %-S or %~s or %+s—15 Seconds, two digits
%!s—9 Seconds, 0ne digit
%$T or %T—Fri, Sep 14, 12; Short weekday, short Month name day number, two digit year
%!T—Fri, 09/14/12; Short weekday, Month number/Day number/Two digit year
%$t or %t—09:34:47 PM; HH:MM:SS AM/PM
%!t—09:34 pm; HH:MM AM/PM
%$U or %U or %!U—Seconds since the epoch—Size does not change.hm,,
%$W or %W or %!W—week number—Size does not change.
%$w—Tuesday; Long weekday name—Size does not change.
%w or %!w—6 Day of weeknumber, Sunday=0—Size does not change.
%$Y or %Y—Year number, four digits
%!Y—12 Two digit year.
%$Z or %Z—Country/City: HH:MM AM Fri, Sep 14, 12;
List of country name/city name: Hour:Minute AM/PM Short day name, Short Day name, Short Month name Day num, two digit year
%!Z—City: HH:MM AM Fri, Sep 14, 12;
List of city name: hour:minute AM/PM Short day name, Short Day name, Short Month name Day num, two digit year
%z or %!z— -7;UTC offset
%$z—America/Los Angeles; Country name/city name

Report

C

Emdek

8 years ago

E and H placeholders will yield results only if there is available data to display (when data engine supports it and there are configured events in case of E).
Clock always tries to first calculate maximum results width for placeholders with variable lengths (like month name) but that is not always feasible.

Report

timonoj

8 years ago

Hi, I really like your widget and the many ways it can be customized! We are using it for some company to display the time in different timezones in a large screen. However there's a small irk that is rather visible: So far there are 4 adjustableclock widgets running at the same time, with different timezones set. BUT there's always one that goes something like 0.8 second delayed (that's less than a second), so three of the widgets update the seconds in perfect sync, and there's one lagging behind .8 secs. A small irk, but very visible. Could you try and check it? Everything else seems to work perfectly!

Report

C

Emdek

8 years ago

This is pretty weird issue, are those standard themes?
I can only reproduce such behavior using plasmoidviewer, when each instance has own process... Moreover, I can reproduce that also using standard digital clock.

This seems to be limitation of data engine which has no option to align to a second (http://api.kde.org/4.9-api/kdelibs-apidocs/plasma/html/namespacePlasma.html#aab29f15efa645a5f644650f2f7f44857) but uses milliseconds internally - this could lead to such slight differences (depending when clock instance was connected to data engine).
And since kdelibs are frozen (so it will not be fixed in proper way before KDE 5.x) I can only think about some workaround, like checking milliseconds delay and connecting to data engine in slot called after computed time.

But it is still weird that one is delayed so much inside single process, maybe it was added a bit later and there is some applet(s) that consume that 0.8 second for own initialization? Then removing all clocks and adding them again could help.

Report

cmlr

8 years ago

The Arch Linux package has been renamed, please update the link as follows:
https://aur.archlinux.org/packages.php?ID=60809

Report

woodsdog

8 years ago

Since adjustable clock is "no longer compatible with strftime()", is there a list of placeholders somewhere? I can't seem to find them in any obvious place.

Also, can you help us understand why you went away from the Unix standard strftime placeholders? Those are pretty much universally standard, and referenced everywhere. I'm sure there are good reasons, just curious to what they are.

Report

C

Emdek

8 years ago

1. There is dialog to insert placeholder (there was a menu in the past), you can access it by clicking that chronometer icon right from font family list box.

2. There is not enough symbols for all combinations (short and long forms, leading zeros, alternative forms etc.) to make it compatible and fully logical.

Report

woodsdog

8 years ago

I want you to know that this Widget is awesome. The flexibility it has is wonderful. Please don't take my previous comment as a complaint..this rocks.

I see the menu where I can choose "seconds" or "days" or whatever. However, when coding in HTML, I don't know what they are. I have to generate one with the menu, look at the code details, then put it in my html. It's quite the process.

As a suggestion, it would be very helpful to have a list of these placeholders documented.

Also, how do I do a 3 letter Month? In the drop down, I see month, but it spells it out all the way. I want just a three letter Month.

Thanks again for this widget!

Report

C

Emdek

8 years ago

For short month form select both textual form and short form. Alternatively you can try using expressions to get only part of the string.

Partial documentation (modifiers syntax) is available in README file, currently there is no separate list of placeholders, but you can get them from comments in src/Applet.cpp, in body of method QString Applet::evaluatePlaceholder(ushort placeholder, QDateTime dateTime, int alternativeForm, bool shortForm, bool textualForm).

Report

9

5er

8 years ago

I like version 3.1. I like previews and theme managing (adding themes was a bit buggy before), but I don't like the correction of html. It keeps messing my clocks up. It inserts "placeholder" and "fix" tags where format components are used in attributes (for example in the progress clock).

Other than that, keep up the great work.

Report

C

Emdek

8 years ago

Yeah, it is not perfect yet and QtWebKit (has some issues comparing to "raw" one) doesn't want to cooperate... ;-)
You can disable substitution for individual placeholders by placing ~ just after %.
I'm also planning to allow to disable current substitution in editor, for advanced users (as it was added to do not scary beginners).
You can also follow changes in git repository, as some nice features should be there soon (currently most interesting change is removal of requirement that repainted can be done only on time change, so use of CSS transitions, animations and such is now possible). ;-)

Report

C

Emdek

8 years ago

One of main new features planned for next release is to finally allow to take advantage
of animations and other stuff that requires more often repainting etc.
I've initially checked how it works in QtWebKit (using rekonq) and I see some bugs (maybe wrong transformations order?) however 3D transforms itself are possible.
http://www.webkit.org/blog/386/3d-transforms/
Those who want to experiment with it can start testing it using QtWebKit based browsers (rekonq, Arora) to test it first, it could be good idea to announce attempt first, so we don't end with duplicate efforts (my plans are train clock and rotating rings based one).

Report

9

5er

8 years ago

In case you get bored sometime, you could consider adding options for system, weather or amarok information. That would be pretty nice.

Report

C

Emdek

8 years ago

Check TODO file, weather information is already planned (I just need to find some documentation how to use ions). ;-)
More important thing is probably second entry in TODO, possibility to create really scripted themes, with API to get data (easier to use than placeholders) and to decide when repaint by the script itself. This is planned for next release.

Report

9

5er

8 years ago

Awesome!

Report

7 years ago

4.1.4 (01.11.2013):
- fixed week number not being updated;
- added missing title of "Insert Component" dialog.

4.1.3 (27.09.2013):
- ensure that component values are always up to date;
- adjust timestamp for time zone offset;
- do not allow for accidental nesting of components in editor;
- added option to hide date in Train Clock theme;
- added workaround to ensure that hands of SVG Clock have correct initial positions as soon as possible.

4.1.2 (01.06.2013):
- ensure that center of SVG Clock theme is always valid;
- improve resizing in vertical panels.

4.1.1 (25.05.2013):
- fixed WYSIWYG editor for HTML themes;
- fixed missing dialog for "Insert Component" actions.

4.1 (15.05.2013):
- added SVG Clock theme (analog clock that uses Plasma theme);
- added experimental support for QML themes (alpha state);
- added simple file templates for new themes;
- move theme editor to own dialog;
- move theme specific actions to context menu;
- added ability to install and export themes (Plasma Package ZIP);
- some other improvements and fixes.

12345678910
243
product-maker thevladsoft Aug 10 2015 9 excellent
product-maker vanguard7 Sep 01 2014 9 excellent
product-maker SicoBulo Jul 27 2014 3 bad
product-maker electron222 May 08 2014 9 excellent
product-maker janet Feb 22 2014 9 excellent
product-maker garthecho Feb 09 2014 9 excellent
product-maker renjooy Jan 24 2014 9 excellent
product-maker mixalns Nov 02 2013 9 excellent
product-maker MoonBlossom Oct 10 2013 9 excellent
product-maker vatsok Sep 29 2013 9 excellent
product-maker YAFU Sep 28 2013 9 excellent
product-maker fdservices Sep 27 2013 9 excellent
product-maker Omega9 May 16 2013 9 excellent
product-maker oOSplashOo May 15 2013 9 excellent
product-maker baltolkien May 04 2013 9 excellent
product-maker FraMari Apr 21 2013 9 excellent
product-maker monga Apr 21 2013 9 excellent
product-maker frag Apr 15 2013 9 excellent
product-maker SvenArcher Apr 14 2013 9 excellent
product-maker ArthurTaborda Apr 13 2013 9 excellent
product-maker ksolsim Apr 13 2013 9 excellent
product-maker migue Apr 13 2013 9 excellent
product-maker google01103 Apr 13 2013 9 excellent
product-maker evapor Apr 13 2013 9 excellent
product-maker unikum111 Apr 08 2013 9 excellent
product-maker tsujan Jan 06 2013 9 excellent
product-maker lionhater Oct 10 2012 9 excellent
product-maker quinnuendo Oct 03 2012 9 excellent
product-maker xMaki Oct 02 2012 9 excellent
product-maker CobraDOT Aug 13 2012 9 excellent
product-maker RAIDENSUB Jun 12 2012 9 excellent
product-maker remix Apr 03 2012 9 excellent
product-maker SeaJey Feb 15 2012 9 excellent
product-maker orivej Feb 13 2012 9 excellent
product-maker 5er Feb 07 2012 9 excellent
product-maker ZaWertun Feb 03 2012 9 excellent
product-maker cyberconan Jan 15 2012 9 excellent
product-maker CatchTime Dec 02 2011 9 excellent
product-maker paran0idx Dec 02 2011 9 excellent
product-maker deabru Dec 01 2011 9 excellent
product-maker vitoubien Dec 01 2011 9 excellent
product-maker e1nste1n Dec 01 2011 9 excellent
product-maker Pafrape Oct 12 2011 9 excellent
product-maker joseexposito89 Aug 30 2011 3 bad
product-maker ZXP6 Oct 15 2010 9 excellent
Be the first to comment
UnderTheGun
May 01 2014
quinnuendo
Mar 23 2014
BishopWolf
Jan 08 2014
MoonBlossom
Oct 10 2013
fdservices
Sep 27 2013
blue-dxca93
May 08 2013
baltolkien
May 04 2013
Maecla
May 04 2013
ArthurTaborda
Apr 13 2013
ksolsim
Apr 13 2013
migue
Apr 13 2013
elboulangero
Jan 07 2013
n-k
Jan 06 2013
xMaki
Oct 02 2012
CobraDOT
Aug 13 2012
Pafrape
Jun 15 2012
remix
Apr 03 2012
ZaWertun
Feb 03 2012
CatchTime
Dec 02 2011
paran0idx
Dec 02 2011
Bert
Aug 31 2010
olenz
May 11 2010
janet
Apr 30 2010
vazoline
Nov 02 2009
Pitmairen
Jul 02 2009
ahri
May 19 2009
deabru
Mar 27 2009
Sheridan
Mar 27 2009
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
4.1.4 "Hello QML"
updated Nov 01 2013
added Nov 08 2008
downloads 24h
3
mediaviews 24h 0
pageviews 24h 19