Massive code cleanup
Cleaned up: Makefile config.mk/.h nix files (by removing them for now) Removed dwl likeness.
This commit is contained in:
@@ -1,84 +1,117 @@
|
|||||||
.POSIX:
|
.POSIX:
|
||||||
.SUFFIXES:
|
.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) \
|
# Uncomment to build without XWayland support
|
||||||
-I. -Iinclude -Isrc -Iparser -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" \
|
#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)
|
$(XWAYLAND) -g -Wall -Wextra -Wno-unused-parameter -O1 -std=c11 $(CFLAGS)
|
||||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
|
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS) wlroots-0.20` -lm $(LIBS)
|
||||||
|
|
||||||
SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
|
||||||
PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
|
||||||
|
|
||||||
SMSG_CFLAGS = `$(PKG_CONFIG) --cflags wayland-client` -Wall -Wextra -Wno-unused-parameter
|
SMSG_CFLAGS = `$(PKG_CONFIG) --cflags wayland-client` -Wall -Wextra -Wno-unused-parameter
|
||||||
SMSG_LDLIBS = `$(PKG_CONFIG) --libs wayland-client`
|
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
|
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
|
# Compositor
|
||||||
$(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
|
||||||
|
|
||||||
src/dwl.o: src/peachwm.c include/client.h config.h include/dwl-ipc.h dwl-ipc-unstable-v2-protocol.h \
|
peachwm: src/peachwm.o src/util.o parser/parser.o \
|
||||||
include/ext-workspace.h src/wlr_ext_workspace_v1.h ext-workspace-v1-protocol.h \
|
src/wlr_ext_workspace_v1.o $(PROTO_OBJS)
|
||||||
cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h \
|
$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
|
||||||
wlr-layer-shell-unstable-v1-protocol.h \
|
|
||||||
wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \
|
src/peachwm.o: src/peachwm.c include/client.h include/ipc.h \
|
||||||
parser/parser.h
|
include/ext-workspace.h src/wlr_ext_workspace_v1.h parser/parser.h \
|
||||||
$(CC) $(DWLCFLAGS) -o $@ -c $<
|
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
|
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
|
src/wlr_ext_workspace_v1.o: src/wlr_ext_workspace_v1.c \
|
||||||
$(CC) $(DWLCFLAGS) -o $@ -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
|
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
|
protocols/cursor-shape-v1-protocol.h:
|
||||||
cursor-shape-v1-protocol.h:
|
$(SCANNER) enum-header $(WLPROTO)/staging/cursor-shape/cursor-shape-v1.xml $@
|
||||||
$(SCANNER) enum-header $(PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
|
||||||
pointer-constraints-unstable-v1-protocol.h:
|
protocols/pointer-constraints-unstable-v1-protocol.h:
|
||||||
$(SCANNER) enum-header $(PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
$(SCANNER) enum-header $(WLPROTO)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
||||||
wlr-layer-shell-unstable-v1-protocol.h:
|
|
||||||
|
protocols/wlr-layer-shell-unstable-v1-protocol.h:
|
||||||
$(SCANNER) enum-header protocols/wlr-layer-shell-unstable-v1.xml $@
|
$(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 $@
|
$(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
|
protocols/xdg-shell-protocol.h:
|
||||||
smsg/dwl-ipc-unstable-v2-protocol.h:
|
$(SCANNER) server-header $(WLPROTO)/stable/xdg-shell/xdg-shell.xml $@
|
||||||
$(SCANNER) client-header protocols/dwl-ipc-unstable-v2.xml $@
|
|
||||||
|
|
||||||
smsg/dwl-ipc-unstable-v2-protocol.c:
|
protocols/peachwm-ipc-unstable-v2-protocol.h:
|
||||||
$(SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@
|
$(SCANNER) server-header protocols/peachwm-ipc-unstable-v2.xml $@
|
||||||
|
|
||||||
smsg/dwl-ipc-unstable-v2-protocol.o: smsg/dwl-ipc-unstable-v2-protocol.c
|
protocols/peachwm-ipc-unstable-v2-protocol.c:
|
||||||
$(CC) $(SMSG_CFLAGS) -o $@ -c $<
|
$(SCANNER) private-code protocols/peachwm-ipc-unstable-v2.xml $@
|
||||||
|
|
||||||
smsg/smsg.o: smsg/smsg.c smsg/dwl-ipc-unstable-v2-protocol.h
|
protocols/ext-workspace-v1-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:
|
|
||||||
$(SCANNER) server-header protocols/ext-workspace-v1.xml $@
|
$(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 $@
|
$(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:
|
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
|
install: peachwm smsg/smsg
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
@@ -93,7 +126,3 @@ uninstall:
|
|||||||
rm -f $(DESTDIR)$(PREFIX)/bin/peachwm
|
rm -f $(DESTDIR)$(PREFIX)/bin/peachwm
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/smsg
|
rm -f $(DESTDIR)$(PREFIX)/bin/smsg
|
||||||
rm -rf $(DESTDIR)/etc/peachwm
|
rm -rf $(DESTDIR)/etc/peachwm
|
||||||
|
|
||||||
.SUFFIXES: .c .o
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(DWLCFLAGS) -o $@ -c $<
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
static void dwindle(Monitor *m);
|
|
||||||
|
|
||||||
static const Layout layouts[] = {
|
|
||||||
{"><>", NULL},
|
|
||||||
{"[T]", dwindle},
|
|
||||||
};
|
|
||||||
@@ -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
|
|
||||||
Generated
-61
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
+1
-1
@@ -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
|
* 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
|
* 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.
|
* that they will simply compile out if the chosen #defines leave them unused.
|
||||||
|
|||||||
@@ -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 arrange(Monitor *m);
|
||||||
static void focusclient(Client *c, int lift);
|
static void focusclient(Client *c, int lift);
|
||||||
@@ -60,7 +60,7 @@ ipc_send_output_state(IpcOutput *ipc_out)
|
|||||||
sel_tags = c ? c->tags : 0;
|
sel_tags = c ? c->tags : 0;
|
||||||
|
|
||||||
/* active */
|
/* 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 */
|
/* per-tag state */
|
||||||
for (tag = 0; tag < TAGCOUNT; tag++) {
|
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 */
|
clients_on_tag = 1; /* report ≥1, not exact count */
|
||||||
|
|
||||||
focused = (sel_tags & mask) ? 1 : 0;
|
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 */
|
/* layout index */
|
||||||
@@ -85,31 +85,31 @@ ipc_send_output_state(IpcOutput *ipc_out)
|
|||||||
for (i = 0; i < LENGTH(layouts); i++)
|
for (i = 0; i < LENGTH(layouts); i++)
|
||||||
if (&layouts[i] == m->lt[m->sellt])
|
if (&layouts[i] == m->lt[m->sellt])
|
||||||
break;
|
break;
|
||||||
zdwl_ipc_output_v2_send_layout(res, i);
|
zpeachwm_ipc_output_v2_send_layout(res, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* layout symbol */
|
/* 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 */
|
/* title/appid/fullscreen/floating */
|
||||||
if (c) {
|
if (c) {
|
||||||
zdwl_ipc_output_v2_send_title(res, client_get_title(c));
|
zpeachwm_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_appid(res, client_get_appid(c));
|
||||||
if (wl_resource_get_version(res) >= 2) {
|
if (wl_resource_get_version(res) >= 2) {
|
||||||
zdwl_ipc_output_v2_send_fullscreen(res, c->isfullscreen ? 1 : 0);
|
zpeachwm_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_floating(res, c->isfloating ? 1 : 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zdwl_ipc_output_v2_send_title(res, "");
|
zpeachwm_ipc_output_v2_send_title(res, "");
|
||||||
zdwl_ipc_output_v2_send_appid(res, "");
|
zpeachwm_ipc_output_v2_send_appid(res, "");
|
||||||
if (wl_resource_get_version(res) >= 2) {
|
if (wl_resource_get_version(res) >= 2) {
|
||||||
zdwl_ipc_output_v2_send_fullscreen(res, 0);
|
zpeachwm_ipc_output_v2_send_fullscreen(res, 0);
|
||||||
zdwl_ipc_output_v2_send_floating(res, 0);
|
zpeachwm_ipc_output_v2_send_floating(res, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* frame — signals end of this batch of events */
|
/* 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() */
|
/* 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
|
static void
|
||||||
ipc_output_handle_release(struct wl_client *client, struct wl_resource *resource)
|
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();
|
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,
|
.release = ipc_output_handle_release,
|
||||||
.set_tags = ipc_output_handle_set_tags,
|
.set_tags = ipc_output_handle_set_tags,
|
||||||
.set_client_tags = ipc_output_handle_set_client_tags,
|
.set_client_tags = ipc_output_handle_set_client_tags,
|
||||||
@@ -205,7 +205,7 @@ ipc_output_destroy(struct wl_resource *resource)
|
|||||||
free(out);
|
free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* zdwl_ipc_manager_v2 requests */
|
/* zpeachwm_ipc_manager_v2 requests */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ipc_manager_handle_release(struct wl_client *client, struct wl_resource *resource)
|
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));
|
IpcOutput *out = ecalloc(1, sizeof(*out));
|
||||||
out->mon = m;
|
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);
|
wl_resource_get_version(resource), id);
|
||||||
if (!out->resource) {
|
if (!out->resource) {
|
||||||
free(out);
|
free(out);
|
||||||
@@ -238,7 +238,7 @@ ipc_manager_handle_get_output(struct wl_client *client, struct wl_resource *reso
|
|||||||
ipc_send_output_state(out);
|
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,
|
.release = ipc_manager_handle_release,
|
||||||
.get_output = ipc_manager_handle_get_output,
|
.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));
|
IpcManager *mgr = ecalloc(1, sizeof(*mgr));
|
||||||
wl_list_init(&mgr->outputs);
|
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);
|
version, id);
|
||||||
if (!mgr->resource) {
|
if (!mgr->resource) {
|
||||||
free(mgr);
|
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);
|
wl_list_insert(&ipc_managers, &mgr->link);
|
||||||
|
|
||||||
/* Announce tags and layouts */
|
/* 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++)
|
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
|
static void
|
||||||
ipc_init(void)
|
ipc_init(void)
|
||||||
{
|
{
|
||||||
wl_list_init(&ipc_managers);
|
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);
|
2, NULL, ipc_bind);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<protocol name="dwl_ipc_unstable_v2">
|
<protocol name="peachwm_ipc_unstable_v2">
|
||||||
<copyright>
|
<copyright>
|
||||||
Copyright (C) 2022 Russell Newcomb
|
Copyright (C) 2022 Russell Newcomb
|
||||||
|
|
||||||
@@ -23,10 +23,10 @@
|
|||||||
DEALINGS IN THE SOFTWARE.
|
DEALINGS IN THE SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zdwl_ipc_manager_v2" version="2">
|
<interface name="zpeachwm_ipc_manager_v2" version="2">
|
||||||
<description summary="manage dwl state">
|
<description summary="manage peachwm state">
|
||||||
This interface is exposed as a global in the Wayland registry and allows
|
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
|
Warning! The protocol described in this file is experimental and
|
||||||
backward incompatible changes may be made. Backward compatible changes
|
backward incompatible changes may be made. Backward compatible changes
|
||||||
@@ -39,17 +39,17 @@
|
|||||||
</description>
|
</description>
|
||||||
|
|
||||||
<request name="release" type="destructor">
|
<request name="release" type="destructor">
|
||||||
<description summary="release dwl_ipc_manager">
|
<description summary="release peachwm_ipc_manager">
|
||||||
Indicates that the client will not use the manager object anymore.
|
Indicates that the client will not use the manager object anymore.
|
||||||
Objects created through this interface remain valid.
|
Objects created through this interface remain valid.
|
||||||
</description>
|
</description>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="get_output">
|
<request name="get_output">
|
||||||
<description summary="get a dwl_ipc_output for a wl_output">
|
<description summary="get a peachwm_ipc_output for a wl_output">
|
||||||
Get a dwl_ipc_output for the given wl_output.
|
Get a peachwm_ipc_output for the given wl_output.
|
||||||
</description>
|
</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"/>
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
@@ -69,9 +69,9 @@
|
|||||||
</event>
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zdwl_ipc_output_v2" version="2">
|
<interface name="zpeachwm_ipc_output_v2" version="2">
|
||||||
<description summary="interact with dwl output state">
|
<description summary="interact with peachwm output state">
|
||||||
Observe and control a dwl output.
|
Observe and control a peachwm output.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<enum name="tag_state">
|
<enum name="tag_state">
|
||||||
@@ -81,8 +81,8 @@
|
|||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
<request name="release" type="destructor">
|
<request name="release" type="destructor">
|
||||||
<description summary="release dwl_ipc_output">
|
<description summary="release peachwm_ipc_output">
|
||||||
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.
|
anymore. Objects created through this interface remain valid.
|
||||||
</description>
|
</description>
|
||||||
</request>
|
</request>
|
||||||
@@ -111,8 +111,8 @@
|
|||||||
</request>
|
</request>
|
||||||
|
|
||||||
<event name="toggle_visibility">
|
<event name="toggle_visibility">
|
||||||
<description summary="dwl visibility has been toggled">
|
<description summary="peachwm visibility has been toggled">
|
||||||
Indicates that dwl visibility has been toggled.
|
Indicates that peachwm visibility has been toggled.
|
||||||
</description>
|
</description>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
+22
-22
@@ -3,9 +3,9 @@
|
|||||||
This is largely ripped from somebar's ipc patchset; just with some personal modifications.
|
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.
|
I would probably just submit raphi's patchset but I don't think that would be polite.
|
||||||
-->
|
-->
|
||||||
<protocol name="dwl_ipc_unstable_v2">
|
<protocol name="peachwm_ipc_unstable_v2">
|
||||||
<description summary="inter-proccess-communication about dwl's state">
|
<description summary="inter-proccess-communication about peachwm's state">
|
||||||
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
|
Warning! The protocol described in this file is experimental and
|
||||||
backward incompatible changes may be made. Backward compatible
|
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.
|
reset.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<interface name="zdwl_ipc_manager_v2" version="2">
|
<interface name="zpeachwm_ipc_manager_v2" version="2">
|
||||||
<description summary="manage dwl state">
|
<description summary="manage peachwm state">
|
||||||
This interface is exposed as a global in wl_registry.
|
This interface is exposed as a global in wl_registry.
|
||||||
|
|
||||||
Clients can use this interface to get a dwl_ipc_output.
|
Clients can use this interface to get a peachwm_ipc_output.
|
||||||
After binding the client will recieve the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
|
After binding the client will recieve the peachwm_ipc_manager.tags and peachwm_ipc_manager.layout events.
|
||||||
The dwl_ipc_manager.tags and dwl_ipc_manager.layout events expose tags and layouts to the client.
|
The peachwm_ipc_manager.tags and peachwm_ipc_manager.layout events expose tags and layouts to the client.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<request name="release" type="destructor">
|
<request name="release" type="destructor">
|
||||||
<description summary="release dwl_ipc_manager">
|
<description summary="release peachwm_ipc_manager">
|
||||||
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.
|
Objects created through this instance are not affected.
|
||||||
</description>
|
</description>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="get_output">
|
<request name="get_output">
|
||||||
<description summary="get a dwl_ipc_outout for a wl_output">
|
<description summary="get a peachwm_ipc_outout for a wl_output">
|
||||||
Get a dwl_ipc_outout for the specified wl_output.
|
Get a peachwm_ipc_outout for the specified wl_output.
|
||||||
</description>
|
</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"/>
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
@@ -60,12 +60,12 @@ I would probably just submit raphi's patchset but I don't think that would be po
|
|||||||
</event>
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zdwl_ipc_output_v2" version="2">
|
<interface name="zpeachwm_ipc_output_v2" version="2">
|
||||||
<description summary="control dwl output">
|
<description summary="control peachwm output">
|
||||||
Observe and control a dwl output.
|
Observe and control a peachwm output.
|
||||||
|
|
||||||
Events are double-buffered:
|
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:
|
Request are not double-buffered:
|
||||||
The compositor will update immediately upon request.
|
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>
|
</enum>
|
||||||
|
|
||||||
<request name="release" type="destructor">
|
<request name="release" type="destructor">
|
||||||
<description summary="release dwl_ipc_outout">
|
<description summary="release peachwm_ipc_outout">
|
||||||
Indicates to that the client no longer needs this dwl_ipc_output.
|
Indicates to that the client no longer needs this peachwm_ipc_output.
|
||||||
</description>
|
</description>
|
||||||
</request>
|
</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">
|
<event name="layout_symbol" since="1">
|
||||||
<description summary="Update the current layout symbol">
|
<description summary="Update the current layout symbol">
|
||||||
Indicates the layout has changed. Since layout symbols are dynamic.
|
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.
|
As opposed to the zpeachwm_ipc_manager.layout event, this should take precendence when displaying.
|
||||||
You can ignore the zdwl_ipc_output.layout event.
|
You can ignore the zpeachwm_ipc_output.layout event.
|
||||||
</description>
|
</description>
|
||||||
<arg name="layout" type="string" summary="The new layout"/>
|
<arg name="layout" type="string" summary="The new layout"/>
|
||||||
</event>
|
</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">
|
<request name="set_layout">
|
||||||
<description summary="Set the layout of this output"/>
|
<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>
|
</request>
|
||||||
|
|
||||||
<!-- Version 2 -->
|
<!-- Version 2 -->
|
||||||
+43
-43
@@ -7,7 +7,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <wayland-util.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)
|
#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_display *display;
|
||||||
static struct wl_registry *registry;
|
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
|
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;
|
tagcount = count;
|
||||||
if (Tflag && mode & GET) printf("%d\n", tagcount);
|
if (Tflag && mode & GET) printf("%d\n", tagcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
if (lflag && mode & SET && strcmp(layout_name, name) == 0)
|
||||||
layout_idx = layoutcount;
|
layout_idx = layoutcount;
|
||||||
@@ -71,13 +71,13 @@ dwl_ipc_layout(void *data, struct zdwl_ipc_manager_v2 *dwl_ipc_manager, const ch
|
|||||||
layoutcount++;
|
layoutcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zdwl_ipc_manager_v2_listener dwl_ipc_listener = {
|
static const struct zpeachwm_ipc_manager_v2_listener peachwm_ipc_listener = {
|
||||||
.tags = dwl_ipc_tags,
|
.tags = peachwm_ipc_tags,
|
||||||
.layout = dwl_ipc_layout
|
.layout = peachwm_ipc_layout
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
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;
|
if (!vflag) return;
|
||||||
char *oname = data;
|
char *oname = data;
|
||||||
@@ -86,7 +86,7 @@ dwl_ipc_output_toggle_visibility(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
uint32_t active)
|
||||||
{
|
{
|
||||||
if (active && (!output_name || !*output_name))
|
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
|
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)
|
uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused)
|
||||||
{
|
{
|
||||||
if (!tflag) return;
|
if (!tflag) return;
|
||||||
if (state != ZDWL_IPC_OUTPUT_V2_TAG_STATE_NONE) seltags |= 1<<tag;
|
if (state != ZPEACHWM_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_ACTIVE) urg |= 1<<tag;
|
||||||
if (clients > 0) occ |= 1<<tag;
|
if (clients > 0) occ |= 1<<tag;
|
||||||
if (!(mode & GET)) return;
|
if (!(mode & GET)) return;
|
||||||
if (data) printf("%s ", (char *)data);
|
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
|
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)
|
uint32_t layout)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
const char *layout)
|
||||||
{
|
{
|
||||||
if (!(lflag && mode & GET)) return;
|
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
|
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)
|
const char *title)
|
||||||
{
|
{
|
||||||
if (!(cflag && mode & GET)) return;
|
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
|
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)
|
const char *appid)
|
||||||
{
|
{
|
||||||
if (!(cflag && mode & GET)) return;
|
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
|
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)
|
uint32_t is_fullscreen)
|
||||||
{
|
{
|
||||||
if (!mflag) return;
|
if (!mflag) return;
|
||||||
@@ -157,7 +157,7 @@ dwl_ipc_output_fullscreen(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
uint32_t is_floating)
|
||||||
{
|
{
|
||||||
if (!fflag) return;
|
if (!fflag) return;
|
||||||
@@ -166,7 +166,7 @@ dwl_ipc_output_floating(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 (mode & SET) {
|
||||||
if (data && !(output_name && strcmp(output_name, (char *)data) == 0)) return;
|
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)
|
if (layout_idx >= layoutcount)
|
||||||
die("bad layout %s", layout_name);
|
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) {
|
if (tflag) {
|
||||||
uint32_t mask = seltags;
|
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);
|
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) {
|
if (cflag) {
|
||||||
uint32_t and = ~0, xor = 0;
|
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);
|
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);
|
wl_display_flush(display);
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -261,17 +261,17 @@ dwl_ipc_output_frame(void *data, struct zdwl_ipc_output_v2 *dwl_ipc_output)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct zdwl_ipc_output_v2_listener dwl_ipc_output_listener = {
|
static const struct zpeachwm_ipc_output_v2_listener peachwm_ipc_output_listener = {
|
||||||
.toggle_visibility = dwl_ipc_output_toggle_visibility,
|
.toggle_visibility = peachwm_ipc_output_toggle_visibility,
|
||||||
.active = dwl_ipc_output_active,
|
.active = peachwm_ipc_output_active,
|
||||||
.tag = dwl_ipc_output_tag,
|
.tag = peachwm_ipc_output_tag,
|
||||||
.layout = dwl_ipc_output_layout,
|
.layout = peachwm_ipc_output_layout,
|
||||||
.title = dwl_ipc_output_title,
|
.title = peachwm_ipc_output_title,
|
||||||
.appid = dwl_ipc_output_appid,
|
.appid = peachwm_ipc_output_appid,
|
||||||
.layout_symbol = dwl_ipc_output_layout_symbol,
|
.layout_symbol = peachwm_ipc_output_layout_symbol,
|
||||||
.fullscreen = dwl_ipc_output_fullscreen,
|
.fullscreen = peachwm_ipc_output_fullscreen,
|
||||||
.floating = dwl_ipc_output_floating,
|
.floating = peachwm_ipc_output_floating,
|
||||||
.frame = dwl_ipc_output_frame,
|
.frame = peachwm_ipc_output_frame,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -287,10 +287,10 @@ wl_output_name(void *data, struct wl_output *output, const char *name)
|
|||||||
wl_output_release(output);
|
wl_output_release(output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dwl_ipc_manager) {
|
if (peachwm_ipc_manager) {
|
||||||
struct zdwl_ipc_output_v2 *dwl_ipc_output =
|
struct zpeachwm_ipc_output_v2 *peachwm_ipc_output =
|
||||||
zdwl_ipc_manager_v2_get_output(dwl_ipc_manager, output);
|
zpeachwm_ipc_manager_v2_get_output(peachwm_ipc_manager, output);
|
||||||
zdwl_ipc_output_v2_add_listener(dwl_ipc_output, &dwl_ipc_output_listener,
|
zpeachwm_ipc_output_v2_add_listener(peachwm_ipc_output, &peachwm_ipc_output_listener,
|
||||||
output_name && *output_name ? NULL : strdup(name));
|
output_name && *output_name ? NULL : strdup(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,10 +344,10 @@ global_add(void *data, struct wl_registry *wl_registry,
|
|||||||
}
|
}
|
||||||
outputs[outputcount].name = name;
|
outputs[outputcount].name = name;
|
||||||
outputcount++;
|
outputcount++;
|
||||||
} else if (strcmp(interface, zdwl_ipc_manager_v2_interface.name) == 0) {
|
} else if (strcmp(interface, zpeachwm_ipc_manager_v2_interface.name) == 0) {
|
||||||
dwl_ipc_manager = wl_registry_bind(wl_registry, name,
|
peachwm_ipc_manager = wl_registry_bind(wl_registry, name,
|
||||||
&zdwl_ipc_manager_v2_interface, version < 2 ? version : 2);
|
&zpeachwm_ipc_manager_v2_interface, version < 2 ? version : 2);
|
||||||
zdwl_ipc_manager_v2_add_listener(dwl_ipc_manager, &dwl_ipc_listener, NULL);
|
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_dispatch(display);
|
||||||
wl_display_roundtrip(display);
|
wl_display_roundtrip(display);
|
||||||
|
|
||||||
if (!dwl_ipc_manager && (mode & SET || tflag || lflag || Tflag || Lflag || cflag || vflag || mflag || fflag))
|
if (!peachwm_ipc_manager && (mode & SET || tflag || lflag || Tflag || Lflag || cflag || vflag || mflag || fflag))
|
||||||
die("bad dwl-ipc protocol");
|
die("bad peachwm-ipc protocol");
|
||||||
|
|
||||||
wl_display_roundtrip(display);
|
wl_display_roundtrip(display);
|
||||||
|
|
||||||
|
|||||||
+13
-8
@@ -207,6 +207,13 @@ typedef struct {
|
|||||||
#define TAGCOUNT 9
|
#define TAGCOUNT 9
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void dwindle(Monitor *m);
|
||||||
|
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
{"><>", NULL},
|
||||||
|
{"[T]", dwindle},
|
||||||
|
};
|
||||||
|
|
||||||
/* dwindle tree */
|
/* dwindle tree */
|
||||||
typedef struct DwindleNode DwindleNode;
|
typedef struct DwindleNode DwindleNode;
|
||||||
struct DwindleNode {
|
struct DwindleNode {
|
||||||
@@ -506,11 +513,9 @@ static Config cfg;
|
|||||||
static struct wl_event_source *cfg_watch_src;
|
static struct wl_event_source *cfg_watch_src;
|
||||||
static const char *custom_cfg_path;
|
static const char *custom_cfg_path;
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
/* attempt to encapsulate suck into one file */
|
/* attempt to encapsulate suck into one file */
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "dwl-ipc.h"
|
#include "ipc.h"
|
||||||
#include "ext-workspace.h"
|
#include "ext-workspace.h"
|
||||||
|
|
||||||
/* function implementations */
|
/* 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
|
/* 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. */
|
* there are no pointer devices, so we always include that capability. */
|
||||||
/* TODO do we actually require a cursor? */
|
/* TODO do we actually require a cursor? */
|
||||||
caps = WL_SEAT_CAPABILITY_POINTER;
|
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) {
|
void setpsel(struct wl_listener *listener, void *data) {
|
||||||
/* This event is raised by the seat when a client wants to set the selection,
|
/* 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
|
* 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;
|
struct wlr_seat_request_set_primary_selection_event *event = data;
|
||||||
wlr_seat_set_primary_selection(seat, event->source, event->serial);
|
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) {
|
void setsel(struct wl_listener *listener, void *data) {
|
||||||
/* This event is raised by the seat when a client wants to set the selection,
|
/* 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
|
* 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;
|
struct wlr_seat_request_set_selection_event *event = data;
|
||||||
wlr_seat_set_selection(seat, event->source, event->serial);
|
wlr_seat_set_selection(seat, event->source, event->serial);
|
||||||
@@ -3039,7 +3044,7 @@ void spawn(const Arg *arg) {
|
|||||||
dup2(STDERR_FILENO, STDOUT_FILENO);
|
dup2(STDERR_FILENO, STDOUT_FILENO);
|
||||||
setsid();
|
setsid();
|
||||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
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_node_set_position(&root_bg->node, sgeom.x, sgeom.y);
|
||||||
wlr_scene_rect_set_size(root_bg, sgeom.width, sgeom.height);
|
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_node_set_position(&locked_bg->node, sgeom.x, sgeom.y);
|
||||||
wlr_scene_rect_set_size(locked_bg, sgeom.width, sgeom.height);
|
wlr_scene_rect_set_size(locked_bg, sgeom.width, sgeom.height);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user