mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-23 05:35:53 -04:00
Merge df1d622649 into 17ff2ade07
This commit is contained in:
commit
86798f5c21
6 changed files with 146 additions and 8 deletions
47
mmsg/mmsg.c
47
mmsg/mmsg.c
|
|
@ -35,6 +35,8 @@ static int32_t cflag;
|
|||
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;
|
||||
|
|
@ -177,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) {
|
||||
|
|
@ -310,6 +322,17 @@ static void dwl_ipc_output_floating(void *data,
|
|||
printf("floating %u\n", is_floating);
|
||||
}
|
||||
|
||||
static void dwl_ipc_output_master(void *data,
|
||||
struct zdwl_ipc_output_v2 *dwl_ipc_output,
|
||||
uint32_t is_master) {
|
||||
if (!Mflag)
|
||||
return;
|
||||
char *output_name = data;
|
||||
if (output_name)
|
||||
printf("%s ", output_name);
|
||||
printf("master: %u\n", is_master);
|
||||
}
|
||||
|
||||
static void dwl_ipc_output_frame(void *data,
|
||||
struct zdwl_ipc_output_v2 *dwl_ipc_output) {
|
||||
if (mode & SET) {
|
||||
|
|
@ -419,6 +442,8 @@ static const struct zdwl_ipc_output_v2_listener dwl_ipc_output_listener = {
|
|||
.layout_symbol = dwl_ipc_output_layout_symbol,
|
||||
.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,
|
||||
|
|
@ -529,6 +554,8 @@ static void usage(void) {
|
|||
"\t-v Get visibility of statusbar\n"
|
||||
"\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"
|
||||
|
|
@ -758,6 +785,18 @@ int32_t main(int32_t argc, char *argv[]) {
|
|||
usage();
|
||||
mode |= GET;
|
||||
break;
|
||||
case 'M':
|
||||
Mflag = 1;
|
||||
if (mode == SET)
|
||||
usage();
|
||||
mode |= GET;
|
||||
break;
|
||||
case 'n':
|
||||
nflag = 1;
|
||||
if (mode == SET)
|
||||
usage();
|
||||
mode |= GET;
|
||||
break;
|
||||
case 'x':
|
||||
xflag = 1;
|
||||
if (mode == SET)
|
||||
|
|
@ -796,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 ||
|
||||
vflag || mflag || fflag || xflag || eflag || kflag || bflag ||
|
||||
!(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 = 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.">
|
||||
|
|
@ -190,7 +197,14 @@ I would probably just submit raphi's patchset but I don't think that would be po
|
|||
Indicates if the selected client on this output is floating.
|
||||
</description>
|
||||
<arg name="is_floating" type="uint" summary="If the selected client is floating. Nonzero is valid, zero invalid"/>
|
||||
</event>
|
||||
</event>
|
||||
|
||||
<event name="master" since="2">
|
||||
<description summary="Update the floating status">
|
||||
Indicates if the selected client on this output is master.
|
||||
</description>
|
||||
<arg name="is_master" type="uint" summary="If the selected client is master. Nonzero is valid, zero invalid"/>
|
||||
</event>
|
||||
|
||||
<event name="x" since="2">
|
||||
<description summary="Update the x coordinates">
|
||||
|
|
|
|||
|
|
@ -938,7 +938,10 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
if (strcmp(func_name, "focusstack") == 0) {
|
||||
func = focusstack;
|
||||
(*arg).i = parse_circle_direction(arg_value);
|
||||
} else if (strcmp(func_name, "focusdir") == 0) {
|
||||
} else if (strcmp(func_name, "focusstack_bounded") == 0) {
|
||||
func = focusstack_bounded;
|
||||
(*arg).i = parse_circle_direction(arg_value);
|
||||
} else if (strcmp(func_name, "focusdir") == 0) {
|
||||
func = focusdir;
|
||||
(*arg).i = parse_direction(arg_value);
|
||||
} else if (strcmp(func_name, "incnmaster") == 0) {
|
||||
|
|
@ -955,7 +958,10 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
} else if (strcmp(func_name, "exchange_stack_client") == 0) {
|
||||
func = exchange_stack_client;
|
||||
(*arg).i = parse_circle_direction(arg_value);
|
||||
} else if (strcmp(func_name, "toggleglobal") == 0) {
|
||||
} else if (strcmp(func_name, "exchange_stack_client_bounded") == 0) {
|
||||
func = exchange_stack_client_bounded;
|
||||
(*arg).i = parse_circle_direction(arg_value);
|
||||
} else if (strcmp(func_name, "toggleglobal") == 0) {
|
||||
func = toggleglobal;
|
||||
} else if (strcmp(func_name, "toggleoverview") == 0) {
|
||||
func = toggleoverview;
|
||||
|
|
@ -983,7 +989,10 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
(*arg).i = atoi(arg_value);
|
||||
} else if (strcmp(func_name, "killclient") == 0) {
|
||||
func = killclient;
|
||||
} else if (strcmp(func_name, "centerwin") == 0) {
|
||||
} else if (strcmp(func_name, "killclient_byappid") == 0) {
|
||||
func = killclient_byappid;
|
||||
(*arg).v = strdup(arg_value);
|
||||
} else if (strcmp(func_name, "centerwin") == 0) {
|
||||
func = centerwin;
|
||||
} else if (strcmp(func_name, "focuslast") == 0) {
|
||||
func = focuslast;
|
||||
|
|
|
|||
|
|
@ -32,11 +32,14 @@ int32_t quit(const Arg *arg);
|
|||
int32_t moveresize(const Arg *arg);
|
||||
int32_t exchange_client(const Arg *arg);
|
||||
int32_t exchange_stack_client(const Arg *arg);
|
||||
int32_t exchange_stack_client_bounded(const Arg *arg);
|
||||
int32_t killclient(const Arg *arg);
|
||||
int32_t killclient_byappid(const Arg *arg);
|
||||
int32_t toggleglobal(const Arg *arg);
|
||||
int32_t incnmaster(const Arg *arg);
|
||||
int32_t focusmon(const Arg *arg);
|
||||
int32_t focusstack(const Arg *arg);
|
||||
int32_t focusstack_bounded(const Arg *arg);
|
||||
int32_t chvt(const Arg *arg);
|
||||
int32_t reload_config(const Arg *arg);
|
||||
int32_t smartmovewin(const Arg *arg);
|
||||
|
|
|
|||
|
|
@ -134,6 +134,27 @@ int32_t exchange_stack_client(const Arg *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t exchange_stack_client_bounded(const Arg *arg) {
|
||||
if (!selmon)
|
||||
return 0;
|
||||
|
||||
Client *c = selmon->sel;
|
||||
Client *tc = NULL;
|
||||
if (!c || c->isfloating || c->isfullscreen || c->ismaximizescreen)
|
||||
return 0;
|
||||
/* again, lazy we just search once more if we found master */
|
||||
if (arg->i == NEXT) {
|
||||
tc = get_next_stack_client(c, false);
|
||||
while (tc && tc != c && tc->ismaster) tc = get_next_stack_client(tc, false);
|
||||
} else {
|
||||
tc = get_next_stack_client(c, true);
|
||||
while (tc && tc != c && tc->ismaster) tc = get_next_stack_client(tc, true);
|
||||
}
|
||||
if (tc)
|
||||
exchange_two_client(c, tc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t focusdir(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
c = direction_select(arg);
|
||||
|
|
@ -263,6 +284,33 @@ int32_t focusstack(const Arg *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t focusstack_bounded(const Arg *arg) {
|
||||
/* Focus the next or previous client (in tiling order) on selmon */
|
||||
/* but skipping past master */
|
||||
Client *sel = focustop(selmon);
|
||||
Client *tc = NULL;
|
||||
|
||||
if (!sel)
|
||||
return 0;
|
||||
/* lazy fix we just search twice, don't make new deeper functions */
|
||||
if (arg->i == NEXT) {
|
||||
tc = get_next_stack_client(sel, false);
|
||||
while (tc && tc != sel && tc->ismaster) tc = get_next_stack_client(tc, false);
|
||||
} else {
|
||||
tc = get_next_stack_client(sel, true);
|
||||
while (tc && tc != sel && tc->ismaster) tc = get_next_stack_client(tc, true);
|
||||
}
|
||||
/* If only one client is visible on selmon, then c == sel */
|
||||
|
||||
if (!tc)
|
||||
return 0;
|
||||
|
||||
focusclient(tc, 1);
|
||||
if (config.warpcursor)
|
||||
warp_cursor(tc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t incnmaster(const Arg *arg) {
|
||||
if (!arg || !selmon)
|
||||
return 0;
|
||||
|
|
@ -361,6 +409,21 @@ int32_t killclient(const Arg *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t killclient_byappid(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
/* No Arg? No Kill. */
|
||||
if (!arg || !arg->v)
|
||||
return 0;
|
||||
/* for some reason its warning me about this indent? */
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (strcmp((*arg).v, client_get_appid(c)) == 0) {
|
||||
pending_kill_client(c);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t moveresize(const Arg *arg) {
|
||||
const char *cursors[] = {"nw-resize", "ne-resize", "sw-resize",
|
||||
"se-resize"};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -169,6 +174,11 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
|
|||
zdwl_ipc_output_v2_send_floating(ipc_output->resource,
|
||||
focused ? focused->isfloating : 0);
|
||||
}
|
||||
if (wl_resource_get_version(ipc_output->resource) >=
|
||||
ZDWL_IPC_OUTPUT_V2_MASTER_SINCE_VERSION) {
|
||||
zdwl_ipc_output_v2_send_master(ipc_output->resource,
|
||||
focused ? focused->ismaster : 0);
|
||||
}
|
||||
if (wl_resource_get_version(ipc_output->resource) >=
|
||||
ZDWL_IPC_OUTPUT_V2_X_SINCE_VERSION) {
|
||||
zdwl_ipc_output_v2_send_x(ipc_output->resource,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue