diff --git a/mmsg/mmsg.c b/mmsg/mmsg.c
index 2ad9d074..b20e45c4 100644
--- a/mmsg/mmsg.c
+++ b/mmsg/mmsg.c
@@ -36,6 +36,7 @@ static int32_t vflag;
static int32_t mflag;
static int32_t fflag;
static int32_t Mflag;
+static int32_t nflag;
static int32_t qflag;
static int32_t dflag;
static int32_t xflag;
@@ -178,6 +179,16 @@ static void dwl_ipc_output_layout_symbol(
printf("layout %s\n", layout);
}
+static void dwl_ipc_output_nmasters(
+ void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output, uint32_t count) {
+ if (!(nflag && mode & GET))
+ return;
+ char *output_name = data;
+ if (output_name)
+ printf("%s ", output_name);
+ printf("nmasters %d\n", count);
+}
+
static void dwl_ipc_output_title(void *data,
struct zdwl_ipc_output_v2 *dwl_ipc_output,
const char *title) {
@@ -432,6 +443,7 @@ static const struct zdwl_ipc_output_v2_listener dwl_ipc_output_listener = {
.fullscreen = dwl_ipc_output_fullscreen,
.floating = dwl_ipc_output_floating,
.master = dwl_ipc_output_master,
+ .nmasters = dwl_ipc_output_nmasters,
.x = dwl_ipc_output_x,
.y = dwl_ipc_output_y,
.width = dwl_ipc_output_width,
@@ -543,6 +555,7 @@ static void usage(void) {
"\t-m Get fullscreen status\n"
"\t-f Get floating status\n"
"\t-M Get master status\n"
+ "\t-n Get current masters count\n"
"\t-x Get focused client geometry\n"
"\t-e Get name of last focused layer\n"
"\t-k Get current keyboard layout\n"
@@ -778,6 +791,12 @@ int32_t main(int32_t argc, char *argv[]) {
usage();
mode |= GET;
break;
+ case 'n':
+ nflag = 1;
+ if (mode == SET)
+ usage();
+ mode |= GET;
+ break;
case 'x':
xflag = 1;
if (mode == SET)
@@ -816,11 +835,11 @@ int32_t main(int32_t argc, char *argv[]) {
if (mode == NONE)
usage();
if (mode & GET && !output_name &&
- !(oflag || tflag || lflag || Oflag || Tflag || Lflag || cflag ||
+ !(oflag || tflag || lflag || Oflag || nflag || Tflag || Lflag || cflag ||
vflag || mflag || fflag || Mflag || xflag || eflag || kflag || bflag ||
Aflag || dflag))
- oflag = tflag = lflag = cflag = vflag = mflag = fflag = Mflag = xflag = eflag =
- kflag = bflag = Aflag = 1;
+ oflag = tflag = lflag = cflag = vflag = mflag =
+ nflag = fflag = Mflag = xflag = eflag = kflag = bflag = Aflag = 1;
display = wl_display_connect(NULL);
if (!display)
diff --git a/protocols/dwl-ipc-unstable-v2.xml b/protocols/dwl-ipc-unstable-v2.xml
index 608981f7..41b88153 100644
--- a/protocols/dwl-ipc-unstable-v2.xml
+++ b/protocols/dwl-ipc-unstable-v2.xml
@@ -136,6 +136,13 @@ I would probably just submit raphi's patchset but I don't think that would be po
+
+
+
+ Indicates the count of masters has changed.
+
+
+
diff --git a/src/ext-protocol/dwl-ipc.h b/src/ext-protocol/dwl-ipc.h
index 22cd1fda..4f7bfa26 100644
--- a/src/ext-protocol/dwl-ipc.h
+++ b/src/ext-protocol/dwl-ipc.h
@@ -114,6 +114,7 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
xkb_layout_index_t current;
int32_t tagmask, state, numclients, focused_client, tag;
const char *title, *appid, *symbol;
+ uint32_t nmasters;
char kb_layout[32];
focused = focustop(monitor);
zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon);
@@ -143,8 +144,10 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
if (monitor->isoverview) {
symbol = overviewlayout.symbol;
+ nmasters = 0;
} else {
symbol = monitor->pertag->ltidxs[monitor->pertag->curtag]->symbol;
+ nmasters = monitor->pertag->nmasters[monitor->pertag->curtag];
}
keyboard = &kb_group->wlr_group->keyboard;
@@ -159,6 +162,8 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
zdwl_ipc_output_v2_send_title(ipc_output->resource, title ? title : broken);
zdwl_ipc_output_v2_send_appid(ipc_output->resource, appid ? appid : broken);
zdwl_ipc_output_v2_send_layout_symbol(ipc_output->resource, symbol);
+ zdwl_ipc_output_v2_send_nmasters(ipc_output->resource, nmasters);
+
if (wl_resource_get_version(ipc_output->resource) >=
ZDWL_IPC_OUTPUT_V2_FULLSCREEN_SINCE_VERSION) {
zdwl_ipc_output_v2_send_fullscreen(ipc_output->resource,