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.

koso83

10 years ago

Thanks, now it works.

And I don't think there is needed any checkbox. One can use html/css parameters to limit plasmoid content dimensions (or I hope it can be done :P) if it is needed.

Report

C

Emdek

10 years ago

Yeah, very good observation. :-)
It happens because scaling is done in context of current applet size and will always make applet to fit in that rectangle so it could become only smaller...
I'll try to fix it soon.

All these factors are responsible.
Every plasmoid can change it's size itself, but usually it sets it only once and then it's size is saved and later only restored. There are also applets with dynamic size, which tries to use all available space (task managers, systray, spacers etc.). All items on panel are managed by layout.

You can read about layouts here:
http://doc.trolltech.com/4.6/layout.html

Report

C

Emdek

10 years ago

Yeah, removing Plasma configuration often helps with strange bugs (like applets rearranging themselves and disappearing after each login...)...
Also option to resize applets in panels like spacers could help in this case.

Report

koso83

10 years ago

ok, so now it broke again, so I made some more experiments and finally I can reproduce it :)

Lets say you place new adjus.clk. plasmoid on panel, ant let it's default width is 100px. Now modify format, so that width of plasmoid changes to 50px (remove some values). And now try to return back => set default profile. Result is, that plasmoid width stays at 50px! Even after desktop restart.

Another example. Place plasmoid on panel, and try to make it double width (copy formating values). It also fails to resize and stays at initial dimensions.

and now is question, who is responsible for plasmoid dimensions on panel. Plasmoid itself? Or panel? Or there are interfering some space consuming plasmoids? (in my case only default task manager).

Report

C

Emdek

10 years ago

If that still doesn't help there is one more option, experiment a bit with width / height of main block, maybe it will help.
If not you can try to do some debugging with setting margins to 0 and some background for main block, for example red, to check if applet occupies the same height in both versions.

It's strange, for me default format works fine on panel (KDE 4.5, Qt 4.7):
http://simplest-image-hosting.net/jpg-0-plasma-desktopxh3918

Report

koso83

10 years ago

So finally I resolved it with plasma configuration wipe. After that, it worked. I tried to diff old and new config, but have no idea where was problem. Only differeces in clock configuration were items like geometry, zvalue and order.

Report

C

Emdek

10 years ago

Try top and bottom, starting with none.

Report

koso83

10 years ago

I am using margin-top in my custom format, so i have played with it, has no affect on plasmoid width, only displayed text was moving vertically according to actual settings.

Report

Contrast

10 years ago

First and foremost, much thanks for your work on this widget-- It's been my #1 choice for quite some time since the default clock is pretty much hideous on the panel.
With that said, in KDE 4.5, the settings dialog for Adjustable Clock appears to be completely useless now. Any changes made by the user aren't applied after hitting OK; the widget itself doesn't reflect them and the settings are reset to their defaults upon re-opening AC's settings dialog. If the fixes to the problems BETLOG mentioned are still a ways off, hopefully this will be a quick fix. Otherwise, I'm on pins and needles for the next release. :D

Report

C

Emdek

10 years ago

Thanks. ;-)

Most probably the reason is that developers changed API of library used by clock applets (name of method which is called to save settings)...
Currently I'm busy working on other stuff, but I'll try to release new version with at least most important fixes soon (maybe during this week).
For now you can try to manually apply these changes:
http://websvn.kde.org/?view=revision&sortby=date&revision=1101251

Report

Contrast

10 years ago

Friggin' awesome, man. Back to normal. Much thanks, especially for the quick reply. :)

Report

BETLOG

10 years ago

Linux 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010 x86_64 GNU/Linux
Lucid Lynx 10.04 KDE

It is a pity this clock misbehaves so badly on my system, it has just the right amount of customization i want, but feels so broken when grappling to configure its 'rich text' interface that I removed it.

Behavioral errors include:

