Actman
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 |
[edit] 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
[edit] 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.
[edit] How it works
Actman (Activity Manager) works by:
- dumping (on store) and restoring gconf entries for each activity.
- copying (on store) and pasting (on switching/restore)the contents of $HOME/.config/hildon-desktop/home.plugins.
- copying (on store) and pasting (on switching/restore) the contents of $HOME/.bookmarks/home-thumbnails.
- killing hildon-home whenever the user decides to change their activities.
Such gconf that are dumped and restored are: - appletbase (widgets and shortcuts for each home screen and their positions)
- viewsbase (the amount of home screens the user has and the background images for each home screens)
- hildon-home (bookmarks and shortcuts the user has for this particular activity)
- contacts (contacts that the user has placed on the home screens)
Individual files and directories are copied and pasted such as:
- homeplugins (widgets used)
- thumbnails (bookmarks to web pages the user has for this particular activity)
In addition to what it does above, actman allows users to place scripts to be executed before and/or after the switch across to this activity, it also allows cloning of activities, restoring without saving changes, renaming as well as listing of the activities already stored.
These activies are usually stored in ~/.activities/activities/<name_of_activity_the_user_chooses_to_name>/. The only exception is the root user and in almost all cases ~ would be /home/user (unless one decides to login through another username for instance).
[edit] 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).
[edit] 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.
[edit] Scripts not associated with an activity
They are installed in /home/user/.activities/scripts/always
and are ran whenever an activity is switched.
[edit] 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.
- This page was last modified on 22 November 2011, at 02:45.
- This page has been accessed 20,718 times.