mirror of
https://github.com/vale981/bspwm
synced 2025-03-05 09:51:38 -05:00
Options to skip same or different class in "cycle"
Two options have been added to the "cycle" message: --skip-class-equal and --skip-class-differ. The class name of the client is now shown in the output of the "dump" command instead of the letter "C".
This commit is contained in:
parent
2ac2ea6fb6
commit
80ca33c3cd
5 changed files with 23 additions and 3 deletions
7
events.c
7
events.c
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
#include <xcb/xcb_event.h>
|
||||
|
@ -72,6 +73,12 @@ void map_request(xcb_generic_event_t *evt)
|
|||
|
||||
handle_rules(win, &floating, &transient, &fullscreen, &takes_focus);
|
||||
|
||||
xcb_icccm_get_wm_class_reply_t reply;
|
||||
if (xcb_icccm_get_wm_class_reply(dpy, xcb_icccm_get_wm_class(dpy, win), &reply, NULL) == 1) {
|
||||
strcpy(c->class_name, reply.class_name);
|
||||
xcb_icccm_get_wm_class_reply_wipe(&reply);
|
||||
}
|
||||
|
||||
if (c->transient)
|
||||
floating = true;
|
||||
|
||||
|
|
|
@ -382,6 +382,12 @@ bool parse_skip_client(char *s, skip_client_t *k)
|
|||
} else if (strcmp(s, "--skip-tiled") == 0) {
|
||||
*k = SKIP_TILED;
|
||||
return true;
|
||||
} else if (strcmp(s, "--skip-class-equal") == 0) {
|
||||
*k = SKIP_CLASS_EQUAL;
|
||||
return true;
|
||||
} else if (strcmp(s, "--skip-class-differ") == 0) {
|
||||
*k = SKIP_CLASS_DIFFER;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
6
tree.c
6
tree.c
|
@ -178,7 +178,7 @@ void dump_tree(desktop_t *d, node_t *n, char *rsp, int depth)
|
|||
strcat(rsp, " ");
|
||||
|
||||
if (is_leaf(n))
|
||||
sprintf(line, "C %X %s%s%s%s%s", n->client->window, (n->client->floating ? "f" : "-"), (n->client->transient ? "t" : "-"), (n->client->fullscreen ? "F" : "-"), (n->client->urgent ? "u" : "-"), (n->client->locked ? "l" : "-"));
|
||||
sprintf(line, "%s %X %s%s%s%s%s", n->client->class_name, n->client->window, (n->client->floating ? "f" : "-"), (n->client->transient ? "t" : "-"), (n->client->fullscreen ? "F" : "-"), (n->client->urgent ? "u" : "-"), (n->client->locked ? "l" : "-"));
|
||||
else
|
||||
sprintf(line, "%s %.2f", (n->split_type == TYPE_HORIZONTAL ? "H" : "V"), n->split_ratio);
|
||||
|
||||
|
@ -582,7 +582,9 @@ void cycle_leaf(desktop_t *d, node_t *n, cycle_dir_t dir, skip_client_t skip)
|
|||
|
||||
while (f != n) {
|
||||
bool tiled = is_tiled(f->client);
|
||||
if (skip == SKIP_NONE || (skip == SKIP_TILED && !tiled) || (skip == SKIP_FLOATING && tiled)) {
|
||||
if (skip == SKIP_NONE || (skip == SKIP_TILED && !tiled) || (skip == SKIP_FLOATING && tiled)
|
||||
|| (skip == SKIP_CLASS_DIFFER && strcmp(f->client->class_name, n->client->class_name) == 0)
|
||||
|| (skip == SKIP_CLASS_EQUAL && strcmp(f->client->class_name, n->client->class_name) != 0)) {
|
||||
focus_node(d, f, true);
|
||||
return;
|
||||
}
|
||||
|
|
1
types.c
1
types.c
|
@ -28,6 +28,7 @@ desktop_t *make_desktop(const char *name)
|
|||
client_t *make_client(xcb_window_t win)
|
||||
{
|
||||
client_t *c = malloc(sizeof(client_t));
|
||||
strcpy(c->class_name, MISSING_VALUE);
|
||||
c->window = win;
|
||||
c->floating = c->transient = c->fullscreen = c->locked = c->urgent = false;
|
||||
return c;
|
||||
|
|
6
types.h
6
types.h
|
@ -7,6 +7,7 @@
|
|||
|
||||
#define SPLIT_RATIO 0.5
|
||||
#define DEFAULT_DESK_NAME "One"
|
||||
#define MISSING_VALUE "N/A"
|
||||
|
||||
typedef enum {
|
||||
TYPE_HORIZONTAL,
|
||||
|
@ -36,7 +37,9 @@ typedef enum {
|
|||
typedef enum {
|
||||
SKIP_NONE,
|
||||
SKIP_FLOATING,
|
||||
SKIP_TILED
|
||||
SKIP_TILED,
|
||||
SKIP_CLASS_EQUAL,
|
||||
SKIP_CLASS_DIFFER
|
||||
} skip_client_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -66,6 +69,7 @@ typedef enum {
|
|||
|
||||
typedef struct {
|
||||
xcb_window_t window;
|
||||
char class_name[MAXLEN];
|
||||
bool floating;
|
||||
bool transient; /* transient window are always floating */
|
||||
bool fullscreen;
|
||||
|
|
Loading…
Add table
Reference in a new issue