-when text is selected in 'rich text' window
1)font is arbitrarily set to something else (i forget... but NOT what i was selecting)
2) text sizing is arbitrarily changed or perhaps reset, and formatting (bold etc) is lost each time rich text is selected
3) source code is a horrible mess after clicking in rich text screen.

-despite being of exactly the same font type/size as the default KDE clock, and having a 0 border set in 'source' panel the adjustable clock does not fit on the panel (it is pushed down a bit)

-the adjustable clock seems to refresh too often, or in a way that is to.. ?forceful? and gives a feeling of stealing focus from it's own config dialogs, that makes it feel inherently broken in general. Most noticeable in the 'rich text' window as described above.

*feature request:
1) double click clock automatically clipboards a preselected date/time format from the list.
2) single click can invoke a command (to activate a calendar/organizer or other application of the users choice)

Report

C

Emdek

10 years ago

Well, KDE in Ubuntu, especially 64 bit has some issues, at least for some users (can't confirm, I've only 32 bit processor).

Graphical editing is limited and problematic (especially font sizing) because it uses WebKit rich text editing capabilities (that's why it produces so ugly output - which could be worse, it's partially filtered). Previously it used simpler editor based on simpler KDE widget (very limited HTML and CSS) but it was too limited. It's not easy situation, it's hard to improve but reverting would be also regression. :-/

To move text to right position you can try to experiment with setting width and height for top level most block container (for example DIV) and set negative margins (it became a bit broken recently - without touching it's code, at least with KDE 4.5 and Qt 4.7).

Which part steals focus? Applet? Parts of editor dialog? Can't confirm.

Currently you can copy time in specified format using middle click (format can be specified using clipboard actions page).

And I'm not sure if there should be additional option for changing click behavior (some Plasma developers hates "too many" options) but it could be done in future using special links, something like: <a href="exec:'app'">Run application</a> or using JavaScript.

Report

BETLOG

10 years ago

Perhaps an option to disable/remove the rich text input.
"if buggy, uncheck this box for raw edit"..sort of thing.
.. ugly, but at least users dont become frustrated when they click on the richtext after hand coding the stylesheet for it, only to have it mangled.
Or maybe just auto-disable richtext in incompatible versions?

re: 'steals focus'
Sorry, I expressed that poorly. It just *felt* slow and gluggy like some element of it was updating excessively, or trying to take focus when it shouldnt be, the rich text input section felt that way, probably because it persistently did something different to what i was trying to do.

Yes, i noticed the custom formats, but i didnt realize the middle click clipboarded them.. nice.

A leftclick option to start kcontact or korganizer (or whatever) would be perfect.

However the rich text input not working for me makes me sad. I have been looking for a nice simple clock ever since I used XFCE in xubuntu.. this one is sooo close.

Report

C

Emdek

10 years ago

Well, for sure that rich text editor part needs more love but I don't like idea of locking it. When KDE 4.5 will be stabilized finally (and Qt 4.7 too) I'll try do something to do with these problems. And until something is changed using rich text part code is not changed in source part. Changing style for no reason during selection happens very rarely and is most probably something in WebKit itself (style change is triggered only by clicking buttons or using combo boxes).

That slowness is visible only when selecting test in rich text part? If yes then it might be byproduct of code that forces selection to contain also character after percent sign to avoid accidental destruction of placeholders. It's not easy to do things like that using web content comparing to "plain" rich text (it's more like nasty hacks comparing to clean and powerful API for "native" Qt / kdelibs widgets)...

By the way, I've also used that clock, but before I was using clock like that in IceWM.

Report

EagleOrion

10 years ago

I would like the tool tip to show me the time in a time zone different from the local one. For example, my local time zone is Eastern U.S.A. and I want my tool tip to show the time in Amsterdam. What is the code for this request?

Report

C

Emdek

10 years ago

It's possible only by source code modification...

Simplest method is to add specified amount of seconds to m_dateTime in method AdjustableClock::updateToolTipContent. It should be easy to do using QDateTime class documentation.

Report

echoes

10 years ago

