xshove: document, tweak
This commit is contained in:
parent
f73497bbaf
commit
ad8d54238b
2 changed files with 77 additions and 14 deletions
|
|
@ -29,6 +29,12 @@ rio \- rio-like Window Manager for X
|
||||||
|
|
|
|
||||||
.B restart
|
.B restart
|
||||||
]
|
]
|
||||||
|
.PP
|
||||||
|
.B xshove
|
||||||
|
[
|
||||||
|
.I name
|
||||||
|
.I rectangle
|
||||||
|
]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.if t .ds 85 8\(12
|
.if t .ds 85 8\(12
|
||||||
.if n .ds 85 8-1/2
|
.if n .ds 85 8-1/2
|
||||||
|
|
@ -187,6 +193,34 @@ option,
|
||||||
clicking button 2 brings up a menu to select a virtual screen to view.
|
clicking button 2 brings up a menu to select a virtual screen to view.
|
||||||
Scrolling the mouse wheel while the cursor points at the background
|
Scrolling the mouse wheel while the cursor points at the background
|
||||||
will cycle through the virtual screens.
|
will cycle through the virtual screens.
|
||||||
|
.PP
|
||||||
|
.I Xshove
|
||||||
|
moves or resizes every window whose X11 class or instance strings contain
|
||||||
|
.IR name .
|
||||||
|
The
|
||||||
|
.I rectangle
|
||||||
|
argument can be
|
||||||
|
\fIwidth\^\^\fLx\fI\^\^height\fR,
|
||||||
|
\fIwidth\^\^\fLx\fI\^\^height\^\^\fL@\fI\^\^xmin\fL,\fIxmax\fR,
|
||||||
|
\fL'\fIxmin ymin xmax ymax\fL'\fR,
|
||||||
|
\fRor
|
||||||
|
\fIxmin\fL,\fIymin\fL,\fIxmax\fL,\fIymax\fR.
|
||||||
|
A leading
|
||||||
|
.B +
|
||||||
|
or
|
||||||
|
.B -
|
||||||
|
causes the rectangle to be interpreted as a delta:
|
||||||
|
.L +10,0
|
||||||
|
nudges a window to the right, while
|
||||||
|
.L +100x100
|
||||||
|
grows a window.
|
||||||
|
With no arguments,
|
||||||
|
.I xshove
|
||||||
|
lists all the current X windows.
|
||||||
|
.I Xshove
|
||||||
|
is not specific to
|
||||||
|
.I rio
|
||||||
|
and can be used with other window managers.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
In
|
In
|
||||||
Plan 9's
|
Plan 9's
|
||||||
|
|
|
||||||
|
|
@ -41,16 +41,13 @@ int nw;
|
||||||
|
|
||||||
void getinfo(void);
|
void getinfo(void);
|
||||||
void listwindows(void);
|
void listwindows(void);
|
||||||
int parsewinsize(char*, Rectangle*, int*);
|
int parsewinsize(char*, Rectangle*, int*, int*, int*);
|
||||||
void shove(char*, char*);
|
void shove(char*, char*);
|
||||||
|
|
||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: xshove window rectangle\n"
|
fprint(2, "usage: xshove [window rectangle]\n");
|
||||||
" or xshove\n"
|
|
||||||
"window can be a window ID or a program name\n"
|
|
||||||
"rectangle is a p9p window spec (see intro(1))\n");
|
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,12 +180,19 @@ void
|
||||||
shove(char *name, char *geom)
|
shove(char *name, char *geom)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int havemin;
|
int isdelta, havemin, havesize;
|
||||||
|
int old, new;
|
||||||
Rectangle r;
|
Rectangle r;
|
||||||
|
|
||||||
if(parsewinsize(geom, &r, &havemin) < 0)
|
if(parsewinsize(geom, &r, &isdelta, &havemin, &havesize) < 0)
|
||||||
sysfatal("bad window spec: %s", name);
|
sysfatal("bad window spec: %s", name);
|
||||||
|
|
||||||
|
old = 0;
|
||||||
|
new = 1;
|
||||||
|
if(isdelta){
|
||||||
|
old = 1;
|
||||||
|
new = isdelta;
|
||||||
|
}
|
||||||
for(i=0; i<nw; i++){
|
for(i=0; i<nw; i++){
|
||||||
Win *ww = &w[i];
|
Win *ww = &w[i];
|
||||||
if(ww->instance && strstr(ww->instance, name)
|
if(ww->instance && strstr(ww->instance, name)
|
||||||
|
|
@ -197,14 +201,21 @@ shove(char *name, char *geom)
|
||||||
XWindowChanges e;
|
XWindowChanges e;
|
||||||
|
|
||||||
memset(&e, 0, sizeof e);
|
memset(&e, 0, sizeof e);
|
||||||
e.width = Dx(r);
|
|
||||||
e.height = Dy(r);
|
|
||||||
value_mask = CWWidth | CWHeight;
|
|
||||||
if(havemin){
|
if(havemin){
|
||||||
e.x = r.min.x;
|
e.x = old*ww->x + new*r.min.x;
|
||||||
e.y = r.min.y;
|
e.y = old*ww->y + new*r.min.y;
|
||||||
value_mask |= CWX | CWY;
|
}else{
|
||||||
|
e.x = ww->x;
|
||||||
|
e.y = ww->y;
|
||||||
}
|
}
|
||||||
|
if(havesize){
|
||||||
|
e.width = old*ww->dx + new*Dx(r);
|
||||||
|
e.height = old*ww->dy + new*Dy(r);
|
||||||
|
}else{
|
||||||
|
e.width = ww->dx;
|
||||||
|
e.height = ww->dy;
|
||||||
|
}
|
||||||
|
value_mask = CWX | CWY | CWWidth | CWHeight;
|
||||||
XConfigureWindow(dpy, ww->xw, value_mask, &e);
|
XConfigureWindow(dpy, ww->xw, value_mask, &e);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
}
|
}
|
||||||
|
|
@ -212,13 +223,22 @@ shove(char *name, char *geom)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
parsewinsize(char *s, Rectangle *r, int *havemin)
|
parsewinsize(char *s, Rectangle *r, int *isdelta, int *havemin, int *havesize)
|
||||||
{
|
{
|
||||||
char c, *os;
|
char c, *os;
|
||||||
int i, j, k, l;
|
int i, j, k, l;
|
||||||
|
|
||||||
os = s;
|
os = s;
|
||||||
|
if(*s == '-'){
|
||||||
|
s++;
|
||||||
|
*isdelta = -1;
|
||||||
|
}else if(*s == '+'){
|
||||||
|
s++;
|
||||||
|
*isdelta = 1;
|
||||||
|
}else
|
||||||
|
*isdelta = 0;
|
||||||
*havemin = 0;
|
*havemin = 0;
|
||||||
|
*havesize = 0;
|
||||||
memset(r, 0, sizeof *r);
|
memset(r, 0, sizeof *r);
|
||||||
if(!isdigit((uchar)*s))
|
if(!isdigit((uchar)*s))
|
||||||
goto oops;
|
goto oops;
|
||||||
|
|
@ -230,6 +250,7 @@ parsewinsize(char *s, Rectangle *r, int *havemin)
|
||||||
j = strtol(s, &s, 0);
|
j = strtol(s, &s, 0);
|
||||||
r->max.x = i;
|
r->max.x = i;
|
||||||
r->max.y = j;
|
r->max.y = j;
|
||||||
|
*havesize = 1;
|
||||||
if(*s == 0)
|
if(*s == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if(*s != '@')
|
if(*s != '@')
|
||||||
|
|
@ -251,6 +272,7 @@ parsewinsize(char *s, Rectangle *r, int *havemin)
|
||||||
r->max.x += i;
|
r->max.x += i;
|
||||||
r->min.y += j;
|
r->min.y += j;
|
||||||
r->max.y += j;
|
r->max.y += j;
|
||||||
|
*havesize = 1;
|
||||||
*havemin = 1;
|
*havemin = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -262,6 +284,12 @@ parsewinsize(char *s, Rectangle *r, int *havemin)
|
||||||
if(!isdigit((uchar)*s))
|
if(!isdigit((uchar)*s))
|
||||||
goto oops;
|
goto oops;
|
||||||
j = strtol(s, &s, 0);
|
j = strtol(s, &s, 0);
|
||||||
|
if(*s == 0){
|
||||||
|
r->min.x = i;
|
||||||
|
r->min.y = j;
|
||||||
|
*havemin = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if(*s != c)
|
if(*s != c)
|
||||||
goto oops;
|
goto oops;
|
||||||
s++;
|
s++;
|
||||||
|
|
@ -281,6 +309,7 @@ parsewinsize(char *s, Rectangle *r, int *havemin)
|
||||||
r->max.x = k;
|
r->max.x = k;
|
||||||
r->max.y = l;
|
r->max.y = l;
|
||||||
*havemin = 1;
|
*havemin = 1;
|
||||||
|
*havesize = 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
oops:
|
oops:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue