axe1
Posts: 8
Joined: Sun May 12, 2013 11:02 pm

Creating a widget

Mon May 13, 2013 2:07 pm

Hi!

I would like to create a widget for the desktop with the following properties:
- Always visible
- Starts when LXDE boots
- Displays an image (jpg/png)
- Locked (not possible to move/edit/close by the user)
- Dynamic: every time the user selects a desktop icon the image in the widget changes accordingly

Before starting coding it I wanted to ask for suggestions
Does something like this already exist?
Which would be a better language option python (wxwidgets) or c++ (qt) ?
How can the window manager (desktop icons) and the widget communicate?

Many thanks for the help!

User avatar
DaveDriesen
Posts: 113
Joined: Sun Mar 31, 2013 8:28 pm
Location: Top of the food chain
Contact: Website

Re: Creating a widget

Mon May 13, 2013 2:56 pm

Hi,

Your app and the window manager will typically communicate through events/callbacks.
The exact mechanism depends on your choice of language or library.

In a pure X context, you would use XCreateWindow() to create a window for your app. Then when the user clicks somewhere, this will generate an event. Whether or not your app will intercept that event, depends on the window attributes you specify during the aforementioned call. If and when the app does receive the event, you can use code within a specifiable callback function to act on that.

Displaying an image, and changing it, does not have to be hard either but you may need to link to some libraries for loading/converting.

P.S. Never mind whether it exists or not, just hack away!

Dave Driesen
Linux dev and oldskool elite

axe1
Posts: 8
Joined: Sun May 12, 2013 11:02 pm

Re: Creating a widget

Mon May 13, 2013 4:00 pm

Hi Dave,

Thanks for your reply. I know how to use XEvent to capture I/O events within the app window. However, in my case XEvent doesn't help because the desktop icons are placed outside the app window.

What I need, as you said, is to capture events generated by the window manager. Could you please share a link to documentation/examples where this is done?

Thanks a lot!

Return to “General programming discussion”