Skip to content

Instantly share code, notes, and snippets.

@ortango
ortango / bspwm-hide_by_moving.diff
Created April 27, 2024 01:56
hide by moving branch vs af3bd8b
diff -ruN a/src/desktop.c b/src/desktop.c
--- a/src/desktop.c 2024-04-26 21:51:35.689016703 -0400
+++ b/src/desktop.c 2024-04-26 21:47:45.922352820 -0400
@@ -531,7 +531,7 @@
if (d == NULL) {
return;
}
- show_node(d, d->root);
+ show_node(d, d->root, hide_by_moving);
}
@ortango
ortango / alt-strut-handling.sh
Created February 8, 2024 23:59
parsing title for target monitor instead of following part_strut spec
#!/bin/bash
getrootgeo() {
xwininfo -root | awk '$1 ~ /-geometry/{
split($2, a, "[x+-]", s);
printf("%d\n%d\n",a[1],a[2]);
printf("%s%d\n%s%d\n",s[2],a[3],s[3],a[4]);'
}
getbspwminfo() {
< <(bspc wm -d) \
jq -r --arg m "$1" '
#!/bin/bash
#wxh+x+y
parse_geom() {
declare -n g
g="$1"
readarray -t g < <( awk '{
split($0, a, "[x+-]", s);
printf("%d\n%d\n",a[1],a[2]);
printf("%s%d\n%s%d\n",s[2],a[3],s[3],a[4]);
@ortango
ortango / borderactions.patch
Last active January 7, 2024 22:39
allow pointer action w/o mod key on window borders
diff --git a/src/events.c b/src/events.c
index 8c9468a..14cfc3b 100644
--- a/src/events.c
+++ b/src/events.c
@@ -386,11 +386,13 @@ void button_press(xcb_generic_event_t *evt)
bool pfm = pointer_follows_monitor;
pointer_follows_focus = false;
pointer_follows_monitor = false;
- replay = !grab_pointer(ACTION_FOCUS) || !swallow_first_click;
+ replay = !grab_pointer(ACTION_FOCUS, false) || !swallow_first_click;
diff -ruN a/tree.c b/tree.c
--- a/tree.c 2023-09-26 21:58:43.198473423 -0400
+++ b/tree.c 2023-09-27 00:19:54.119856575 -0400
@@ -1537,11 +1537,11 @@
}
if (n1_held_focus) {
- d1->focus = n2_held_focus ? last_d2_focus : n2;
+ d1->focus = n2_held_focus ? last_d2_focus : (!IS_RECEPTACLE(n2) ? n2 : NULL);
}
diff -ruN a/src/events.c b/src/events.c
--- a/src/events.c 2023-09-20 13:19:04.638950917 -0400
+++ b/src/events.c 2023-09-21 15:50:17.182394979 -0400
@@ -474,20 +474,35 @@
void handle_state(monitor_t *m, desktop_t *d, node_t *n, xcb_atom_t state, unsigned int action)
{
if (state == ewmh->_NET_WM_STATE_FULLSCREEN) {
- if (action == XCB_EWMH_WM_STATE_ADD && (ignore_ewmh_fullscreen & STATE_TRANSITION_ENTER) == 0) {
- set_state(m, d, n, STATE_FULLSCREEN);
- } else if (action == XCB_EWMH_WM_STATE_REMOVE && (ignore_ewmh_fullscreen & STATE_TRANSITION_EXIT) == 0) {
@ortango
ortango / bspwm-xcursor.diff
Created September 20, 2023 00:04
qwikndutty xcursor support for moving and resizing windows
diff '--color=always' -ruN a/Makefile b/Makefile
--- a/Makefile 2023-08-14 18:21:17.209838188 -0400
+++ b/Makefile 2023-08-14 18:21:34.750469059 -0400
@@ -4,7 +4,7 @@
CPPFLAGS += -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\"
CFLAGS += -std=c99 -pedantic -Wall -Wextra -DJSMN_STRICT
LDFLAGS ?=
-LDLIBS = $(LDFLAGS) -lm -lxcb -lxcb-util -lxcb-keysyms -lxcb-icccm -lxcb-ewmh -lxcb-randr -lxcb-xinerama -lxcb-shape
+LDLIBS = $(LDFLAGS) -lm -lxcb -lxcb-util -lxcb-keysyms -lxcb-icccm -lxcb-ewmh -lxcb-randr -lxcb-xinerama -lxcb-shape -lxcb-cursor
@ortango
ortango / 2bforbspwm.patch
Created July 30, 2022 21:33
quick edit for the effect. using 2bwm's border code
diff -ruN a/tree.c b/tree.c
--- a/tree.c 2022-07-30 17:23:37.210497524 -0400
+++ b/tree.c 2022-07-30 17:20:21.036916013 -0400
@@ -132,12 +132,14 @@
if (!rect_eq(r, cr)) {
window_move_resize(n->id, r.x, r.y, r.width, r.height);
+
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);
diff --git a/src/window.c b/src/window.c
index cd2340d..3e5f633 100644
--- a/src/window.c
+++ b/src/window.c
@@ -592,8 +592,16 @@ bool resize_client(coordinates_t *loc, resize_handle_t rh, int dx, int dy, bool
} else {
int w = width, h = height;
if (relative) {
- w += dx * (rh & HANDLE_LEFT ? -1 : (rh & HANDLE_RIGHT ? 1 : 0));
- h += dy * (rh & HANDLE_TOP ? -1 : (rh & HANDLE_BOTTOM ? 1 : 0));
@ortango
ortango / ease_up
Created March 17, 2022 02:05
quick n' dirty radio player
pon de network:http://musicserver.local:8010
TSF Jazz:https://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3