Actman
m (typo fix) |
m (→Status menu widget: use {{clear}}) |
||
Line 14: | Line 14: | ||
* Delete: Deletes the selected activity. It is not possible to delete the current activity | * Delete: Deletes the selected activity. It is not possible to delete the current activity | ||
* More: Shows more actions | * More: Shows more actions | ||
- | |||
[[Image:actman-ss-more.png|thumb|300px|alt=Screenshot of Actman more actions|More actions]] | [[Image:actman-ss-more.png|thumb|300px|alt=Screenshot of Actman more actions|More actions]] | ||
Line 22: | Line 21: | ||
* Store current: Saves the current activity without switching to a new one | * Store current: Saves the current activity without switching to a new one | ||
* Reload current: Reloads the current activity | * Reload current: Reloads the current activity | ||
+ | {{clear}} | ||
== Command line tool == | == Command line tool == |
Revision as of 15:06, 7 February 2011
Desktop Activity Manager, or D-A-M, or DAM, or actman, is a command line tool and a status menu widget that allows saving and restoring of the desktop. There can be multiple saved desktops so it is possible to have different activities (desktop profiles) and switch between them by saving the current one and loading another.
For discussion about actman visit this thread.
Contents |
Status menu widget
The status menu widget is a front-end to the command line tool. While it doesn't have all its features it is easier to use and handles all common user actions.
The main page includes the following actions:
- Select: Saves the current activity and switches to the selected (highlighted) activity.
- New: Create a new activity that is a duplicate of the current one
- Rename: Renames the selected activity
- Delete: Deletes the selected activity. It is not possible to delete the current activity
- More: Shows more actions
When clicking "more", some more actions are shown:
- Store current: Saves the current activity without switching to a new one
- Reload current: Reloads the current activity
Command line tool
The command line tool is named "activity" and is installed in /usr/bin
. It should be run as user (and not as root!) and it includes a help screen:
~ $ /usr/bin/activity help Activity manager 1.1 Available commands: change DEST Store current activity and load DEST. clone ACT1 ACT2 Create activity ACT2 as a clone of ACT1. Current activity will not be changed. create ACTIVITY Create a new (empty) activity. current Print the current activity name. delete [-f] ACTIVITY Same as remove. help This help. list List available activities. load [-f] SRC Load activity SRC. If -f is used then it will be allowed to re-load the current activity. new ACTIVITY Same as create. reload Reload current activity without storing first. remove [-f] ACTIVITY Remove activity ACTIVITY. If -f is used then there will be no questions asked. rename ACT1 ACT2 Rename activity ACT1 to ACT2. runstart [ACTIVITY] Run scripts of entering an activity runend [ACTIVITY] Run scripts of ending an activity store DEST Store current activity as DEST. version Print the version
Activities are stored under /home/user/.activities
To get a list of available activities use "list":
~ $ /usr/bin/activity list car clean empty main main2 main3 Tei Test test2
To save the current activity and switch to a new one use "change", etc.
How it works
TBD
Running user scripts
Since versions 1.1, actman has the ability to run user scripts.
The scripts are stored under /home/user/.activities/scripts
(which does not exist by default).
There are two kind of scripts:
- Scripts that are associated with an activity (kindA)
- Scripts that are not associated with an activity (kindB)
There are two kind of script invocations "start" and "stop":
- start: is used when entering the corresponding activity
- end: is used when leaving the corresponding activity
The rationale behind this is to have initscript-like scripts that may start or stop services (kindA) or save/restore a widget's configuration (kindB).
Scripts associated with an activity
Those scripts are installed in a directory named as the activity. For example, for the activity 'main' one can place scripts in /home/user/.activities/scripts/main
. They will be ran when switching to or from that activity.
Scripts not associated with an activity
They are installed in /home/user/.activities/scripts/always
and are ran whenever an activity is switched.
Invocation
Scripts are ran with the parameter "start" or "stop" depending on the invocation type. For example it is possible to create a script that connects/disconnects from the Internet when entering/leaving an activity:
#!/bin/sh if [ "$1" = "start" ] ; then # Commands to connect to the internet elif [ "$1" = "stop" ] ; then # Commands to disconnect from the internet fi
Putting the above in /home/user/.activities/scripts/internet
and having an activity named "internet" (watch for the case) will result in auto connecting/disconnecting to/from the Internet when entering/leaving that activity.
For desktop widgets that want to implement per-activity settings and are not already handled by actman it is possible to put a script in /home/user/.activities/scripts/always
like this:
#!/bin/sh # This is where actman stores the settings of the activities # ACTMAN_ACTIVITY contains the name of the corresponding activity and it is # set by actman DEST=/home/user/.activities/$ACTMAN_ACTIVITY if [ "$1" = "start" ] ; then OLDSETTINGS="$DEST/myapp.tar" if [ -e "$OLDSETTINGS" ] ; then ( cd /home/user rm -rf .mywidget mkdir .mywidget tar -xf $OLDSETTINGS ) fi elif [ "$1" = "stop" ] ; then ( cd /home/user; tar -cf $DEST/myapp.tar .mywidget rm -rf .mywidget ) fi
The idea is to store the configuration files in the same location where actman stores each activity's settings (/home/user/.activities/<activity name>/
) as a tar (or even better as a tgz). $ACTMAN_ACTIVITY
will always have the name of the current activity and can be used as such.