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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue