- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: change CDE workspace in a script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2005 06:07 AM
06-14-2005 06:07 AM
HP-UX 11.11 on b2600
TIA
Tom F
HTSI
Greenbelt, MD
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2005 06:33 AM
06-14-2005 06:33 AM
Re: change CDE workspace in a script
Never tried it though.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2005 07:41 PM
06-14-2005 07:41 PM
Re: change CDE workspace in a script
You can savely edit the files from a script using your favorite tools like `sed`, `awk`, `perl` and such. Best to force 'set home session' with those settings since the 'resume current session' will overwrite the settings on exit. My way was to teach myself with reverse engineering: just set or unset the option and see what changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2005 09:46 PM
06-14-2005 09:46 PM
Solution#include
#include
#include
/* functions */
void main(int, char**);
void ws_change(Widget widget, Atom aWorkspace, XtPointer client_data);
/* global variables */
static XmString xms;
static Widget toplevel;
static Widget *wWs;
static Atom *paWsSet = NULL;
static unsigned long numWorkspaces;
static Atom *paWs;
static Display *display;
static Window root;
static int screen;
static Widget top, form, top1;
static XtAppContext app_context;
static Arg args[10];
static int n, i, status, pNumWorkspaces;
static Atom *ppaWorkspaces, foundWsAtom = NULL;
static DtWsmWorkspaceInfo *ppWsInfo;
static DtWsmCBContext wsmcontext;
static char *desiredWs;
/* main - main logic for program */
void main (int argc, char **argv)
{
/* initialize toolkit */
n = 0;
XtSetArg (args[n], XmNallowShellResize, True); n++;
XtSetArg (args[n], XtNmappedWhenManaged, False); n++;
toplevel = XtAppInitialize (&app_context, "Dtswitch", NULL, 0,
&argc, argv, NULL, args, n);
display = XtDisplay(toplevel);
screen = DefaultScreen(display);
root = RootWindow(display, screen);
XSynchronize(display, screen);
if ( argc != 2 )
{
printf("must provide name of a workspace to switch to\n");
printf("we'll just monitor workspace changes now\n");
desiredWs = NULL;
}
else
{
desiredWs = argv[1];
}
status = DtWsmGetWorkspaceList(display, root, &ppaWorkspaces,
&pNumWorkspaces);
if (status != Success )
{
printf("problem obtaining workspace list, exiting with status %d\n",
status);
exit(status);
}
/*
printf("Number of workspaces returned is %d\n", pNumWorkspaces);
*/
for (i=0;i{
status = DtWsmGetWorkspaceInfo(display, root, ppaWorkspaces[i],
&ppWsInfo);
if (status != Success )
{
printf("problem getting workspace info %d\n", status);
}
else
{
printf("Workspace %d , title is %s, name is %s\n",i,
ppWsInfo->pchTitle,
XGetAtomName(display,ppWsInfo->workspace));
if ((desiredWs != NULL) &&
(0 == strcmp(desiredWs, ppWsInfo->pchTitle)))
{
foundWsAtom = ppWsInfo->workspace;
}
}
}
wsmcontext = DtWsmAddCurrentWorkspaceCallback(toplevel, ws_change, NULL);
/*
printf("wsmcontext is %d\n", wsmcontext);
*/
XtRealizeWidget (toplevel);
if (foundWsAtom != None)
{
printf("Atom is %x, name is %s\n",
foundWsAtom,XGetAtomName(display, foundWsAtom));
XFlush(display);
status = DtWsmSetCurrentWorkspace(toplevel, foundWsAtom);
XFlush(display);
printf("status is %d\n",status);
/*
if ( status != Success )
{
printf("workspace %s does not exist\n", desiredWs);
}
*/
}
else
printf("Never found a match - workspace doesn't exist\n");
/*
XtAppMainLoop (app_context);
*/
}
void ws_change(Widget widget, Atom aWorkspace, XtPointer client_data)
{
printf("In the change workspace callback\n");
}
Requires CDE dev kit libs to compile : resulting switch executable usage :
switch Two
nb Uses CDE default naming convention wrt Workspaces ie doesn't cope with customised names for workspaces ... maybe of some use to you ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2005 05:43 AM
06-21-2005 05:43 AM