[ Printer Friendly Page ]
[ E-mail this Document to Someone ]
[ Was this document useful? Yes or No ]
Infodoc ID |
|
Synopsis |
|
Date |
15774 |
|
Dtaction PSD |
|
26 Sep 1997 |
----------------------------------------------------------------------------
Dtaction
PSD
----------------------------------------------------------------------------
General Information:
1. What are Actions
2. Dtsession's environment and the Command Line environment
3. Action/Data Types Search Paths and Environment Variables in CDE
4. Files are associated with an Action in CDE
5. Anatomy of a COMMAND Action in CDE
6. CDE: What is dtspcd? How is it set-up?
How To's:
7. Invoking actions from the command line
8. CDE: How is an Action selected?
9. Adding xload to the Front Panel in CDE
10. CDE: Using xlock from the dtwm front panel
11. CDE: Locking the Screen Without Using xlock or the Front Panel
12. CDE: how to change the editor default action
13. Adding and Removing Actions to and from the CDE desktop
Related Topics:
14. CDE: ttsession client limit causes failed actions, defunct processes
1. What are Actions
Tech Note id:001.data
Last Updated:04/18/97
Actions are instructions written to automate tasks such as running
applications. Actions used with Data Types are powerful components
for integrating applications into the desktop. The desktop
provides the ability to attach user interface components such as
icons to actions. Conversely, Actions can be easily attached to the
desktop's Front panel.
If you are familiar with object oriented technology, an
analogy between that paradigm, and Actions and Data Types can be made.
A Data Type can be thought of as a CDE class. Actions can be
thought of as the methods available for instances of these CDE class.
Actions act on these instances.
Actions can be created using the Create Action application, or
created manually. Create Action is launched from the Desktop_Apps
folder in Application Manager. There are several Actions in
the Desktop_Tools in Application Manager, as well.
2. Dtsession's environment and the Command Line environment
infodoc id: 14638
Last Updated:12/21/96
DETAIL DESCRIPTION:
When a CDE application, such as dtterm is started via actions (e.g.
Front Panel, Appmanager, Workspace Menu), a different environment can
be inherited than that which is established in the the command
line environment.
When CDE applications are launched via actions, the
action inherits its environment from its parent, which is very
likely to be the session manager, dtsession.
By default, a user's account shell start-up files ($HOME/.login,
$HOME/.profile etc) are *not* sourced when the user logs in via dtlogin
and dtsession. (This is controlled by a setting in $HOME/.dtprofile).
Therefore by default, environment variables set in these start-up files
are
*not* available from dtsession and to actions.
When CDE applications are launched from the command line, the
action inherits from that command line's shell.
The start-up files are sourced by the time the command line
interface is established; therefore, the start-up
files's environment variables are available to actions.
3. Action/Data Types Search Paths and Environment Variables in CDE
infodoc id: 14637
Last Updated:12/20/96
DETAIL DESCRIPTION:
CDE uses search paths to locate applications and associated desktop files.
There are four search paths: Application, Database, Icons and Help data.
Of interest to Actions and Data Types is the Database search path. The
Database search path is used to specify locations for action and data type
definition files (as well as Front Panel files).
To obtain the search paths' value for the current user, execute this
command:
dtsearchpath -v
dtsearchpath uses a combination of environment variables and built-in
values
to create search paths.
The environment variables dtsearchpath reads are called input variables.
For the Database search path, the input variables are:
DTSPSYSDATABASEHOSTS - System Wide Input Variable, set in
/etc/dt/config/Xsession.d/0010.dtpaths.
For example, if this file doesn't exist, copy it
from
/usr/dt/config/Xsession.d/0010.dtpaths. Then,
add the following line:
export DTSPSYSDATABASEHOSTS=/var/applications/db
By default, this value is set to
/etc/dt/appconfig/types/{language}
where {language} by default is C.
DTSPUSERDATABASEHOSTS - Personal (User) Input Variable, set in the
$HOME/.dtprofile. For example:
export DTSPUSERDATABASEHOSTS=/home/user/mydb
By default, this value is set to
$HOME/.dt/types
For changes to the input variables to take effect, one must exit, then
re-enter the CDE window manager.
The Database search path built-in value is
/usr/dt/appconfig/types/{language}
where {language} by default is C.
When dtsearchpath assembles these values, it assigns these values
to an output variable. For the Database search path, the output
variable is DTDATABASESEARCHPATH.
DTDATABASESEARCHPATH by default will be something like:
/home/user/.dt/types
/etc/dt/appconfig/types/%L
/etc/dt/appconfig/types/C
/usr/dt/appconfig/types/%L
/usr/dt/appconfig/types/C
DATABASESEARCHPATH is created by incorporating the following environment
variables or locations:
+ DTSPUSERDATABASEHOSTS
+ $HOME/.dt/types
+ /etc/dt/appconfig/types/{language}
+ DTSPSYSDATABASEHOSTS
+ DTSPSYSAPPHOSTS
+ /usr/dt/appconfig/types/{language}
4. Files are associated with an Action in CDE
infodoc id: 14640
Last Updated:12/21/96
DETAIL DESCRIPTION:
There are three items associated with Actions:
- An action file - an executable file with the same name as an action,
but
it is only used to "view" the action via desktop tools, for example
File Manager or Application Manager. For example, the action file for
the "Reload Action" action is:
/usr/dt/appconfig/appmanager/C/Desktop_Tools/ReloadActions
- An action definition file - a file named with the ".dt" extension,
containing the definition of the action. For example, the
action definition file for the "Reload Action" action is:
/usr/dt/appconfig/types/C/dt.dt
Established action files containing one or more action definitions
can be found in /usr/dt/appconfig/types/C
- An action icon - the pixmap or bitmap that represents the action file.
The default icon (a jogger) is:
/usr/dt/appconfig/icons/C/Dtactn.*
Established CDE Action icons are found in:
/usr/dt/appconfig/icons/C
When an action is selected through desktop tools, the action file is
"selected".
When an action is double-clicked, the action is invoked. The actions
database is searched to see if there are any actions whose name matches
the action file's name. If a match is found, the underlying action
definition is used to determine the action's behavior.
5. Anatomy of a COMMAND Action in CDE
infodoc id: 14641
Last Updated:12/21/96
DETAIL DESCRIPTION:
An Action Definition has the following syntax :
ACTION
{
TYPE
+
}
where:
is the name used to invoke the action
is one of three types of Actions:
1) Command actions. A command action executes a command that starts an
application, utility, shell script, or operating system command.
2) Map actions, which is primarily used to specify alternative names
for actions. A map action is "mapped" to another action.
3) TT_MSG actions, which send Tooltalk messages.
+ is one or more fields that describe an action's behavior
or look and feel.
Here is an overview of some of the {action_fields} used in
the popular Action Type COMMAND:
WINDOW_TYPE: specifies the type of windowing support required by the
action:
- NO_STDIO: No type of windowing support. The action
has its own window or has no output.
- PERM_TERMINAL: a permanent terminal emulator window, which
remains
open until the user closes it.
- TERMINAL: a temporary terminal emulator window, which closes as
soon as the command is completed.
EXEC_STRING: the application, shell script or operating system command
that this action is to invoke. There is special syntax that can
be used in case arguments are needed:
- %(File)Arg_{n}%
lets a user drop a data file on the action
where {n} is an integer starting at 1
- %Args%
accepts multiple files, that a user drops on the action
- %(File)"{prompt}"%
displays a prompt for a file name, when the user invokes
the action
where {prompt} is a text string that prompts the user
for a file name
-%(File)Arg_{n}"prompt" combines the two above. It accepts
a dropped file as an argument. Otherwise, it displays
a prompt for a file name
-%(String)"prompt"% prompts for a non-file argument
LABEL: the Action Label seen in CDE's File Manager and Application Manager
ICON: used to specify the icons seen in CDE's File Manager and Application
Manager
For example, an Action that runs a single Unix C shell command is:
ACTION csh_command
{
TYPE COMMAND
WINDOW_TYPE PERM_TERMINAL
EXEC_STRING /usr/bin/csh -c '%(String)"Csh Command: "%'
LABEL One-time C Shell
ICON /usr/dt/appconfig/icons/C/Dtterm.m.pm
}
To make this work from CDE's dtfile, create an empty executable file
called csh_command, and make it executable:
$ touch csh_command
$ chmod 755 csh_command
Then, create a file called $HOME/.dt/types/csh_command, that
has the above action.
Run this command:
$ dtaction ReloadActions
To invoke the action, bring up dtfile, and double-click the csh_command
empty file, previously created.
6. CDE: What is dtspcd? How is it set-up?
infodoc id: 14644
Last Updated:12/18/96
DETAIL DESCRIPTION:
Dtspcd, or more formally the desktop subprocess control service daemon,
is used by the desktop to launch remote applications and actions.
It is an inetd daemon that accepts requests from remote clients to
execute commands.
As far as configuration goes, dtspcd must have access to the
authentication
directory that is also mounted by other subprocess control client systems.
By default, this is the user's home directory.
Also, dtspcd must be properly registered in two files:
1) /etc/services:
dtspc 6112/tcp
2) /etc/inetd.conf:
dtspc stream tcp nowait root /usr/dt/bin/dtspcd/usr/dt/bin/dtspcd
The CDE installation scripts automatically place these entries in
their proper files.
7. Invoking actions from the command line
infodoc id: 14642
Last Updated:12/19/96
DETAIL DESCRIPTION:
CDE provides the dtaction command for running actions from the command
line.
For example, to run the ReloadActions action, use:
dtaction ReloadActions
To run an action on a remote host running CDE, use the "-execHost"
argument:
dtaction -execHost remote ReloadActions
For more information, see the dtaction(1) man page.
8. CDE: How is an Action selected?
infodoc id: 14643
Last Updated:12/18/96
DETAIL DESCRIPTION:
Two steps are taken to determine which action is executed when an action
is invoked:
1) The action database is searched for a matching pattern name.
The action database is created initially when a user logs into
CDE. However, it is recreated when the Workspace Manager is Restarted,
when the user chooses save from the Create Action application,
or when the ReloadActions action is invoked:
dtaction ReloadActions
This database is created by collecting all the action and data type
definitions located in the DTDATABASESEARCHPATH path.
By default, DTDATABASESEARCHPATH has these paths:
$HOME/.dt/types
/etc/dt/appconfig/types/%L
/etc/dt/appconfig/types/C
/usr/dt/appconfig/types/%L
/usr/dt/appconfig/types/C
2) When one or more actions exist with that name, precedence rules are
used
to decide which one to use.
a) If no other precedence rules apply, the precedence is based
on the definition location. The location precedence,
from higher to lower precedence is:
- personal actions - those located in $HOME/.dt/types
- system wide local actions - those located in
/etc/dt/appconfig/types/C
- system wide remote actions - those located in
{hostname}:/etc/dt/appconfig/types/C
where {hostname} is the name of a remote host
and are listed in the application search path
DTSPUSERAPPHOSTS
- built-in actions - those located in /usr/dt/appconfig/types/C
For example, if an action called My_Action exists in both
/etc/dt/appconfig/types/C and /usr/dt/appconfig/types/C, then
the definition in /etc/... is the action that would be invoked
b) Actions that have action fields: ARG_CLASS, ARG_TYPE, ARG_MODE or
ARG_COUNT have precedence over less restrictive actions.
Precedence among these fields, from higher to lower precedence
is:
- ARG_CLASS
- ARG_TYPE
- ARG_MODE
- ARG_COUNT
Since ARG_COUNT can take values or "*", values have precedence
over "*".
For example, if these three actions are loaded into the actions
database:
ACTION My_Action
{
ARG_TYPE TEXTFILE
}
ACTION My_Action
{
ARG_COUNT 0
}
ACTION My_Action
{
ARG_TYPE *
}
and no argument is provided, then the second ACTION is invoked
because none of the other actions apply.
However, if an argument is provided, then the first ACTION is
invoked. ARG_TYPE takes precedence over ARG_COUNT.
9. Adding xload to the Front Panel in CDE
infodoc id: 14639
Last Updated:12/21/96
DETAIL DESCRIPTION:
1. Create a file in $HOME/.dt/types called load.fp, containing this
control:
CONTROL LoadMeter
{
TYPE client
POSITION_HINTS 3
CONTAINER_NAME Top
CONTAINER_TYPE BOX
CLIENT_NAME xload
CLIENT_GEOMETRY 88x64
}
2. Restart the Workspace Manager.
3. Type "xload &" at a command line.
4. If the Home Session is used (rather than the Current Session),
remember to re-save the Home Session to include the xload process.
10. CDE: Using xlock from the dtwm front panel
infodoc id: 13527
Last Updated:07/10/96
DETAIL DESCRIPTION:
Using xlock in the dtwm Front Panel
First the easy way (This is to overwrite the default CDE action)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Run dtcreate
2. Create an action called LockDisplay
3. Set the "Command when action is opened" field to:
/usr/openwin/bin/xlock
4. Set the "Window Type" field to No Output.
5. Save the file ==> this creates a LockDisplay.dt in ~/.dt/types
6. Reload the action.
This will help you to bring up xlock when you are using lock in the
front panel.
Second way (another way to use action)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Create a new action for your desktop. We'll call it Xlock.
2. Tell the desktop about the new action and then test it.
3. Modify the front panel so that it will call your new
action, Xlock, instead of the old action, LockDisplay.
1. CREATING A NEW ACTION:
- cd to ~/.dt/types and create a file called Xlock.dt.
- Add the following action definition to this file.
ACTION Xlock
{
LABEL Xlock
ARG_COUNT 0
TYPE COMMAND
WINDOW_TYPE NO_STDIO
EXEC_STRING /usr/openwin/bin/xlock
DESCRIPTION xlock
}
- This action definition defines an action called "Xlock".
When the action is called, it will execute xlock by
calling /usr/openwin/bin/xlock.
2. TELLING THE DESKTOP ABOUT THE NEW ACTION AND TESTING IT:
- Now that we have defined the new Xlock action, we need to
first tell the desktop about it and then test it.
- To tell the desktop about the new action bring up
the "Application Manager". You can do this by selecting
it from the front panel.
- From the Application Manager, select "Desktop_Tools"
- Now, select "Reload Actions".
- At this point, the desktop knows about the new Xlock action.
To test it, type "dtaction Xlock". Xlock should start up.
3. ADDING THE NEW ACTION TO THE FRONT PANEL:
- copy the dtwm front panel configuration file, dtwm.fp, from
/opt/CDE/appconfig/types/C directory to your personal dt
directory "~/.dt/types" directory.
- cd to ~/.dt/types
- From here, edit the dtwm.fp
- Search for Lock. You should see something like:
CONTROL Lock
{
TYPE icon
CONTAINER_NAME Switch
CONTAINER_TYPE SWITCH
POSITION_HINTS 1
ICON Fplock
LABEL Lock
PUSH_ACTION LockDisplay
HELP_TOPIC FPOnItemLock
HELP_VOLUME FPanel
}
- When you press the lock icon on the front panel, it calls
the action LockDisplay. The above paragraph is the definition
for that front panel lock icon.
- To get the front panel lock icon to call the action we
just defined, Xlock, instead of the LockDisplay action, all
you need do is change the PUSH_ACTION line from
"LockDisplay" to "Xlock".
CONTROL Lock
{
TYPE icon
CONTAINER_NAME Switch
CONTAINER_TYPE SWITCH
POSITION_HINTS 1
ICON Fplock
LABEL Lock
PUSH_ACTION Xlock
HELP_TOPIC FPOnItemLock
HELP_VOLUME FPanel
}
- Note: You might change the Label field to Xlock and you
might remove the HELP_TOPIC and HELP_VOLUME fields, but this
modification is not necessary.
- Now tell the window manger to reread the configuration
files. You do this by selecting "Restart Workspace Manager..."
from your workspace menu.
- Press the lock icon on the front panel...xlock should be
called. If not, make sure your DTDATABASESEARCHPATH
environment variable contains $HOME/.dt/types.
11. CDE: Locking the Screen Without Using xlock or the Front Panel
srdb id: 13436
Last Updated:07/10/96
DETAIL DESCRIPTION:
Locking the Screen in CDE Without Using xlock or the Front Panel
There are three ways to do this:
1. From the command line:
/usr/dt/bin/dtaction LockDisplay
2. From the menu:
Put the following line in your $HOME/dtwmrc file:
"LOCK" Alt Shiftl f.action LockDisplay
3. Using an accerator key:
Use method 2, but specify a key of your choice for locking the screen.
SOLUTION SUMMARY:
There are 2 solutions to this problem:
1. from command line:
/usr/dt/bin/dtaction LockDisplay
2. from menu
Please put this in your $HOME/dtwmrc
"LOCK" Alt Shiftl f.action LockDisplay
3. Using accerator key:
Using the previous methods 2 but using the key you define to
invoke the CDE lock screen.
12. CDE: how to change the editor default action
infodoc id: 13356
Last Updated:07/10/96
DETAIL DESCRIPTION:
CDE: Changing the Editor Default Action
a) cp /usr/dt/appconfig/types/C/user-prefs.dt
$HOME/.dt/types/user-prefs.dt
b) Change the MAP_ACTION to the appropriate editor action. Many actions
already exist in other *.dt files in /usr/dt/appconfig/types/C
for commonly used editors, such as vi and textedit, so it is
easy to map this to another action.
To change the action to use OpenWindows textedit:
ACTION TextEditor
{
LABEL Text Editor
ICON OWtextedit
TYPE MAP
MAP_ACTION OWtextedit
DESCRIPTION Use OW textedit
}
To change the action to use vi:
ACTION TextEditor
{
LABEL Text Editor
ICON Dtpenpd
TYPE MAP
MAP_ACTION Vi
DESCRIPTION Use standard unix vi editor
}
13. Adding and Removing Actions to and from the CDE desktop
infodoc id: 14636
Last Updated:12/20/96
DETAIL DESCRIPTION:
Actions can be placed on the CDE desktop simply by dragging
the action from dtfile and placing it on the desktop.
Actions remain on the desktop, much like any other window.
When a user logs out of CDE, but returns to the current session,
the actions remain on the desktop.
This information is stored in $HOME/.dt/Desktop/.!dtdesktop. However, do
not edit this file.
To remove actions, select them on the desktop, press the right
mouse button and select "Remove from Workspace" from the resulting menu.
Multiple actions can be selected by dragging a select box around the
icons.
14. CDE: ttsession client limit causes failed actions, defunct processes
infodoc id: 13380
Last Updated:07/10/96
DETAIL DESCRIPTION:
If you have a lot of tools running and new tools mysteriously start
failing to come up, you may have reached the default limit of
ToolTalk clients.
To raise the limit, set the -N option on the ToolTalk
message daemon, ttsession. This can be done by setting
dtstart_ttsession='/usr/dt/bin/ttsession -sN'
in the user's ~/.dtprofile. See "Starting the ToolTalk messaging
daemon" in the CDE Advanced User's and System Administrator's Guide.
As described in the book, the change can be made for all users on a
system by adding a script to /etc/dt/config/Xsession.d; before doing this
for
all users, consider that setting the -N option on ttsession will increase
ttsession's working set. This effect is most noticeable on
small-memory systems running Solaris 2.4; systems with lots of memory
and systems running Solaris 2.5 or later are much less affected.
This is a known bug, bugID 1222870. It has been fixed in 1.2.1.
By default, the desktop's ToolTalk session is limited to about 30
ToolTalk clients. This includes dtsession, dtwm, dtfile, dtpad,
dtmail, dtterm, and any long-running command actions launched from
e.g. the front panel, dtfile, or dtmail. When the limit is reached,
ToolTalk client applications (and indeed any command action) can
fail, sometimes without any error message.
1222870
SOLUTION SUMMARY:
Top
Sun Proprietary/Confidential: Internal Use Only
Feedback to SunSolve Team