Prevent accidental double launching of applications within two seconds

Registered by Eemil Lagerspetz

People are often unsure if an application has launched, and if they should double- or single-click on a button. I suggest that dockbarx record the time when an application was launched, and let it be launched again no earlier than two seconds since previous launch. I also have a patch for this. This is slightly workaroundish though; the proper way is to provide launch feedback and not allow relaunch at all except with the specific launch action.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Matias Särs
Completed by
Matias Särs

Related branches

Sprints

Whiteboard

Here is a patch to do this:

--- dockbarx.py 2009-05-25 09:48:56.000000000 +0300
+++ dockbarx-mine.py 2009-07-09 14:18:25.000000000 +0300
@@ -639,6 +639,7 @@
 class Launcher():
     def __init__(self, name, path):
         self.name = name
+ self.lastlaunch = None
         if not os.path.exists(path):
             raise Exception, "DesktopFile "+fileName+" doesn't exist."

@@ -657,8 +658,13 @@
         return self.desktop_entry.getName()

     def launch(self):
+ import time
+ if self.lastlaunch is not None:
+ if time.time() - self.lastlaunch < 2:
+ return
         print 'Executing ' + self.desktop_entry.getExec()
         self.execute(self.desktop_entry.getExec())
+ self.lastlaunch = time.time()

     def remove_args(self, stringToExecute):
         specials = ["%f","%F","%u","%U","%d","%D","%n","%N","%i","%c","%k","%v","%m","%M", "-caption","--view", "\"%c\""]

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.