diff --git a/Makefile b/Makefile index d39bc61..8e07856 100644 --- a/Makefile +++ b/Makefile @@ -1,84 +1,117 @@ .POSIX: .SUFFIXES: -include config.mk +VERSION = `git describe --tags --dirty 2>/dev/null || echo 0.2` +PREFIX = /usr/local +CC = cc +PKG_CONFIG = pkg-config -DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) \ - -I. -Iinclude -Isrc -Iparser -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" \ +# Uncomment to build without XWayland support +#XWAYLAND = +#XLIBS = +XWAYLAND = -DXWAYLAND +XLIBS = xcb xcb-icccm + +LUA_PKG = lua5.4 +PKGS = wayland-server xkbcommon libinput $(LUA_PKG) $(XLIBS) + +CFLAGS = `$(PKG_CONFIG) --cflags $(PKGS) wlroots-0.20` \ + -I. -Iinclude -Isrc -Iparser -Iprotocols \ + -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" \ $(XWAYLAND) -g -Wall -Wextra -Wno-unused-parameter -O1 -std=c11 $(CFLAGS) -LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS) - -SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner` -PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols` +LDLIBS = `$(PKG_CONFIG) --libs $(PKGS) wlroots-0.20` -lm $(LIBS) SMSG_CFLAGS = `$(PKG_CONFIG) --cflags wayland-client` -Wall -Wextra -Wno-unused-parameter SMSG_LDLIBS = `$(PKG_CONFIG) --libs wayland-client` +SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner` +WLPROTO = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols` + +PROTO_OBJS = protocols/peachwm-ipc-unstable-v2-protocol.o \ + protocols/ext-workspace-v1-protocol.o + all: peachwm smsg/smsg -peachwm: src/dwl.o src/util.o parser/parser.o dwl-ipc-unstable-v2-protocol.o src/wlr_ext_workspace_v1.o ext-workspace-v1-protocol.o - $(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ +# Compositor -src/dwl.o: src/peachwm.c include/client.h config.h include/dwl-ipc.h dwl-ipc-unstable-v2-protocol.h \ - include/ext-workspace.h src/wlr_ext_workspace_v1.h ext-workspace-v1-protocol.h \ - cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h \ - wlr-layer-shell-unstable-v1-protocol.h \ - wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \ - parser/parser.h - $(CC) $(DWLCFLAGS) -o $@ -c $< +peachwm: src/peachwm.o src/util.o parser/parser.o \ + src/wlr_ext_workspace_v1.o $(PROTO_OBJS) + $(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ + +src/peachwm.o: src/peachwm.c include/client.h include/ipc.h \ + include/ext-workspace.h src/wlr_ext_workspace_v1.h parser/parser.h \ + protocols/peachwm-ipc-unstable-v2-protocol.h \ + protocols/ext-workspace-v1-protocol.h \ + protocols/cursor-shape-v1-protocol.h \ + protocols/pointer-constraints-unstable-v1-protocol.h \ + protocols/wlr-layer-shell-unstable-v1-protocol.h \ + protocols/wlr-output-power-management-unstable-v1-protocol.h \ + protocols/xdg-shell-protocol.h + $(CC) $(CFLAGS) -o $@ -c $< src/util.o: src/util.c src/util.h - $(CC) $(DWLCFLAGS) -o $@ -c $< + $(CC) $(CFLAGS) -o $@ -c $< -src/wlr_ext_workspace_v1.o: src/wlr_ext_workspace_v1.c src/wlr_ext_workspace_v1.h ext-workspace-v1-protocol.h - $(CC) $(DWLCFLAGS) -o $@ -c $< +src/wlr_ext_workspace_v1.o: src/wlr_ext_workspace_v1.c \ + src/wlr_ext_workspace_v1.h protocols/ext-workspace-v1-protocol.h + $(CC) $(CFLAGS) -o $@ -c $< parser/parser.o: parser/parser.c parser/parser.h - $(CC) $(DWLCFLAGS) -o $@ -c $< + $(CC) $(CFLAGS) -o $@ -c $< -dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c +$(PROTO_OBJS): protocols/%-protocol.o: protocols/%-protocol.c + $(CC) $(CFLAGS) -o $@ -c $< -ext-workspace-v1-protocol.o: ext-workspace-v1-protocol.c +# Protocol headers and glue code -# protocol headers and glue -cursor-shape-v1-protocol.h: - $(SCANNER) enum-header $(PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@ -pointer-constraints-unstable-v1-protocol.h: - $(SCANNER) enum-header $(PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@ -wlr-layer-shell-unstable-v1-protocol.h: +protocols/cursor-shape-v1-protocol.h: + $(SCANNER) enum-header $(WLPROTO)/staging/cursor-shape/cursor-shape-v1.xml $@ + +protocols/pointer-constraints-unstable-v1-protocol.h: + $(SCANNER) enum-header $(WLPROTO)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@ + +protocols/wlr-layer-shell-unstable-v1-protocol.h: $(SCANNER) enum-header protocols/wlr-layer-shell-unstable-v1.xml $@ -wlr-output-power-management-unstable-v1-protocol.h: + +protocols/wlr-output-power-management-unstable-v1-protocol.h: $(SCANNER) server-header protocols/wlr-output-power-management-unstable-v1.xml $@ -xdg-shell-protocol.h: - $(SCANNER) server-header $(PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ -dwl-ipc-unstable-v2-protocol.h: - $(SCANNER) server-header protocols/dwl-ipc-unstable-v2.xml $@ -dwl-ipc-unstable-v2-protocol.c: - $(SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@ -# smsg -smsg/dwl-ipc-unstable-v2-protocol.h: - $(SCANNER) client-header protocols/dwl-ipc-unstable-v2.xml $@ +protocols/xdg-shell-protocol.h: + $(SCANNER) server-header $(WLPROTO)/stable/xdg-shell/xdg-shell.xml $@ -smsg/dwl-ipc-unstable-v2-protocol.c: - $(SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@ +protocols/peachwm-ipc-unstable-v2-protocol.h: + $(SCANNER) server-header protocols/peachwm-ipc-unstable-v2.xml $@ -smsg/dwl-ipc-unstable-v2-protocol.o: smsg/dwl-ipc-unstable-v2-protocol.c - $(CC) $(SMSG_CFLAGS) -o $@ -c $< +protocols/peachwm-ipc-unstable-v2-protocol.c: + $(SCANNER) private-code protocols/peachwm-ipc-unstable-v2.xml $@ -smsg/smsg.o: smsg/smsg.c smsg/dwl-ipc-unstable-v2-protocol.h - $(CC) $(SMSG_CFLAGS) -o $@ -c $< - -smsg/smsg: smsg/smsg.o smsg/dwl-ipc-unstable-v2-protocol.o - $(CC) $^ $(SMSG_CFLAGS) $(SMSG_LDLIBS) -o $@ - -ext-workspace-v1-protocol.h: +protocols/ext-workspace-v1-protocol.h: $(SCANNER) server-header protocols/ext-workspace-v1.xml $@ -ext-workspace-v1-protocol.c: + +protocols/ext-workspace-v1-protocol.c: $(SCANNER) private-code protocols/ext-workspace-v1.xml $@ +# smsg IPC client + +smsg/peachwm-ipc-unstable-v2-protocol.h: + $(SCANNER) client-header protocols/peachwm-ipc-unstable-v2.xml $@ + +smsg/peachwm-ipc-unstable-v2-protocol.c: + $(SCANNER) private-code protocols/peachwm-ipc-unstable-v2.xml $@ + +smsg/peachwm-ipc-unstable-v2-protocol.o: smsg/peachwm-ipc-unstable-v2-protocol.c + $(CC) $(SMSG_CFLAGS) -o $@ -c $< + +smsg/smsg.o: smsg/smsg.c smsg/peachwm-ipc-unstable-v2-protocol.h + $(CC) $(SMSG_CFLAGS) -o $@ -c $< + +smsg/smsg: smsg/smsg.o smsg/peachwm-ipc-unstable-v2-protocol.o + $(CC) $^ $(SMSG_CFLAGS) $(SMSG_LDLIBS) -o $@ + clean: - rm -f peachwm smsg/smsg src/*.o parser/*.o smsg/*.o smsg/*-protocol.h smsg/*-protocol.c *.o *-protocol.h *-protocol.c + rm -f peachwm smsg/smsg src/*.o parser/*.o smsg/*.o \ + protocols/*.o protocols/*-protocol.h protocols/*-protocol.c \ + smsg/*-protocol.h smsg/*-protocol.c install: peachwm smsg/smsg mkdir -p $(DESTDIR)$(PREFIX)/bin @@ -93,7 +126,3 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/peachwm rm -f $(DESTDIR)$(PREFIX)/bin/smsg rm -rf $(DESTDIR)/etc/peachwm - -.SUFFIXES: .c .o -.c.o: - $(CC) $(DWLCFLAGS) -o $@ -c $< diff --git a/config.h b/config.h deleted file mode 100644 index b30211d..0000000 --- a/config.h +++ /dev/null @@ -1,6 +0,0 @@ -static void dwindle(Monitor *m); - -static const Layout layouts[] = { - {"><>", NULL}, - {"[T]", dwindle}, -}; diff --git a/config.mk b/config.mk deleted file mode 100644 index 13766db..0000000 --- a/config.mk +++ /dev/null @@ -1,31 +0,0 @@ -_VERSION = 0.1 -VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)` - -PKG_CONFIG = pkg-config - -# paths -PREFIX = /usr/local -MANDIR = $(PREFIX)/share/man -DATDIR = $(PREFIX)/share - -WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.20` -WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.20` - -# Allow using an alternative wlroots installation -#WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \ -# -I$(PWD)/wlroots/include -#WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/build -L$(PWD)/wlroots/build -lwlroots-0.19 - -#XWAYLAND = -#XLIBS = -# Uncomment to build XWayland support -XWAYLAND = -DXWAYLAND -XLIBS = xcb xcb-icccm - -# lua -LUA_PKG = lua5.4 - -PKGS = wayland-server xkbcommon libinput $(LUA_PKG) $(XLIBS) - -# Requires C11: _Alignas and anonymous unions in wlroots headers. -CC = cc diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 2d3322f..0000000 --- a/flake.lock +++ /dev/null @@ -1,61 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1782467914, - "narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e73de5be04e0eff4190a1432b946d469c794e7b4", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 0f16949..0000000 --- a/flake.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - description = "peachwm: a dwl fork with Lua config, IPC, and ext-workspace support, plus its smsg client"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - }; - - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - packages.default = pkgs.stdenv.mkDerivation rec { - pname = "peachwm"; - version = "0.1"; - - src = self; - - nativeBuildInputs = with pkgs; [ - pkg-config - wayland-scanner - wayland-protocols - ]; - - buildInputs = with pkgs; [ - wayland - wlroots - pixman - libxkbcommon - libinput - lua5_4 - libxcb - libxcb-wm - ]; - - enableParallelBuilding = true; - - postPatch = '' - substituteInPlace Makefile \ - --replace '$(DESTDIR)/etc/peachwm' '$(DESTDIR)$(PREFIX)/etc/peachwm' - ''; - - makeFlags = [ "PREFIX=${placeholder "out"}" ]; - - meta = with pkgs.lib; { - description = "A dwl fork with Lua configuration, IPC support, and ext-workspace-v1"; - license = with licenses; [ gpl3Only mit isc ]; - platforms = platforms.linux; - mainProgram = "peachwm"; - }; - }; - - devShells.default = pkgs.mkShell { - inputsFrom = [ self.packages.${system}.default ]; - packages = with pkgs; [ pkg-config gdb ]; - }; - - apps.default = flake-utils.lib.mkApp { - drv = self.packages.${system}.default; - }; - }); -} diff --git a/include/client.h b/include/client.h index e7f04ab..53840e9 100644 --- a/include/client.h +++ b/include/client.h @@ -1,5 +1,5 @@ /* - * Attempt to consolidate unavoidable suck into one file, away from dwl.c. This + * Attempt to consolidate unavoidable suck into one file, away from peachwm.c. This * file is not meant to be pretty. We use a .h file with static inline * functions instead of a separate .c module, or function pointers like sway, so * that they will simply compile out if the chosen #defines leave them unused. diff --git a/include/dwl-ipc.h b/include/ipc.h similarity index 80% rename from include/dwl-ipc.h rename to include/ipc.h index 8d6a51a..41de879 100644 --- a/include/dwl-ipc.h +++ b/include/ipc.h @@ -1,6 +1,6 @@ -#include "dwl-ipc-unstable-v2-protocol.h" +#include "peachwm-ipc-unstable-v2-protocol.h" -/* Forward declarations for dwl.c static functions */ +/* Forward declarations for peachwm.c static functions */ static void arrange(Monitor *m); static void focusclient(Client *c, int lift); @@ -60,7 +60,7 @@ ipc_send_output_state(IpcOutput *ipc_out) sel_tags = c ? c->tags : 0; /* active */ - zdwl_ipc_output_v2_send_active(res, m == selmon ? 1 : 0); + zpeachwm_ipc_output_v2_send_active(res, m == selmon ? 1 : 0); /* per-tag state */ for (tag = 0; tag < TAGCOUNT; tag++) { @@ -76,7 +76,7 @@ ipc_send_output_state(IpcOutput *ipc_out) clients_on_tag = 1; /* report ≥1, not exact count */ focused = (sel_tags & mask) ? 1 : 0; - zdwl_ipc_output_v2_send_tag(res, tag, state, clients_on_tag, focused); + zpeachwm_ipc_output_v2_send_tag(res, tag, state, clients_on_tag, focused); } /* layout index */ @@ -85,31 +85,31 @@ ipc_send_output_state(IpcOutput *ipc_out) for (i = 0; i < LENGTH(layouts); i++) if (&layouts[i] == m->lt[m->sellt]) break; - zdwl_ipc_output_v2_send_layout(res, i); + zpeachwm_ipc_output_v2_send_layout(res, i); } /* layout symbol */ - zdwl_ipc_output_v2_send_layout_symbol(res, m->ltsymbol); + zpeachwm_ipc_output_v2_send_layout_symbol(res, m->ltsymbol); /* title/appid/fullscreen/floating */ if (c) { - zdwl_ipc_output_v2_send_title(res, client_get_title(c)); - zdwl_ipc_output_v2_send_appid(res, client_get_appid(c)); + zpeachwm_ipc_output_v2_send_title(res, client_get_title(c)); + zpeachwm_ipc_output_v2_send_appid(res, client_get_appid(c)); if (wl_resource_get_version(res) >= 2) { - zdwl_ipc_output_v2_send_fullscreen(res, c->isfullscreen ? 1 : 0); - zdwl_ipc_output_v2_send_floating(res, c->isfloating ? 1 : 0); + zpeachwm_ipc_output_v2_send_fullscreen(res, c->isfullscreen ? 1 : 0); + zpeachwm_ipc_output_v2_send_floating(res, c->isfloating ? 1 : 0); } } else { - zdwl_ipc_output_v2_send_title(res, ""); - zdwl_ipc_output_v2_send_appid(res, ""); + zpeachwm_ipc_output_v2_send_title(res, ""); + zpeachwm_ipc_output_v2_send_appid(res, ""); if (wl_resource_get_version(res) >= 2) { - zdwl_ipc_output_v2_send_fullscreen(res, 0); - zdwl_ipc_output_v2_send_floating(res, 0); + zpeachwm_ipc_output_v2_send_fullscreen(res, 0); + zpeachwm_ipc_output_v2_send_floating(res, 0); } } /* frame — signals end of this batch of events */ - zdwl_ipc_output_v2_send_frame(res); + zpeachwm_ipc_output_v2_send_frame(res); } /* Called instead of (or alongside) the old printstatus() */ @@ -128,7 +128,7 @@ ipc_printstatus(void) } } -/* zdwl_ipc_output_v2 requests */ +/* zpeachwm_ipc_output_v2 requests */ static void ipc_output_handle_release(struct wl_client *client, struct wl_resource *resource) @@ -190,7 +190,7 @@ ipc_output_handle_set_layout(struct wl_client *client, printstatus(); } -static const struct zdwl_ipc_output_v2_interface ipc_output_impl = { +static const struct zpeachwm_ipc_output_v2_interface ipc_output_impl = { .release = ipc_output_handle_release, .set_tags = ipc_output_handle_set_tags, .set_client_tags = ipc_output_handle_set_client_tags, @@ -205,7 +205,7 @@ ipc_output_destroy(struct wl_resource *resource) free(out); } -/* zdwl_ipc_manager_v2 requests */ +/* zpeachwm_ipc_manager_v2 requests */ static void ipc_manager_handle_release(struct wl_client *client, struct wl_resource *resource) @@ -223,7 +223,7 @@ ipc_manager_handle_get_output(struct wl_client *client, struct wl_resource *reso IpcOutput *out = ecalloc(1, sizeof(*out)); out->mon = m; - out->resource = wl_resource_create(client, &zdwl_ipc_output_v2_interface, + out->resource = wl_resource_create(client, &zpeachwm_ipc_output_v2_interface, wl_resource_get_version(resource), id); if (!out->resource) { free(out); @@ -238,7 +238,7 @@ ipc_manager_handle_get_output(struct wl_client *client, struct wl_resource *reso ipc_send_output_state(out); } -static const struct zdwl_ipc_manager_v2_interface ipc_manager_impl = { +static const struct zpeachwm_ipc_manager_v2_interface ipc_manager_impl = { .release = ipc_manager_handle_release, .get_output = ipc_manager_handle_get_output, }; @@ -261,7 +261,7 @@ ipc_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id) { IpcManager *mgr = ecalloc(1, sizeof(*mgr)); wl_list_init(&mgr->outputs); - mgr->resource = wl_resource_create(client, &zdwl_ipc_manager_v2_interface, + mgr->resource = wl_resource_create(client, &zpeachwm_ipc_manager_v2_interface, version, id); if (!mgr->resource) { free(mgr); @@ -273,15 +273,15 @@ ipc_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id) wl_list_insert(&ipc_managers, &mgr->link); /* Announce tags and layouts */ - zdwl_ipc_manager_v2_send_tags(mgr->resource, TAGCOUNT); + zpeachwm_ipc_manager_v2_send_tags(mgr->resource, TAGCOUNT); for (uint32_t i = 0; i < LENGTH(layouts); i++) - zdwl_ipc_manager_v2_send_layout(mgr->resource, layouts[i].symbol); + zpeachwm_ipc_manager_v2_send_layout(mgr->resource, layouts[i].symbol); } static void ipc_init(void) { wl_list_init(&ipc_managers); - ipc_global = wl_global_create(dpy, &zdwl_ipc_manager_v2_interface, + ipc_global = wl_global_create(dpy, &zpeachwm_ipc_manager_v2_interface, 2, NULL, ipc_bind); } diff --git a/protocols/dwl-ipc-unstable-v2.xml b/protocols/peachwm-ipc-unstable-v2.xml similarity index 87% rename from protocols/dwl-ipc-unstable-v2.xml rename to protocols/peachwm-ipc-unstable-v2.xml index c0aa50b..612b775 100644 --- a/protocols/dwl-ipc-unstable-v2.xml +++ b/protocols/peachwm-ipc-unstable-v2.xml @@ -1,5 +1,5 @@ - + Copyright (C) 2022 Russell Newcomb @@ -23,10 +23,10 @@ DEALINGS IN THE SOFTWARE. - - + + This interface is exposed as a global in the Wayland registry and allows - clients to query and set dwl state. + clients to query and set peachwm state. Warning! The protocol described in this file is experimental and backward incompatible changes may be made. Backward compatible changes @@ -39,17 +39,17 @@ - + Indicates that the client will not use the manager object anymore. Objects created through this interface remain valid. - - Get a dwl_ipc_output for the given wl_output. + + Get a peachwm_ipc_output for the given wl_output. - + @@ -69,9 +69,9 @@ - - - Observe and control a dwl output. + + + Observe and control a peachwm output. @@ -81,8 +81,8 @@ - - Indicates that the client will not use the dwl_ipc_output object + + Indicates that the client will not use the peachwm_ipc_output object anymore. Objects created through this interface remain valid. @@ -111,8 +111,8 @@ - - Indicates that dwl visibility has been toggled. + + Indicates that peachwm visibility has been toggled. diff --git a/smsg/protocols/dwl-ipc-unstable-v2.xml b/smsg/protocols/peachwm-ipc-unstable-v2.xml similarity index 80% rename from smsg/protocols/dwl-ipc-unstable-v2.xml rename to smsg/protocols/peachwm-ipc-unstable-v2.xml index 0a6e7e5..247d44f 100644 --- a/smsg/protocols/dwl-ipc-unstable-v2.xml +++ b/smsg/protocols/peachwm-ipc-unstable-v2.xml @@ -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. --> - - - This protocol allows clients to update and get updates from dwl. + + + 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. - - + + 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. - - Indicates that the client will not the dwl_ipc_manager object anymore. + + Indicates that the client will not the peachwm_ipc_manager object anymore. Objects created through this instance are not affected. - - Get a dwl_ipc_outout for the specified wl_output. + + Get a peachwm_ipc_outout for the specified wl_output. - + @@ -60,12 +60,12 @@ I would probably just submit raphi's patchset but I don't think that would be po - - - Observe and control a dwl 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 - - Indicates to that the client no longer needs this dwl_ipc_output. + + Indicates to that the client no longer needs this peachwm_ipc_output. @@ -131,8 +131,8 @@ I would probably just submit raphi's patchset but I don't think that would be po 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. @@ -160,7 +160,7 @@ I would probably just submit raphi's patchset but I don't think that would be po - + diff --git a/smsg/smsg.c b/smsg/smsg.c index fc87195..f9bcb4b 100644 --- a/smsg/smsg.c +++ b/smsg/smsg.c @@ -7,7 +7,7 @@ #include #include #include -#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< 0) occ |= 1<= 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); diff --git a/src/peachwm.c b/src/peachwm.c index baef839..25e2141 100644 --- a/src/peachwm.c +++ b/src/peachwm.c @@ -207,6 +207,13 @@ typedef struct { #define TAGCOUNT 9 #endif +static void dwindle(Monitor *m); + +static const Layout layouts[] = { + {"><>", NULL}, + {"[T]", dwindle}, +}; + /* dwindle tree */ typedef struct DwindleNode DwindleNode; struct DwindleNode { @@ -506,11 +513,9 @@ static Config cfg; static struct wl_event_source *cfg_watch_src; static const char *custom_cfg_path; -#include "config.h" - /* attempt to encapsulate suck into one file */ #include "client.h" -#include "dwl-ipc.h" +#include "ipc.h" #include "ext-workspace.h" /* function implementations */ @@ -1760,7 +1765,7 @@ void inputdevice(struct wl_listener *listener, void *data) { } /* We need to let the wlr_seat know what our capabilities are, which is - * communiciated to the client. In dwl we always have a cursor, even if + * communiciated to the client. We always have a cursor, even if * there are no pointer devices, so we always include that capability. */ /* TODO do we actually require a cursor? */ caps = WL_SEAT_CAPABILITY_POINTER; @@ -2746,7 +2751,7 @@ void setmon(Client *c, Monitor *m, uint32_t newtags) { void setpsel(struct wl_listener *listener, void *data) { /* This event is raised by the seat when a client wants to set the selection, * usually when the user copies something. wlroots allows compositors to - * ignore such requests if they so choose, but in dwl we always honor them + * ignore such requests if they so choose, but we always honor them */ struct wlr_seat_request_set_primary_selection_event *event = data; wlr_seat_set_primary_selection(seat, event->source, event->serial); @@ -2755,7 +2760,7 @@ void setpsel(struct wl_listener *listener, void *data) { void setsel(struct wl_listener *listener, void *data) { /* This event is raised by the seat when a client wants to set the selection, * usually when the user copies something. wlroots allows compositors to - * ignore such requests if they so choose, but in dwl we always honor them + * ignore such requests if they so choose, but we always honor them */ struct wlr_seat_request_set_selection_event *event = data; wlr_seat_set_selection(seat, event->source, event->serial); @@ -3039,7 +3044,7 @@ void spawn(const Arg *arg) { dup2(STDERR_FILENO, STDOUT_FILENO); setsid(); execvp(((char **)arg->v)[0], (char **)arg->v); - die("dwl: execvp %s failed:", ((char **)arg->v)[0]); + die("peachwm: execvp %s failed:", ((char **)arg->v)[0]); } } @@ -3719,7 +3724,7 @@ void updatemons(struct wl_listener *listener, void *data) { wlr_scene_node_set_position(&root_bg->node, sgeom.x, sgeom.y); wlr_scene_rect_set_size(root_bg, sgeom.width, sgeom.height); - /* Make sure the clients are hidden when dwl is locked */ + /* Make sure the clients are hidden when peachwm is locked */ wlr_scene_node_set_position(&locked_bg->node, sgeom.x, sgeom.y); wlr_scene_rect_set_size(locked_bg, sgeom.width, sgeom.height);