Screenlets doesn't remember the correct workspace on restart

Bug #868311 reported by Diego Lima
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Screenlets
Fix Released
Medium
Diego Lima
screenlets (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

After positioning different screenlets in different workspaces and restarting the system/logging off and then on, all screenlets are incorrectly placed on the first workspace. A workaround to this might be using Compiz's "place" plugin, however since the window names do not have unique titles (when using more than one screenlet of the same type) this becomes impossible.

The best solution, IMO, would be if screenlets itself remembered the workspace number, but simply making the window name unique (i.e: instead of "ManometerScreenlet.py" the window would call itself "ManometerScreenlet01.py", according to the screenlet instance number).

Tags: patch
Revision history for this message
Diego Lima (diegolima) wrote :

I've decided to take a look around Screenlet's code and while I'm not a python expert I figured out the way it loads its Screenlets and I've (manually) done this as a workaround: Instead of loading the Screenlet directly, creat a numbered copy on ~/.screenlets and instead load it. That way we can have "unique" screenlets instead of multiple copies of a single screenlets, each with its own window name (the number).

I'm going to try to implement that in the code, but I'd like to know if that sounds acceptable or too "hackish" (that would solve the positioning problem, though, since I'm now able to use the Place plugin to position each screenlet as I please).

Revision history for this message
Märt Põder (boamaod) wrote :

It seems acceptable, it's not more hackish than screenlets itself, but I suggest that instead of just a copy, you should create a symbolic link. Are you familiar with Bazaar version control? I made you member of Screenlets Developers team, and you can submit code directly. Just try to write clean and understandable code, so we can see, if there could be problems or everything works out fine.

Changed in screenlets:
status: New → Confirmed
status: Confirmed → Triaged
importance: Undecided → Medium
assignee: nobody → Diego Lima (diegolima-br)
Revision history for this message
Diego Lima (diegolima) wrote :

Hi! I wasn't familiar with Baazar itself although I'm familiar with other versioning systems so it should be ok. I've already checked out the sources and I'll submit once I have something working.

As for the symlink, I'll probably link everything but the screenlet's .py script itself since I'll need to modify it to make the screenlet name unique.

Revision history for this message
Märt Põder (boamaod) wrote :

Maybe you can make a generic DummyScreenletNN.py (or whatever name you need) calling to WhateverScreenlet.py, because it's good NOT to have many of the same actual screenlets in system. I think, it would cause trouble when updating a screenlet version and/or render modifying the screenlet code very obscure. What about starting screenlet from command prompt, will your planned changes apply to this situation too?

I remember that there is some python (or c) module to change file name/identifier when the file is running. I don't remember the name of the module now (and I don't know if this will work for Compiz plugins), but this might be usable for implementing your idea. Maybe you can go for much less hackish solution this way... If I recall the name of the module, I'll let you know.

Revision history for this message
Diego Lima (diegolima) wrote :

Ok, I managed to come up with a much simpler solution. Instead of making copies, I'm just setting the window role, which was previously unused and can be used to uniquely identify windows.

I'm currently using the configuration's file name to name the window role, so for each different configuration you'll have a unique window. You can then use a window manager such as compiz to position the widgets as you please.

This shouldn't break any existing functionality and shouldn't introdue any complexity or obscurity in maintaining existing screenlets. More testing and feedback on this would be very welcome.

Revision history for this message
Diego Lima (diegolima) wrote :

Attaching the patch for session.py

Revision history for this message
Diego Lima (diegolima) wrote :

I've also commited the changes to baazar (revs 724 and 725).

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "__init__.py.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Diego Lima (diegolima) wrote :

Last patch was setting the window role too late and thus the window manager wouldn't correctly place the window. Fixed this by setting the window role as soon as it is created (and less changes are necessary as well).

Diego Lima (diegolima)
Changed in screenlets:
status: Triaged → In Progress
Diego Lima (diegolima)
Changed in screenlets:
status: In Progress → Fix Committed
Märt Põder (boamaod)
Changed in screenlets:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in screenlets (Ubuntu):
status: New → Confirmed
Revision history for this message
Märt Põder (boamaod) wrote :

Diego, is there any chance that you write a short tutorial about how to use this feature? I think a short list of steps needed would be enough. We could link it from screenlets.org or even just this bug report.

Revision history for this message
Diego Lima (diegolima) wrote :

Hi! Of course, I'll work on that on the weekend. I'll attach it to this bug report once its done and you can then place it on screenlets.org.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.