Bug 262897

Summary: Add option to run script once an activity is restored/paused
Product: [Unmaintained] kactivitymanagerd Reporter: Kai Uwe Broulik <KaiUweBroulik2>
Component: generalAssignee: Ivan Čukić <ivan.cukic>
Status: RESOLVED FIXED    
Severity: wishlist CC: chanika, ivan.cukic, kde, Wolfram.R.Sieber
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Kai Uwe Broulik 2011-01-11 22:10:10 UTC
Version:           unspecified (using KDE 4.5.95) 
OS:                Linux

On my notebook I have several activities (although I didn‘t like the activity idea at first, I am getting to love it in 4.6) created, such as work, home, movie and stuff which different setups.
At my working office we have a Novell server. So I have created a script using ncpmount that mounts my personal files and applications on the server to my home directory prompting my password.
Unfortunately, it is not possible to run this script automatically once I resume my work activity.
It should be possible to run a script automatically once an activity is restored (and if it is paused)

Reproducible: Always
Comment 1 Chani 2011-01-11 23:11:45 UTC
yes, this could be done using the same standard used for things that run on login.

anyone interested in working on it? :)
Comment 2 Wolfram R. Sieber 2011-05-16 23:03:45 UTC
I think this would definitely be a plus: One could launch kdevelop when going to "devel" activity or vlc when switching to "leisure".

@Chani Isn't there a hook dangling somewhere where a simple CLI script could catch it and then launch the wanted scripts from there?
Comment 3 Kai Uwe Broulik 2011-12-06 18:06:10 UTC
Now you can at least start an application when an activity is launched, although there is no UI for configuring that, is there?
Comment 4 Ivan Čukić 2012-03-21 17:47:44 UTC
We are coming closer to this goal. The activity templates allow to start applications, but that was the first step.

The planned (hopefully fixed soon) are folders like .kde/Autostart (and others) for each activity. (the events to support are : switching to activity, switching from activity, starting, stopping)
Comment 5 Ivan Čukić 2015-11-30 20:30:48 UTC
This is the oldest activities feature request that I always planned to implement, but never got to.

The activities templates thing available in Plasma 4 is no longer here, so I started working on supporting this in the activity manager itself.

I'm not sure whether this will be exposed in the UI (there are a few things I'm concerned about) but there is a branch of kactivities where this is fully implemented - starting applications on activity switching, starting and stopping.

The behaviour will be as follows (I need to blog about this, and write the documentation at some point):

- switched-to - executed when the activity becomes the current one
- switched-from - executed when the activity stops being the current
- started - when the stopped activity is started OR when the user switches to the activity for the first time in the current session (people rarely actually stop the activity, so this is IMO a more useful definition of 'started')
- stopped - when the user stops the activity