The DesktopGadget is a small window moving around you desktop screen ; it's a container widget
and is able to contains usefull object for short information or notification.
Details
DesktopGadget is :
- as small as possible and display short messages or notification ; in given code, this is just a literal clock ; I intend to build
a Google calendar gadget notifier.
- this visual gadget is movable all arround the screen ; there is some options in script code to change display and position (on top, on desktop ...)
- position is saved in a configuration file using Config class
- given code is fully object oriented and allow some changes
- if you can write some php-code and have some Gtk skill, you could be able to write some (un)usefull gadgets.
The most interesting part of code is at the end and show you how it's very easy to add some gadgets :
<?php
# include some classes code before ...
# an example gadget (it's just a gtkWidget)
class ClockGadget extends GtkLabel{
protected $timeout_id;
protected $format;
public function __construct($format = 'd/m - H:i:s'){
parent::__construct();
$this->format=$format;
$this->timeout_id = Gtk::timeout_add(1000, array($this, 'on_timeout'));
$this->modify_font(new PangoFontDescription('Sans 7'));
$this->on_timeout();
}
public function on_timeout(){
$this->set_text(date($this->format));
return true;
}
}
$gadget = new DesktopGadget($title='Desktop Gadget');
$gadget->pack_start($clock = new ClockGadget());
Gtk::main();
?>
Restrictions
You should have write acces to directory where this script is running to save gadget position.
Source Code
source code is provided as a link below for free as LGPL licence ; also available here
Links
- GtkWindow API : set_skip_taskbar_hint, set_skip_pager_hint, set_keep_above, (un)stick, set_decorated and custructor
Todo
- write some gadgets : google calendar, hosts pinging, email watcher for example
- write a configuration interface
Recent comments
6 weeks 12 hours ago
11 weeks 6 days ago
13 weeks 4 days ago
20 weeks 9 hours ago
21 weeks 2 days ago
21 weeks 3 days ago
22 weeks 4 days ago
23 weeks 3 days ago
34 weeks 1 day ago
34 weeks 2 days ago