Re: feature request, workspaces
Ralf Butenuth <[email protected]> Sun, 26 Feb 2006 12:14:16 +0100
| Newsgroups | gmane.compw.window-managers.windowmaker.user |
|---|---|
| Message-ID | <[email protected]> |
--===============8175108746601354145==
Content-Type: multipart/signed; boundary="nextPart6134915.YaLohVva4c";
protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
--nextPart6134915.YaLohVva4c
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
On Saturday 25 February 2006 22:44, cga wrote:
> Charles Philip Chan wrote:
> One convenient way to simulate to some extent what the OP requested -
> two-dimension switching - is to define twenty workspaces, eg. and bind
> convenient keys to "Switch to next/previous ten workspaces". You thus
thanks for the answers. Yes, I was aware of that option, and I allready wor=
ked=20
with that arrangement. But I think It would be nicer to have something like=
a=20
3x3 or 4x4 grid, or a grid to a costumable size.=20
To do this I need to have something like an "switch to the next 4=20
workspace"-option, or a program witch tells windowmaker to switch the=20
workspaces so I can set keybindings to it.=20
So I need to figure out how you can tell windowmaker to switch to a certain=
=20
workspace in a little c-program. =20
I looked at the wmpager source, and I think he did it by sending an XEvent=
=20
(see code snippet 1 down). I am not that familiar with XEvents, but I tried=
=20
to use this method to write my one program, to beginn with it should only=20
jump to the first workspace. (see code snippet 2). It compiles, runs, and=20
does nothing (well, it sends an XEvent wich is ignored). =20
So, if anyone has suggestions on either how to fix my program to do wath I=
=20
want or knows another methode to switch workspaces via a c-programm, I woul=
d=20
be happy for suggestions.=20
If not than thanks for the answers so far, and I will keep on using a 2x10=
=20
grid via the method kindly described by Charles.
/** code snippet 1 **/
void gotoScreen (int nWorkspace) {
XEvent event;
event.type=3D ClientMessage;
event.xclient.type=3D ClientMessage;
event.xclient.window=3D getRootWindow();
event.xclient.message_type=3D _xaWinWorkspace;
event.xclient.format=3D 32;
event.xclient.data.l[0]=3D nWorkspace;
event.xclient.data.l[1]=3D currentTimeMillis();
XSendEvent(getDisplay(), getRootWindow(), False,=20
SubstructureNotifyMask, (XEvent*) &event);
}
/** code snippet 2 **/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define XA_WIN_WORKSPACE "_WIN_WORKSPACE"
#define XA_WIN_WORKSPACE_NAMES "_WIN_WORKSPACE_NAMES"
static Atom _xaWinWorkspace;
static Atom _xaWinWorkspaceNames;
static Display* _display;
static int _nDefaultScreen;
static Window _wRoot;
static XEvent event;
long currentTumeMillis();
static struct timeval _tStart;
Display* getDisplay() {
return _display;
}
void initTime () {
gettimeofday(&_tStart, NULL);
}
long currentTimeMillis () {
struct timeval tNow;
struct timeval tElapsed;
gettimeofday(&tNow, NULL);
if (_tStart.tv_usec > tNow.tv_usec) {
tNow.tv_usec+=3D 1000000;
tNow.tv_sec--;
}
tElapsed.tv_sec=3D tNow.tv_sec - _tStart.tv_sec;
tElapsed.tv_usec=3D tNow.tv_usec - _tStart.tv_usec;
return (tElapsed.tv_sec * 1000) + (tElapsed.tv_usec / 1000);
}
int main () {
_display=3DXOpenDisplay(":0.0");
_nDefaultScreen=3D DefaultScreen(_display);
_wRoot=3D RootWindow(_display, _nDefaultScreen);
_xaWinWorkspaceNames=3D XInternAtom(getDisplay(), XA_WIN_WORKSPACE_NAMES,=
=20
=46alse);
event.xclient.type=3D ClientMessage;
event.xclient.window=3D _wRoot;
event.xclient.message_type=3D _xaWinWorkspace;
event.xclient.format=3D 32;
event.xclient.data.l[0]=3D 1;
event.xclient.data.l[1]=3D currentTimeMillis();
XSendEvent(_display, _wRoot, False, SubstructureNotifyMask, (XEven=
t*)=20
&event);
return 0;
}
/** code snippet 2 **/
=2D-=20
Ralf Butenuth [email protected]
gpg-key available at hkp://subkeys.pgp.net =20
** 52E9 616C 18F1 DE1E 7200 9AC7 37C8 FA3E 3BD3 AB0A **
--nextPart6134915.YaLohVva4c
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQBEAY2ZN8j6PjvTqwoRApwEAJ4yEGc9l1itdJ2RGjwwNZ+mGMekHQCeMj1m
vcod6dM8pWQeDfe3e9OAljE=
=LwA2
-----END PGP SIGNATURE-----
--nextPart6134915.YaLohVva4c--
--===============8175108746601354145==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
INFO: https://windowmaker.org/lists/listinfo/wm-user
ARCHIVE: https://windowmaker.org/lists/archive/wm-user/
FAQ: http://windowmaker.org/faq.html
--===============8175108746601354145==--