Massive code cleanup

Cleaned up:
Makefile
config.mk/.h
nix files (by removing them for now)
Removed dwl likeness.
This commit is contained in:
2026-06-28 17:39:02 -04:00
parent 763512a24f
commit f529f03315
11 changed files with 202 additions and 330 deletions
@@ -3,9 +3,9 @@
This is largely ripped from somebar's ipc patchset; just with some personal modifications.
I would probably just submit raphi's patchset but I don't think that would be polite.
-->
<protocol name="dwl_ipc_unstable_v2">
<description summary="inter-proccess-communication about dwl's state">
This protocol allows clients to update and get updates from dwl.
<protocol name="peachwm_ipc_unstable_v2">
<description summary="inter-proccess-communication about peachwm's state">
This protocol allows clients to update and get updates from peachwm.
Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible
@@ -19,27 +19,27 @@ I would probably just submit raphi's patchset but I don't think that would be po
reset.
</description>
<interface name="zdwl_ipc_manager_v2" version="2">
<description summary="manage dwl state">
<interface name="zpeachwm_ipc_manager_v2" version="2">
<description summary="manage peachwm state">
This interface is exposed as a global in wl_registry.
Clients can use this interface to get a dwl_ipc_output.
After binding the client will recieve the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
The dwl_ipc_manager.tags and dwl_ipc_manager.layout events expose tags and layouts to the client.
Clients can use this interface to get a peachwm_ipc_output.
After binding the client will recieve the peachwm_ipc_manager.tags and peachwm_ipc_manager.layout events.
The peachwm_ipc_manager.tags and peachwm_ipc_manager.layout events expose tags and layouts to the client.
</description>
<request name="release" type="destructor">
<description summary="release dwl_ipc_manager">
Indicates that the client will not the dwl_ipc_manager object anymore.
<description summary="release peachwm_ipc_manager">
Indicates that the client will not the peachwm_ipc_manager object anymore.
Objects created through this instance are not affected.
</description>
</request>
<request name="get_output">
<description summary="get a dwl_ipc_outout for a wl_output">
Get a dwl_ipc_outout for the specified wl_output.
<description summary="get a peachwm_ipc_outout for a wl_output">
Get a peachwm_ipc_outout for the specified wl_output.
</description>
<arg name="id" type="new_id" interface="zdwl_ipc_output_v2"/>
<arg name="id" type="new_id" interface="zpeachwm_ipc_output_v2"/>
<arg name="output" type="object" interface="wl_output"/>
</request>
@@ -60,12 +60,12 @@ I would probably just submit raphi's patchset but I don't think that would be po
</event>
</interface>
<interface name="zdwl_ipc_output_v2" version="2">
<description summary="control dwl output">
Observe and control a dwl output.
<interface name="zpeachwm_ipc_output_v2" version="2">
<description summary="control peachwm output">
Observe and control a peachwm output.
Events are double-buffered:
Clients should cache events and redraw when a dwl_ipc_output.frame event is sent.
Clients should cache events and redraw when a peachwm_ipc_output.frame event is sent.
Request are not double-buffered:
The compositor will update immediately upon request.
@@ -78,8 +78,8 @@ I would probably just submit raphi's patchset but I don't think that would be po
</enum>
<request name="release" type="destructor">
<description summary="release dwl_ipc_outout">
Indicates to that the client no longer needs this dwl_ipc_output.
<description summary="release peachwm_ipc_outout">
Indicates to that the client no longer needs this peachwm_ipc_output.
</description>
</request>
@@ -131,8 +131,8 @@ I would probably just submit raphi's patchset but I don't think that would be po
<event name="layout_symbol" since="1">
<description summary="Update the current layout symbol">
Indicates the layout has changed. Since layout symbols are dynamic.
As opposed to the zdwl_ipc_manager.layout event, this should take precendence when displaying.
You can ignore the zdwl_ipc_output.layout event.
As opposed to the zpeachwm_ipc_manager.layout event, this should take precendence when displaying.
You can ignore the zpeachwm_ipc_output.layout event.
</description>
<arg name="layout" type="string" summary="The new layout"/>
</event>
@@ -160,7 +160,7 @@ I would probably just submit raphi's patchset but I don't think that would be po
<request name="set_layout">
<description summary="Set the layout of this output"/>
<arg name="index" type="uint" summary="index of a layout recieved by dwl_ipc_manager.layout"/>
<arg name="index" type="uint" summary="index of a layout recieved by peachwm_ipc_manager.layout"/>
</request>
<!-- Version 2 -->
+43 -43
View File
@@ -7,7 +7,7 @@
#include <sys/socket.h>
#include <wayland-client.h>
#include <wayland-util.h>
#include "dwl-ipc-unstable-v2-protocol.h"
#include "peachwm-ipc-unstable-v2-protocol.h"
#define die(fmt, ...) do { fprintf(stderr, fmt "\n", ##__VA_ARGS__); exit(EXIT_FAILURE); } while (0)
@@ -53,17 +53,17 @@ static size_t outputcount;
static struct wl_display *display;
static struct wl_registry *registry;
static struct zdwl_ipc_manager_v2 *dwl_ipc_manager;
static struct zpeachwm_ipc_manager_v2 *peachwm_ipc_manager;
static void
dwl_ipc_tags(void *data, struct zdwl_ipc_manager_v2 *dwl_ipc_manager, uint32_t count)
peachwm_ipc_tags(void *data, struct zpeachwm_ipc_manager_v2 *peachwm_ipc_manager, uint32_t count)
{
tagcount = count;
if (Tflag && mode & GET) printf("%d\n", tagcount);
}
static void
dwl_ipc_layout(void *data, struct zdwl_ipc_manager_v2 *dwl_ipc_manager, const char *name)
peachwm_ipc_layout(void *data, struct zpeachwm_ipc_manager_v2 *peachwm_ipc_manager, const char *name)
{
if (lflag && mode & SET && strcmp(layout_name, name) == 0)
layout_idx = layoutcount;
@@ -71,13 +71,13 @@ dwl_ipc_layout(void *data, struct zdwl_ipc_manager_v2 *dwl_ipc_manager, const ch
layoutcount++;
}
static const struct zdwl_ipc_manager_v2_listener dwl_ipc_listener = {
.tags = dwl_ipc_tags,
.layout = dwl_ipc_layout
static const struct zpeachwm_ipc_manager_v2_listener peachwm_ipc_listener = {
.tags = peachwm_ipc_tags,
.layout = peachwm_ipc_layout
};
static void
dwl_ipc_output_toggle_visibility(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output)
peachwm_ipc_output_toggle_visibility(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output)
{
if (!vflag) return;
char *oname = data;
@@ -86,7 +86,7 @@ dwl_ipc_output_toggle_visibility(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_
}
static void
dwl_ipc_output_active(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_active(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
uint32_t active)
{
if (active && (!output_name || !*output_name))
@@ -102,12 +102,12 @@ dwl_ipc_output_active(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
}
static void
dwl_ipc_output_tag(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_tag(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused)
{
if (!tflag) return;
if (state != ZDWL_IPC_OUTPUT_V2_TAG_STATE_NONE) seltags |= 1<<tag;
if (state == ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE) urg |= 1<<tag;
if (state != ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_NONE) seltags |= 1<<tag;
if (state == ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ACTIVE) urg |= 1<<tag;
if (clients > 0) occ |= 1<<tag;
if (!(mode & GET)) return;
if (data) printf("%s ", (char *)data);
@@ -115,13 +115,13 @@ dwl_ipc_output_tag(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
}
static void
dwl_ipc_output_layout(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_layout(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
uint32_t layout)
{
}
static void
dwl_ipc_output_layout_symbol(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_layout_symbol(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
const char *layout)
{
if (!(lflag && mode & GET)) return;
@@ -130,7 +130,7 @@ dwl_ipc_output_layout_symbol(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_outp
}
static void
dwl_ipc_output_title(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_title(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
const char *title)
{
if (!(cflag && mode & GET)) return;
@@ -139,7 +139,7 @@ dwl_ipc_output_title(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
}
static void
dwl_ipc_output_appid(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_appid(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
const char *appid)
{
if (!(cflag && mode & GET)) return;
@@ -148,7 +148,7 @@ dwl_ipc_output_appid(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
}
static void
dwl_ipc_output_fullscreen(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_fullscreen(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
uint32_t is_fullscreen)
{
if (!mflag) return;
@@ -157,7 +157,7 @@ dwl_ipc_output_fullscreen(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
}
static void
dwl_ipc_output_floating(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
peachwm_ipc_output_floating(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output,
uint32_t is_floating)
{
if (!fflag) return;
@@ -166,7 +166,7 @@ dwl_ipc_output_floating(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
}
static void
dwl_ipc_output_frame(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output)
peachwm_ipc_output_frame(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc_output)
{
if (mode & SET) {
if (data && !(output_name && strcmp(output_name, (char *)data) == 0)) return;
@@ -180,7 +180,7 @@ dwl_ipc_output_frame(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output)
}
if (layout_idx >= layoutcount)
die("bad layout %s", layout_name);
zdwl_ipc_output_v2_set_layout(dwl_ipc_output, layout_idx);
zpeachwm_ipc_output_v2_set_layout(peachwm_ipc_output, layout_idx);
}
if (tflag) {
uint32_t mask = seltags;
@@ -214,7 +214,7 @@ dwl_ipc_output_frame(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output)
if (i > tagcount) die("bad tagset %s", tagset);
zdwl_ipc_output_v2_set_tags(dwl_ipc_output, mask, toggle);
zpeachwm_ipc_output_v2_set_tags(peachwm_ipc_output, mask, toggle);
}
if (cflag) {
uint32_t and = ~0, xor = 0;
@@ -245,7 +245,7 @@ dwl_ipc_output_frame(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output)
}
if (i > tagcount) die("bad client tagset %s", client_tags);
zdwl_ipc_output_v2_set_client_tags(dwl_ipc_output, and, xor);
zpeachwm_ipc_output_v2_set_client_tags(peachwm_ipc_output, and, xor);
}
wl_display_flush(display);
exit(0);
@@ -261,17 +261,17 @@ dwl_ipc_output_frame(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output)
fflush(stdout);
}
static const struct zdwl_ipc_output_v2_listener dwl_ipc_output_listener = {
.toggle_visibility = dwl_ipc_output_toggle_visibility,
.active = dwl_ipc_output_active,
.tag = dwl_ipc_output_tag,
.layout = dwl_ipc_output_layout,
.title = dwl_ipc_output_title,
.appid = dwl_ipc_output_appid,
.layout_symbol = dwl_ipc_output_layout_symbol,
.fullscreen = dwl_ipc_output_fullscreen,
.floating = dwl_ipc_output_floating,
.frame = dwl_ipc_output_frame,
static const struct zpeachwm_ipc_output_v2_listener peachwm_ipc_output_listener = {
.toggle_visibility = peachwm_ipc_output_toggle_visibility,
.active = peachwm_ipc_output_active,
.tag = peachwm_ipc_output_tag,
.layout = peachwm_ipc_output_layout,
.title = peachwm_ipc_output_title,
.appid = peachwm_ipc_output_appid,
.layout_symbol = peachwm_ipc_output_layout_symbol,
.fullscreen = peachwm_ipc_output_fullscreen,
.floating = peachwm_ipc_output_floating,
.frame = peachwm_ipc_output_frame,
};
static void
@@ -287,10 +287,10 @@ wl_output_name(void *data, struct wl_output *output, const char *name)
wl_output_release(output);
return;
}
if (dwl_ipc_manager) {
struct zdwl_ipc_output_v2 *dwl_ipc_output =
zdwl_ipc_manager_v2_get_output(dwl_ipc_manager, output);
zdwl_ipc_output_v2_add_listener(dwl_ipc_output, &dwl_ipc_output_listener,
if (peachwm_ipc_manager) {
struct zpeachwm_ipc_output_v2 *peachwm_ipc_output =
zpeachwm_ipc_manager_v2_get_output(peachwm_ipc_manager, output);
zpeachwm_ipc_output_v2_add_listener(peachwm_ipc_output, &peachwm_ipc_output_listener,
output_name && *output_name ? NULL : strdup(name));
}
}
@@ -344,10 +344,10 @@ global_add(void *data, struct wl_registry *wl_registry,
}
outputs[outputcount].name = name;
outputcount++;
} else if (strcmp(interface, zdwl_ipc_manager_v2_interface.name) == 0) {
dwl_ipc_manager = wl_registry_bind(wl_registry, name,
&zdwl_ipc_manager_v2_interface, version < 2 ? version : 2);
zdwl_ipc_manager_v2_add_listener(dwl_ipc_manager, &dwl_ipc_listener, NULL);
} else if (strcmp(interface, zpeachwm_ipc_manager_v2_interface.name) == 0) {
peachwm_ipc_manager = wl_registry_bind(wl_registry, name,
&zpeachwm_ipc_manager_v2_interface, version < 2 ? version : 2);
zpeachwm_ipc_manager_v2_add_listener(peachwm_ipc_manager, &peachwm_ipc_listener, NULL);
}
}
@@ -501,8 +501,8 @@ main(int argc, char *argv[])
wl_display_dispatch(display);
wl_display_roundtrip(display);
if (!dwl_ipc_manager && (mode & SET || tflag || lflag || Tflag || Lflag || cflag || vflag || mflag || fflag))
die("bad dwl-ipc protocol");
if (!peachwm_ipc_manager && (mode & SET || tflag || lflag || Tflag || Lflag || cflag || vflag || mflag || fflag))
die("bad peachwm-ipc protocol");
wl_display_roundtrip(display);