probably a stupid question but what is the code for the hour display for 12/hr (AM/PM) without the leading zero?

Report

C

Emdek

10 years ago

It's %l.
All codes are available in menu under button in top right corner of configuration dialog.

Report

echoes

10 years ago

i knew it was somewhere but couldn't remember or find it. thanks.

Report

gytis

10 years ago

Hi, i'm on 10.04 KDE 4:4.3

Firstly it seemed that i was missing /usr/include/plasmaclock dir with files, fixed that, now seems that it cant build plasma_applet_adjustableclock.so. Whats wrong?

Code:

gytis@ltn-gytis:~/Downloads/adjustableclock-2.2$
gytis@ltn-gytis:/usr/bin$
gytis@ltn-gytis:~/Downloads/adjustableclock-2.2/applet$ ../install.sh
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt-Version 4.6.2 (using /usr/bin/qmake)
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXau.so;/usr/lib/libXdmcp.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/libX11.so
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Found Automoc4: /usr/bin/automoc4
-- Found Perl: /usr/bin/perl
-- Phonon Version: 4.3.1
-- Found Phonon: /usr/lib/libphonon.so
-- Found Phonon Includes: /usr/include/qt4/KDE;/usr/include/qt4
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Failed
-- Performing Test HAVE_FPIE_SUPPORT
-- Performing Test HAVE_FPIE_SUPPORT - Success
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL
-- Performing Test __KDE_HAVE_W_OVERLOADED_VIRTUAL - Success
-- Performing Test __KDE_HAVE_GCC_VISIBILITY
-- Performing Test __KDE_HAVE_GCC_VISIBILITY - Success
-- Found KDE 4.4 include dir: /usr/include
-- Found KDE 4.4 library dir: /usr/lib
-- Found the KDE4 kconfig_compiler preprocessor: /usr/bin/kconfig_compiler
-- Found automoc4: /usr/bin/automoc4
-- Looking for dgettext
-- Looking for dgettext - found
-- Found Gettext: built in libc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gytis/Downloads/adjustableclock-2.2/applet/build
Scanning dependencies of target plasma_applet_adjustableclock_automoc
Generating AdjustableClock.moc
[ 0%] Built target plasma_applet_adjustableclock_automoc
[ 8%] Generating ui_clipboard.h
[ 16%] Generating ui_appearance.h
[ 25%] Generating ui_advanced.h
Scanning dependencies of target plasma_applet_adjustableclock
[ 33%] Building CXX object CMakeFiles/plasma_applet_adjustableclock.dir/plasma_applet_adjustableclock_automoc.o
[ 41%] Building CXX object CMakeFiles/plasma_applet_adjustableclock.dir/AdjustableClock.o
Linking CXX shared module lib/plasma_applet_adjustableclock.so
/usr/bin/ld: cannot find -lplasmaclock
collect2: ld returned 1 exit status
make[2]: *** [lib/plasma_applet_adjustableclock.so] Error 1
make[1]: *** [CMakeFiles/plasma_applet_adjustableclock.dir/all] Error 2
make: *** [all] Error 2

An error occured during compilation!
Check if you have installed all needed header files.

Report

C

Emdek

10 years ago

It looks like it can't find liplasmaclock files.
Check if packages containing library and it's devel files are properly installed.

Report

gytis

10 years ago

Could you tell which packages?

Report

Contrast

10 years ago

Hey there. I just saw you were having some trouble building a Plasma widget on Kubuntu 10.04. The packages you need to install are:
kdelibs5-dev kdebase-workspace-dev libqt4-dev
I'm actually not certain on whether that last one is needed, but it doesn't hurt to have it around, as it's necessary for building any Qt4-based application.

Report

C

Emdek

10 years ago

It differs between distributions...
It's files might be in following packages (or with similar naming):
libplasmaclock, kdebase-workspace-devel, kdebase-devel, kdebase-workspace. In source tree it's located in workspace/lib, maybe it will help in finding it.

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 21