Add ipc per tag patch

This commit is contained in:
Sravan Balaji
2024-09-22 20:46:18 -04:00
parent a40b099a8e
commit 8c9439a119
2 changed files with 153 additions and 0 deletions

56
dwl.c
View File

@@ -1730,28 +1730,57 @@ void
dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index)
{
DwlIpcOutput *ipc_output;
#if !PERTAG_PATCH
Monitor *monitor;
#else // PERTAG_PATCH
Client *c = NULL;
Monitor *monitor = NULL;
#endif // PERTAG_PATCH
ipc_output = wl_resource_get_user_data(resource);
if (!ipc_output)
return;
monitor = ipc_output->mon;
#if PERTAG_PATCH
if (monitor != selmon)
c = focustop(selmon);
#endif // PERTAG_PATCH
if (index >= LENGTH(layouts))
return;
#if !PERTAG_PATCH
if (index != monitor->lt[monitor->sellt] - layouts)
monitor->sellt ^= 1;
monitor->lt[monitor->sellt] = &layouts[index];
arrange(monitor);
printstatus();
#else // PERTAG_PATCH
if (c) {
monitor = selmon;
selmon = ipc_output->mon;
}
setlayout(&(Arg){.v = &layouts[index]});
if (c) {
selmon = monitor;
focusclient(c, 0);
}
#endif // PERTAG_PATCH
}
void
dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset)
{
DwlIpcOutput *ipc_output;
#if !PERTAG_PATCH
Monitor *monitor;
#else // PERTAG_PATCH
Client *c = NULL;
Monitor *monitor = NULL;
#endif // PERTAG_PATCH
unsigned int newtags = tagmask & TAGMASK;
ipc_output = wl_resource_get_user_data(resource);
@@ -1759,16 +1788,43 @@ dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource,
return;
monitor = ipc_output->mon;
#if !PERTAG_PATCH
if (!newtags || newtags == monitor->tagset[monitor->seltags])
#else // PERTAG_PATCH
if (monitor != selmon)
c = focustop(selmon);
if (!newtags)
#endif // PERTAG_PATCH
return;
#if !PERTAG_PATCH
if (toggle_tagset)
monitor->seltags ^= 1;
#else // PERTAG_PATCH
/* view toggles seltags for us so we un-toggle it */
if (!toggle_tagset) {
monitor->seltags ^= 1;
monitor->tagset[monitor->seltags] = 0;
}
#endif // PERTAG_PATCH
#if !PERTAG_PATCH
monitor->tagset[monitor->seltags] = newtags;
if (selmon == monitor)
focusclient(focustop(monitor), 1);
arrange(monitor);
printstatus();
#else // PERTAG_PATCH
if (c) {
monitor = selmon;
selmon = ipc_output->mon;
}
view(&(Arg){.ui = newtags});
if (c) {
selmon = monitor;
focusclient(c, 0);
}
#endif // PERTAG_PATCH
}
void