On Sun, Oct 27, 2002 at 02:31:47AM -0500
"Forest C. Adcock" <[EMAIL PROTECTED]> wrote:
> is there a command to switch workspaces from the commant line for Blackbox?
I wrote a simple program to do this for me.
See attachment.
Compile it using:
g++ bbchdsktp.cc -L/usr/X11R6/lib -lX11 -o bbchdsktp
strip bbchdsktp
--
Gerrit Hoetzel
http://www.hzhome.mine.nu
//
// Change Workspace (blackbox)
// Parameter: No. (0-based)
//
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
void switchDesktop(const int& i){
Display* display;
display = XOpenDisplay(NULL);
if (display == NULL){
fprintf (stderr, "Can't open X display.");
exit(1);
}
//Window rootWindow = RootWindow(display, 0); // TODO: 0=ScreenNumber !!!
Window rootWindow=DefaultRootWindow(display);
XEvent e;
e.xclient.type=ClientMessage;
e.xclient.window=rootWindow;
e.xclient.message_type = XInternAtom(display, "_BLACKBOX_CHANGE_WORKSPACE", False);
e.xclient.format =32;
e.xclient.data.l[0]= static_cast<unsigned long int>(i);
e.xclient.data.l[1]=0;
Status q=XSendEvent(display, rootWindow, False, SubstructureRedirectMask, &e);
XCloseDisplay(display);
}
int main (int argc, char* argv[]) {
if (argc < 2) {
fprintf (stderr, "bbchdsktp [Workspace-No.]\n"
"Workspace-No. is zero-based.\n");
exit(1);
}
switchDesktop(atoi(argv[1]));
return 0;
}
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
List archives: http://asgardsrealm.net/lurker/splash/index.html
Trouble? Contact [EMAIL PROTECTED]