mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
* refs/heads/master: Original idea from Dimitris Papastamos to move windows to corners a while ago; re-proposed by Julien Steinhauser with an updated diff. Apparently this was in the original calmnwm. give command and group menus their own match callbacks stash dir into conf since it'll be of use organize this a bit better spacing
This commit is contained in:
50
kbfunc.c
50
kbfunc.c
@ -289,6 +289,42 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
|
||||
client_ptr_inbound(cc, 0);
|
||||
}
|
||||
|
||||
void
|
||||
kbfunc_client_snap(void *ctx, struct cargs *cargs)
|
||||
{
|
||||
struct client_ctx *cc = ctx;
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
struct geom area;
|
||||
int flags;
|
||||
|
||||
area = screen_area(sc,
|
||||
cc->geom.x + cc->geom.w / 2,
|
||||
cc->geom.y + cc->geom.h / 2, CWM_GAP);
|
||||
|
||||
flags = cargs->flag;
|
||||
while (flags) {
|
||||
if (flags & CWM_UP) {
|
||||
cc->geom.y = area.y;
|
||||
flags &= ~CWM_UP;
|
||||
}
|
||||
if (flags & CWM_LEFT) {
|
||||
cc->geom.x = area.x;
|
||||
flags &= ~CWM_LEFT;
|
||||
}
|
||||
if (flags & CWM_RIGHT) {
|
||||
cc->geom.x = area.x + area.w - cc->geom.w -
|
||||
(cc->bwidth * 2);
|
||||
flags &= ~CWM_RIGHT;
|
||||
}
|
||||
if (flags & CWM_DOWN) {
|
||||
cc->geom.y = area.y + area.h - cc->geom.h -
|
||||
(cc->bwidth * 2);
|
||||
flags &= ~CWM_DOWN;
|
||||
}
|
||||
}
|
||||
client_move(cc);
|
||||
}
|
||||
|
||||
void
|
||||
kbfunc_client_delete(void *ctx, struct cargs *cargs)
|
||||
{
|
||||
@ -463,14 +499,13 @@ kbfunc_menu_cmd(void *ctx, struct cargs *cargs)
|
||||
if ((strcmp(cmd->name, "lock") == 0) ||
|
||||
(strcmp(cmd->name, "term") == 0))
|
||||
continue;
|
||||
/* search_match_text() needs mi->text */
|
||||
menuq_add(&menuq, cmd, "%s", cmd->name);
|
||||
menuq_add(&menuq, cmd, NULL);
|
||||
}
|
||||
|
||||
if ((mi = menu_filter(sc, &menuq,
|
||||
(m) ? NULL : "application", NULL,
|
||||
((m) ? CWM_MENU_LIST : 0),
|
||||
search_match_text, search_print_cmd)) != NULL) {
|
||||
search_match_cmd, search_print_cmd)) != NULL) {
|
||||
cmd = (struct cmd_ctx *)mi->ctx;
|
||||
u_spawn(cmd->path);
|
||||
}
|
||||
@ -491,12 +526,12 @@ kbfunc_menu_group(void *ctx, struct cargs *cargs)
|
||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||
if (group_holds_only_sticky(gc))
|
||||
continue;
|
||||
menuq_add(&menuq, gc, "%d %s", gc->num, gc->name);
|
||||
menuq_add(&menuq, gc, NULL);
|
||||
}
|
||||
|
||||
if ((mi = menu_filter(sc, &menuq,
|
||||
(m) ? NULL : "group", NULL, (CWM_MENU_LIST),
|
||||
search_match_text, search_print_group)) != NULL) {
|
||||
search_match_group, search_print_group)) != NULL) {
|
||||
gc = (struct group_ctx *)mi->ctx;
|
||||
(group_holds_only_hidden(gc)) ?
|
||||
group_show(gc) : group_hide(gc);
|
||||
@ -631,9 +666,8 @@ kbfunc_menu_ssh(void *ctx, struct cargs *cargs)
|
||||
/* skip hashed hosts */
|
||||
if (strncmp(buf, HASH_MARKER, strlen(HASH_MARKER)) == 0)
|
||||
continue;
|
||||
for (p = buf; *p != ',' && *p != ' ' && p != buf + slen; p++) {
|
||||
/* do nothing */
|
||||
}
|
||||
for (p = buf; *p != ',' && *p != ' ' && p != buf + slen; p++)
|
||||
;
|
||||
/* ignore badness */
|
||||
if (p - buf + 1 > sizeof(hostbuf))
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user