mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-23 05:35:53 -04:00
Implements ipc protocol for retrieving current count of masters
This commit is contained in:
parent
a66b248ea9
commit
f3336eae68
3 changed files with 34 additions and 3 deletions
25
mmsg/mmsg.c
25
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)
|
||||
|
|
|
|||
|
|
@ -136,6 +136,13 @@ I would probably just submit raphi's patchset but I don't think that would be po
|
|||
</description>
|
||||
<arg name="layout" type="string" summary="The new layout"/>
|
||||
</event>
|
||||
|
||||
<event name="nmasters" since="1">
|
||||
<description summary="Update the current masters count">
|
||||
Indicates the count of masters has changed.
|
||||
</description>
|
||||
<arg name="nmasters" type="uint" summary="The new masters count"/>
|
||||
</event>
|
||||
|
||||
<event name="frame">
|
||||
<description summary="The update sequence is done.">
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue