Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the 'bspwm-rounded' inside TUR :). #1323

Closed
wants to merge 2 commits into from

Conversation

ReeaoX
Copy link

@ReeaoX ReeaoX commented Nov 21, 2024

Closing #1322 and partially #415, in favor of patching rounded corner into BSPWM.

@ReeaoX
Copy link
Author

ReeaoX commented Nov 21, 2024

build.sh changes in this PR.

  1. Write local into the variable. But inside the function.
  2. Correct the --verbose option set of build.sh.

@ReeaoX
Copy link
Author

ReeaoX commented Nov 22, 2024

ERROR: Invalid TAG_TYPE: 'newset-tag'.

Mario cycling with the walk.

Edit: See this GiF.

Mario recursively dancing in their home/hotel

@ReeaoX
Copy link
Author

ReeaoX commented Nov 23, 2024

build.sh changes in this PR (2/3 days later after the open of this PR).

  1. Create another if function.
  2. Rename "newset" into "newest" since they typo.

Recursively notice note in them.

Like @Maxython. I force-pushed my another re-code into their commit. Because i incorrectly write "newest" as "newset". Which i executed from our PR.

But apparently. This is my second Termux package PR over my first Termux package PR:

After updating Termux system with pacman -Syyu --noconfirm. My custom Polybar config is restored into default Polybar config in /data/data/com.termux(.nix)/files/usr/etc/polybar.

I hope @licy183 isn't brutally close this PR. And instead merging their commit with master branch.

@ReeaoX
Copy link
Author

ReeaoX commented Nov 24, 2024

Eventually. No one in Stack Overflow, would answer my non-Reddit question. I would post them inside Reddit trusty, as the determine of repost. Because i'm messing with Stack Overflow.

In that case. If i'm able to re-edit them, just after they communicate editing them. I recursively would.

@robertkirkman
Copy link
Contributor

robertkirkman commented Nov 26, 2024

Hello @ReeaoX I have introduced the 'bspwm-rounded' inside TUR for you.
this might be helpful for you for fixing the build error in this PR.

How to get started with this type of package:

git clone https://github.com/termux-user-repository/tur.git
cd tur/
./setup-environment.sh
cp -r x11-packages/bspwm tur/bspwm-rounded
cd ..
git clone https://github.com/baskerville/bspwm.git
git clone https://github.com/phuhl/bspwm-rounded.git
git -C bspwm checkout 527864d8716462e52f85a419f97a776c0643a68c
diff -bur --exclude=.git --exclude=doc bspwm/ bspwm-rounded/ > tur/tur/bspwm-rounded/rounded.patch
cd tur/

If cross-compiling:

scripts/run-docker.sh ./build-package.sh -I -f bspwm-rounded
scp -P 8022 output/bspwm-rounded_0.9.10_aarch64.deb 192.168.12.185:~
ssh -p 8022 192.168.12.185

If non-cross-compiling:

./build-package.sh -I -f bspwm-rounded
cd output/
pkg install x11-repo
pkg install termux-x11-nightly firefox thunar
pkg install ./bspwm-rounded_0.9.10_aarch64.deb
install -Dm755 $PREFIX/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/bspwmrc
install -Dm644 $PREFIX/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/sxhkdrc
echo 'bspc config border_radius 100' >> ~/.config/bspwm/bspwmrc
termux-x11 -xstartup "bspwm" &
export DISPLAY=:0
thunar &
firefox &
Full patch format implementation of bspwm-rounded source package
diff --git a/tur/bspwm-rounded/build.sh b/tur/bspwm-rounded/build.sh
new file mode 100644
index 0000000..7c39ab6
--- /dev/null
+++ b/tur/bspwm-rounded/build.sh
@@ -0,0 +1,13 @@
+TERMUX_PKG_HOMEPAGE="https://github.com/phuhl/bspwm-rounded"
+TERMUX_PKG_DESCRIPTION="A tiling window manager based on binary space partitioning (with rounded patch)"
+TERMUX_PKG_LICENSE="BSD 2-Clause"
+TERMUX_PKG_MAINTAINER="@termux-user-repository"
+TERMUX_PKG_VERSION=0.9.10
+TERMUX_PKG_SRCURL="https://github.com/baskerville/bspwm/archive/refs/tags/$TERMUX_PKG_VERSION.tar.gz"
+TERMUX_PKG_SHA256="0d0f5e465b9c27a5c2143c86189392fa297fad55253b9ed8f6854473d3928f8f"
+TERMUX_PKG_AUTO_UPDATE=true
+TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag"
+TERMUX_PKG_DEPENDS="libxcb, sxhkd, xcb-util, xcb-util-keysyms, xcb-util-wm"
+TERMUX_PKG_BUILD_IN_SRC=true
+TERMUX_PKG_PROVIDES="bspwm"
+TERMUX_PKG_CONFLICTS="bspwm"
diff --git a/tur/bspwm-rounded/fix-hardcoded-path.patch b/tur/bspwm-rounded/fix-hardcoded-path.patch
new file mode 100644
index 0000000..3b97ac7
--- /dev/null
+++ b/tur/bspwm-rounded/fix-hardcoded-path.patch
@@ -0,0 +1,69 @@
+diff -uNr bspwm-0.9.10/doc/bspwm.1 bspwm-0.9.10.mod/doc/bspwm.1
+--- bspwm-0.9.10/doc/bspwm.1	2020-08-02 14:51:32.000000000 +0700
++++ bspwm-0.9.10.mod/doc/bspwm.1	2022-03-22 15:59:57.637000678 +0700
+@@ -1606,7 +1606,7 @@
+ \fBbspc\fR
+ and
+ \fBbspwm\fR\&. If it isn\(cqt defined, then the following path is used:
+-\fI/tmp/bspwm<host_name>_<display_number>_<screen_number>\-socket\fR\&.
++\fI@TERMUX_PREFIX@/tmp/bspwm<host_name>_<display_number>_<screen_number>\-socket\fR\&.
+ .RE
+ .SH "CONTRIBUTORS"
+ .sp
+diff -uNr bspwm-0.9.10/doc/bspwm.1.asciidoc bspwm-0.9.10.mod/doc/bspwm.1.asciidoc
+--- bspwm-0.9.10/doc/bspwm.1.asciidoc	2020-08-02 14:51:32.000000000 +0700
++++ bspwm-0.9.10.mod/doc/bspwm.1.asciidoc	2022-03-22 15:59:57.657000678 +0700
+@@ -948,7 +948,7 @@
+ ---------------------
+ 
+ 'BSPWM_SOCKET'::
+-	The path of the socket used for the communication between *bspc* and *bspwm*. If it isn't defined, then the following path is used: '/tmp/bspwm<host_name>_<display_number>_<screen_number>-socket'.
++	The path of the socket used for the communication between *bspc* and *bspwm*. If it isn't defined, then the following path is used: '@TERMUX_PREFIX@/tmp/bspwm<host_name>_<display_number>_<screen_number>-socket'.
+ 
+ Contributors
+ ------------
+diff -uNr bspwm-0.9.10/examples/panel/profile bspwm-0.9.10.mod/examples/panel/profile
+--- bspwm-0.9.10/examples/panel/profile	2020-08-02 14:51:32.000000000 +0700
++++ bspwm-0.9.10.mod/examples/panel/profile	2022-03-22 15:59:57.677000678 +0700
+@@ -1,4 +1,4 @@
+-PANEL_FIFO=/tmp/panel-fifo
++PANEL_FIFO=@TERMUX_PREFIX@/tmp/panel-fifo
+ PANEL_HEIGHT=24
+ PANEL_FONT="-*-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
+ PANEL_WM_NAME=bspwm_panel
+diff -uNr bspwm-0.9.10/src/bspwm.h bspwm-0.9.10.mod/src/bspwm.h
+--- bspwm-0.9.10/src/bspwm.h	2020-08-02 14:51:32.000000000 +0700
++++ bspwm-0.9.10.mod/src/bspwm.h	2022-03-22 15:59:57.697000678 +0700
+@@ -32,7 +32,7 @@
+ #define CONFIG_HOME_ENV          "XDG_CONFIG_HOME"
+ #define RUNTIME_DIR_ENV          "XDG_RUNTIME_DIR"
+ 
+-#define STATE_PATH_TPL           "/tmp/bspwm%s_%i_%i-state"
++#define STATE_PATH_TPL           "@TERMUX_PREFIX@/tmp/bspwm%s_%i_%i-state"
+ 
+ #define ROOT_EVENT_MASK     (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_BUTTON_PRESS)
+ #define CLIENT_EVENT_MASK   (XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_FOCUS_CHANGE)
+diff -uNr bspwm-0.9.10/src/common.h bspwm-0.9.10.mod/src/common.h
+--- bspwm-0.9.10/src/common.h	2020-08-02 14:51:32.000000000 +0700
++++ bspwm-0.9.10.mod/src/common.h	2022-03-22 15:59:57.729000678 +0700
+@@ -25,7 +25,7 @@
+ #ifndef BSPWM_COMMON_H
+ #define BSPWM_COMMON_H
+ 
+-#define SOCKET_PATH_TPL  "/tmp/bspwm%s_%i_%i-socket"
++#define SOCKET_PATH_TPL  "@TERMUX_PREFIX@/tmp/bspwm%s_%i_%i-socket"
+ #define SOCKET_ENV_VAR   "BSPWM_SOCKET"
+ 
+ #define FAILURE_MESSAGE  "\x07"
+diff -uNr bspwm-0.9.10/src/helpers.c bspwm-0.9.10.mod/src/helpers.c
+--- bspwm-0.9.10/src/helpers.c	2020-08-02 14:51:32.000000000 +0700
++++ bspwm-0.9.10.mod/src/helpers.c	2022-03-22 15:59:57.753000678 +0700
+@@ -124,7 +124,7 @@
+ 	int tempfd;
+ 	char *runtime_dir = getenv(RUNTIME_DIR_ENV);
+ 	if (runtime_dir == NULL) {
+-		runtime_dir = "/tmp";
++		runtime_dir = "@TERMUX_PREFIX@/tmp";
+ 	}
+ 
+ 	char *fifo_path = malloc(strlen(runtime_dir)+1+strlen(template)+1);
diff --git a/tur/bspwm-rounded/rounded.patch b/tur/bspwm-rounded/rounded.patch
new file mode 100644
index 0000000..5a747af
--- /dev/null
+++ b/tur/bspwm-rounded/rounded.patch
@@ -0,0 +1,344 @@
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/messages.c bspwm-rounded/src/messages.c
+--- bspwm/src/messages.c	2024-11-26 00:56:57.180589326 -0600
++++ bspwm-rounded/src/messages.c	2024-11-26 00:53:45.973041511 -0600
+@@ -1508,6 +1508,13 @@
+ 			return;
+ 		}
+ 		SET_DEF_DEFMON_DEFDESK_WIN(border_width, bw)
++	} else if (streq("border_radius", name)) {
++		unsigned int br;
++		if (sscanf(value, "%u", &br) != 1) {
++			fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
++			return;
++		}
++		SET_DEF_DEFMON_DEFDESK_WIN(border_radius, br)
+ #undef SET_DEF_DEFMON_DEFDESK_WIN
+ #define SET_DEF_DEFMON_DESK(k, v) \
+ 		if (loc.desktop != NULL) { \
+@@ -1803,6 +1810,21 @@
+ 		} else {
+ 			fprintf(rsp, "%u", border_width);
+ 		}
++	} else if (streq("border_radius", name)) {
++		if (loc.node != NULL) {
++			for (node_t *n = first_extrema(loc.node); n != NULL; n = next_leaf(n, loc.node)) {
++				if (n->client != NULL) {
++					fprintf(rsp, "%u", n->client->border_radius);
++					break;
++				}
++			}
++		} else if (loc.desktop != NULL) {
++			fprintf(rsp, "%u", loc.desktop->border_radius);
++		} else if (loc.monitor != NULL) {
++			fprintf(rsp, "%u", loc.monitor->border_radius);
++		} else {
++			fprintf(rsp, "%u", border_radius);
++		}
+ 	} else if (streq("window_gap", name)) {
+ 		if (loc.desktop != NULL) {
+ 			fprintf(rsp, "%i", loc.desktop->window_gap);
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/query.c bspwm-rounded/src/query.c
+--- bspwm/src/query.c	2024-11-26 00:56:57.180589326 -0600
++++ bspwm-rounded/src/query.c	2024-11-26 00:53:45.973041511 -0600
+@@ -76,6 +76,7 @@
+ 	fprintf(rsp, "\"stickyCount\":%i,", m->sticky_count);
+ 	fprintf(rsp, "\"windowGap\":%i,", m->window_gap);
+ 	fprintf(rsp, "\"borderWidth\":%u,", m->border_width);
++	fprintf(rsp, "\"borderRadius\":%u,", m->border_radius);
+ 	fprintf(rsp, "\"focusedDesktopId\":%u,", m->desk->id);
+ 	fprintf(rsp, "\"padding\":");
+ 	query_padding(m->padding, rsp);
+@@ -104,6 +105,7 @@
+ 	fprintf(rsp, "\"userLayout\":\"%s\",", LAYOUT_STR(d->user_layout));
+ 	fprintf(rsp, "\"windowGap\":%i,", d->window_gap);
+ 	fprintf(rsp, "\"borderWidth\":%u,", d->border_width);
++	fprintf(rsp, "\"borderRadius\":%u,", d->border_radius);
+ 	fprintf(rsp, "\"focusedNodeId\":%u,", d->focus != NULL ? d->focus->id : 0);
+ 	fprintf(rsp, "\"padding\":");
+ 	query_padding(d->padding, rsp);
+@@ -167,6 +169,7 @@
+ 		fprintf(rsp, "\"className\":\"%s\",", c->class_name);
+ 		fprintf(rsp, "\"instanceName\":\"%s\",", c->instance_name);
+ 		fprintf(rsp, "\"borderWidth\":%u,", c->border_width);
++		fprintf(rsp, "\"borderRadius\":%u,", c->border_radius);
+ 		fprintf(rsp, "\"state\":\"%s\",", STATE_STR(c->state));
+ 		fprintf(rsp, "\"lastState\":\"%s\",", STATE_STR(c->last_state));
+ 		fprintf(rsp, "\"layer\":\"%s\",", LAYER_STR(c->layer));
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/settings.c bspwm-rounded/src/settings.c
+--- bspwm/src/settings.c	2024-11-26 00:56:57.180589326 -0600
++++ bspwm-rounded/src/settings.c	2024-11-26 00:53:45.973041511 -0600
+@@ -40,6 +40,7 @@
+ padding_t monocle_padding;
+ int window_gap;
+ unsigned int border_width;
++unsigned int border_radius;
+ double split_ratio;
+ child_polarity_t initial_polarity;
+ automatic_scheme_t automatic_scheme;
+@@ -101,6 +102,7 @@
+ 	monocle_padding = (padding_t) MONOCLE_PADDING;
+ 	window_gap = WINDOW_GAP;
+ 	border_width = BORDER_WIDTH;
++	border_radius = BORDER_RADIUS;
+ 	split_ratio = SPLIT_RATIO;
+ 	initial_polarity = SECOND_CHILD;
+ 	automatic_scheme = AUTOMATIC_SCHEME;
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/settings.h bspwm-rounded/src/settings.h
+--- bspwm/src/settings.h	2024-11-26 00:56:57.180589326 -0600
++++ bspwm-rounded/src/settings.h	2024-11-26 00:53:45.973041511 -0600
+@@ -41,6 +41,7 @@
+ #define MONOCLE_PADDING      {0, 0, 0, 0}
+ #define WINDOW_GAP           6
+ #define BORDER_WIDTH         1
++#define BORDER_RADIUS        0
+ #define SPLIT_RATIO          0.5
+ #define AUTOMATIC_SCHEME     SCHEME_LONGEST_SIDE
+ #define REMOVAL_ADJUSTMENT   true
+@@ -80,6 +81,7 @@
+ extern padding_t monocle_padding;
+ extern int window_gap;
+ extern unsigned int border_width;
++extern unsigned int border_radius;
+ extern double split_ratio;
+ extern child_polarity_t initial_polarity;
+ extern automatic_scheme_t automatic_scheme;
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/tree.c bspwm-rounded/src/tree.c
+--- bspwm/src/tree.c	2024-11-26 00:56:57.180589326 -0600
++++ bspwm-rounded/src/tree.c	2024-11-26 00:53:45.973041511 -0600
+@@ -83,6 +83,7 @@
+ 	}
+ 
+ 	if (is_leaf(n)) {
++		unsigned int br = 0;
+ 
+ 		if (n->client == NULL) {
+ 			return;
+@@ -119,9 +120,12 @@
+ 				}
+ 			}
+ 			n->client->tiled_rectangle = r;
++			if (!gapless_monocle || d->layout != LAYOUT_MONOCLE)
++				br = n->client->border_radius;
+ 		/* floating clients */
+ 		} else if (s == STATE_FLOATING) {
+ 			r = n->client->floating_rectangle;
++			br = n->client->border_radius;
+ 		/* fullscreen clients */
+ 		} else {
+ 			r = m->rectangle;
+@@ -132,6 +136,7 @@
+ 
+ 		if (!rect_eq(r, cr)) {
+ 			window_move_resize(n->id, r.x, r.y, r.width, r.height);
++			window_rounded_border(n);
+ 			if (!grabbing) {
+ 				put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", m->id, d->id, n->id, r.width, r.height, r.x, r.y);
+ 			}
+@@ -139,6 +144,9 @@
+ 
+ 		window_border_width(n->id, bw);
+ 
++		n->client->drawn_border_radius = br;
++		window_rounded_border(n);
++
+ 	} else {
+ 		xcb_rectangle_t first_rect;
+ 		xcb_rectangle_t second_rect;
+@@ -745,8 +753,10 @@
+ 	snprintf(c->class_name, sizeof(c->class_name), "%s", MISSING_VALUE);
+ 	snprintf(c->instance_name, sizeof(c->instance_name), "%s", MISSING_VALUE);
+ 	c->border_width = border_width;
++	c->border_radius = border_radius;
+ 	c->urgent = false;
+ 	c->shown = false;
++	c->sets_own_shape = false;
+ 	c->wm_flags = 0;
+ 	c->icccm_props.input_hint = true;
+ 	c->icccm_props.take_focus = false;
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/types.h bspwm-rounded/src/types.h
+--- bspwm/src/types.h	2024-11-26 00:56:57.180589326 -0600
++++ bspwm-rounded/src/types.h	2024-11-26 00:53:45.973041511 -0600
+@@ -216,8 +216,11 @@
+ 	char instance_name[MAXLEN];
+ 	char name[MAXLEN];
+ 	unsigned int border_width;
++	unsigned int border_radius;
++	unsigned int drawn_border_radius;
+ 	bool urgent;
+ 	bool shown;
++	bool sets_own_shape;
+ 	client_state_t state;
+ 	client_state_t last_state;
+ 	stack_layer_t layer;
+@@ -283,6 +286,7 @@
+ 	padding_t padding;
+ 	int window_gap;
+ 	unsigned int border_width;
++	unsigned int border_radius;
+ };
+ 
+ typedef struct monitor_t monitor_t;
+@@ -296,6 +300,7 @@
+ 	unsigned int sticky_count;
+ 	int window_gap;
+ 	unsigned int border_width;
++	unsigned int border_radius;
+ 	xcb_rectangle_t rectangle;
+ 	desktop_t *desk;
+ 	desktop_t *desk_head;
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/window.c bspwm-rounded/src/window.c
+--- bspwm/src/window.c	2024-11-26 00:56:57.180589326 -0600
++++ bspwm-rounded/src/window.c	2024-11-26 00:53:45.973041511 -0600
+@@ -137,10 +137,21 @@
+ 	node_t *n = make_node(win);
+ 	client_t *c = make_client();
+ 	c->border_width = csq->border ? d->border_width : 0;
++	c->border_radius = d->border_radius;
+ 	n->client = c;
+ 	initialize_client(n);
+ 	initialize_floating_rectangle(n);
+ 
++	xcb_shape_query_extents_reply_t* ext = xcb_shape_query_extents_reply(dpy, xcb_shape_query_extents(dpy, n->id), NULL);
++
++	n->client->sets_own_shape = false;
++	if (ext != NULL) {
++		n->client->sets_own_shape = ext->bounding_shaped || ext->clip_shaped;
++
++		free(ext);
++	}
++	fprintf(stderr, "sets shape: %d\n", n->client->sets_own_shape);
++
+ 	if (csq->rect != NULL) {
+ 		c->floating_rectangle = *csq->rect;
+ 		free(csq->rect);
+@@ -218,6 +229,7 @@
+ 		draw_border(n, false, (m == mon));
+ 	}
+ 
++	window_rounded_border(n);
+ 	free(csq->layer);
+ 	free(csq->state);
+ 
+@@ -323,6 +335,7 @@
+ 
+ 	window_move_resize(p->feedback, n->rectangle.x + presel_rect.x, n->rectangle.y + presel_rect.y,
+ 	                  presel_rect.width, presel_rect.height);
++	window_rounded_border(n);
+ 
+ 	if (!exists && m->desk == d) {
+ 		window_show(p->feedback);
+@@ -416,6 +429,95 @@
+ 	}
+ }
+ 
++void window_rounded_border(node_t *n)
++{
++	xcb_window_t win = n->id;
++	unsigned int radius = n->client->drawn_border_radius;
++
++	if (n->client->sets_own_shape) return;
++
++	// get geometry
++	xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, win), NULL);
++	if (geo == NULL) return;
++
++	uint16_t x  = geo->x;
++	uint16_t y  = geo->y;
++	uint16_t w  = geo->width;
++	uint16_t h  = geo->height;
++	uint16_t bw = geo->border_width;
++	uint16_t ow  = w+2*bw;
++	uint16_t oh  = h+2*bw;
++
++	free(geo);
++
++	xcb_pixmap_t bpid = xcb_generate_id(dpy);
++	xcb_pixmap_t cpid = xcb_generate_id(dpy);
++
++	xcb_create_pixmap(dpy, 1, bpid, win, ow, oh);
++	xcb_create_pixmap(dpy, 1, cpid, win, w, h);
++
++	xcb_gcontext_t black = xcb_generate_id(dpy);
++	xcb_gcontext_t white = xcb_generate_id(dpy);
++
++	xcb_create_gc(dpy, black, bpid, XCB_GC_FOREGROUND, (uint32_t[]){0, 0});
++	xcb_create_gc(dpy, white, bpid, XCB_GC_FOREGROUND, (uint32_t[]){1, 0});
++
++	int32_t rad, dia;
++	rad = radius;
++
++	rad += bw; dia = rad*2-1;
++
++	xcb_arc_t barcs[] = {
++		{ -1,     -1,     dia, dia, 0, 360 << 6 },
++		{ -1,     oh-dia, dia, dia, 0, 360 << 6 },
++		{ ow-dia, -1,     dia, dia, 0, 360 << 6 },
++		{ ow-dia, oh-dia, dia, dia, 0, 360 << 6 },
++	};
++	xcb_rectangle_t brects[] = {
++		{ rad, 0, ow-dia, oh },
++		{ 0, rad, ow, oh-dia },
++	};
++
++	rad -= bw; dia = rad*2-1;
++
++	xcb_arc_t carcs[] = {
++		{ -1,    -1,    dia, dia, 0, 360 << 6 },
++		{ -1,    h-dia, dia, dia, 0, 360 << 6 },
++		{ w-dia, -1,    dia, dia, 0, 360 << 6 },
++		{ w-dia, h-dia, dia, dia, 0, 360 << 6 },
++	};
++	xcb_rectangle_t crects[] = {
++		{ rad, 0, w-dia, h },
++		{ 0, rad, w, h-dia },
++	};
++
++	xcb_rectangle_t bounding = {0, 0, w+2*bw, h+2*bw};
++	xcb_poly_fill_rectangle(dpy, bpid, black, 1, &bounding);
++	xcb_poly_fill_rectangle(dpy, bpid, white, 2, brects);
++	xcb_poly_fill_arc(dpy, bpid, white, 4, barcs);
++
++	xcb_rectangle_t clipping = {0, 0, w, h};
++	xcb_poly_fill_rectangle(dpy, cpid, black, 1, &clipping);
++	xcb_poly_fill_rectangle(dpy, cpid, white, 2, crects);
++	xcb_poly_fill_arc(dpy, cpid, white, 4, carcs);
++
++	xcb_shape_mask(dpy, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,  win, -bw, -bw, bpid);
++	xcb_shape_mask(dpy, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_CLIP, win, 0, 0, cpid);
++
++	if (n->presel != NULL && n->presel != XCB_NONE) {
++		xcb_window_t fb = n->presel->feedback;
++		xcb_get_geometry_reply_t *fb_geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, fb), NULL);
++
++		if (fb_geo != NULL) {
++			xcb_shape_mask(dpy, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, fb, x-fb_geo->x, y-fb_geo->y, bpid);
++			free(fb_geo);
++		}
++	}
++
++	xcb_free_pixmap(dpy, bpid);
++	xcb_free_pixmap(dpy, cpid);
++}
++
+ void window_draw_border(xcb_window_t win, uint32_t border_color_pxl)
+ {
+ 	xcb_change_window_attributes(dpy, win, XCB_CW_BORDER_PIXEL, &border_color_pxl);
+@@ -618,6 +720,7 @@
+ 		n->client->floating_rectangle = (xcb_rectangle_t) {x, y, width, height};
+ 		if (n->client->state == STATE_FLOATING) {
+ 			window_move_resize(n->id, x, y, width, height);
++			window_rounded_border(n);
+ 
+ 			if (!grabbing) {
+ 				put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc->monitor->id, loc->desktop->id, loc->node->id, width, height, x, y);
+diff '--color=auto' -bur '--exclude=.git' '--exclude=doc' bspwm/src/window.h bspwm-rounded/src/window.h
+--- bspwm/src/window.h	2024-11-26 00:53:31.469388496 -0600
++++ bspwm-rounded/src/window.h	2024-11-26 00:53:45.973041511 -0600
+@@ -44,6 +44,7 @@
+ void update_colors(void);
+ void update_colors_in(node_t *n, desktop_t *d, monitor_t *m);
+ void draw_border(node_t *n, bool focused_node, bool focused_monitor);
++void window_rounded_border(node_t *n);
+ void window_draw_border(xcb_window_t win, uint32_t border_color_pxl);
+ void adopt_orphans(void);
+ uint32_t get_border_color(bool focused_node, bool focused_monitor);

Screenshot_20241126-013803_Termux_X11

Errata:

  • there was an error in patching docs for me so i skipped the patch's feature documentation
  • bspwm-rounded has a lot of bug reports in several places, but i am not a heavy user of bspwm and have not been able to reproduce the bugs at this time

@ReeaoX
Copy link
Author

ReeaoX commented Nov 30, 2024

Hello @ReeaoX I have introduced the 'bspwm-rounded' inside TUR for you. this might be helpful for you for fixing the build error in this PR.

How to get started with this type of package:

git clone https://github.com/termux-user-repository/tur.git
cd tur/
./setup-environment.sh
cp -r x11-packages/bspwm tur/bspwm-rounded
cd ..
git clone https://github.com/baskerville/bspwm.git
git clone https://github.com/phuhl/bspwm-rounded.git
git -C bspwm checkout 527864d8716462e52f85a419f97a776c0643a68c
diff -bur --exclude=.git --exclude=doc bspwm/ bspwm-rounded/ > tur/tur/bspwm-rounded/rounded.patch
cd tur/

If cross-compiling:

scripts/run-docker.sh ./build-package.sh -I -f bspwm-rounded
scp -P 8022 output/bspwm-rounded_0.9.10_aarch64.deb 192.168.12.185:~
ssh -p 8022 192.168.12.185

If non-cross-compiling:

./build-package.sh -I -f bspwm-rounded
cd output/
pkg install x11-repo
pkg install termux-x11-nightly firefox thunar
pkg install ./bspwm-rounded_0.9.10_aarch64.deb
install -Dm755 $PREFIX/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/bspwmrc
install -Dm644 $PREFIX/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/sxhkdrc
echo 'bspc config border_radius 100' >> ~/.config/bspwm/bspwmrc
termux-x11 -xstartup "bspwm" &
export DISPLAY=:0
thunar &
firefox &

Full patch format implementation of bspwm-rounded source package
Screenshot_20241126-013803_Termux_X11

Errata:

  • there was an error in patching docs for me so i skipped the patch's feature documentation
  • bspwm-rounded has a lot of bug reports in several places, but i am not a heavy user of bspwm and have not been able to reproduce the bugs at this time

Do it yourself.

@ReeaoX ReeaoX closed this Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants