summaryrefslogtreecommitdiff
path: root/compfy
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-11-20 23:33:59 +0000
committerdavidovski <david@davidovski.xyz>2023-11-20 23:33:59 +0000
commit2c23da611288c6415a363c07847c82481763908e (patch)
tree29cb278b64b9cea522a5db47ec15303a26f0dc45 /compfy
parent4c2194a7c5758637259d109df248c24a2fac62e6 (diff)
Switch to compfy
Diffstat (limited to 'compfy')
-rwxr-xr-xcompfy/deploy.sh14
-rw-r--r--compfy/uncomment_sliding_animation.patch259
2 files changed, 273 insertions, 0 deletions
diff --git a/compfy/deploy.sh b/compfy/deploy.sh
new file mode 100755
index 0000000..3a598cb
--- /dev/null
+++ b/compfy/deploy.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+wd="$HOME/.local/src/compfy"
+
+[ ! -d "$HOME/.local/src" ] && mkdir -p "$wd"
+
+rm -rf "$wd"
+git clone https://github.com/allusive-dev/compfy "$wd"
+
+patch -d "$wd" -p1 -i $(realpath uncomment_sliding_animation.patch)
+
+cd "$wd"
+meson build && meson compile -C build && doas meson install -C build
+cd -
diff --git a/compfy/uncomment_sliding_animation.patch b/compfy/uncomment_sliding_animation.patch
new file mode 100644
index 0000000..77f613d
--- /dev/null
+++ b/compfy/uncomment_sliding_animation.patch
@@ -0,0 +1,259 @@
+diff --git a/src/common.h b/src/common.h
+index 978acf7..bcffb81 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -186,9 +186,9 @@ typedef struct session {
+ /// Width of root window.
+ int root_width;
+ /// Current desktop number of root window
+- // int root_desktop_num;
++ int root_desktop_num;
+ /// Desktop switch direction
+- // int root_desktop_switch_direction;
++ int root_desktop_switch_direction;
+ /// X Composite overlay window.
+ xcb_window_t overlay;
+ /// The target window for debug mode
+diff --git a/src/compfy.c b/src/compfy.c
+index 975bfaf..d5dcc54 100644
+--- a/src/compfy.c
++++ b/src/compfy.c
+@@ -597,13 +597,13 @@ static void configure_root(session_t *ps) {
+ ps->root_width = r->width;
+ ps->root_height = r->height;
+
+- // auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP,
+- // 1L, XCB_ATOM_CARDINAL, 32);
++ auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP,
++ 1L, XCB_ATOM_CARDINAL, 32);
+
+- // ps->root_desktop_switch_direction = 0;
+- // if (prop.nitems) {
+- // ps->root_desktop_num = (int)*prop.c32;
+- // }
++ ps->root_desktop_switch_direction = 0;
++ if (prop.nitems) {
++ ps->root_desktop_num = (int)*prop.c32;
++ }
+
+ rebuild_screen_reg(ps);
+ rebuild_shadow_exclude_reg(ps);
+@@ -1752,7 +1752,7 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) {
+ }
+ if (!animation_running) {
+ ps->animation_time = 0L;
+- // ps->root_desktop_switch_direction = 0;
++ ps->root_desktop_switch_direction = 0;
+ }
+
+ // TODO(yshui) Investigate how big the X critical section needs to be. There are
+diff --git a/src/config.c b/src/config.c
+index deca6ad..45da9a0 100644
+--- a/src/config.c
++++ b/src/config.c
+@@ -759,6 +759,8 @@ enum wm_support parse_wm_support(const char *src) {
+ return WM_SUPPORT_HERB;
+ } else if (strcmp(src, "dwm") == 0) {
+ return WM_SUPPORT_DWM;
++ } else if (strcmp(src, "bspwm") == 0) {
++ return WM_SUPPORT_BSPWM;
+ } else if (strcmp(src, "legacy") == 0) {
+ return WM_SUPPORT_LEGACY;
+ }
+diff --git a/src/config.h b/src/config.h
+index 4276203..fe03eca 100644
+--- a/src/config.h
++++ b/src/config.h
+@@ -49,8 +49,8 @@ enum open_window_animation {
+ OPEN_WINDOW_ANIMATION_SLIDE_DOWN,
+ OPEN_WINDOW_ANIMATION_SLIDE_LEFT,
+ OPEN_WINDOW_ANIMATION_SLIDE_RIGHT,
+- // OPEN_WINDOW_ANIMATION_SLIDE_IN,
+- // OPEN_WINDOW_ANIMATION_SLIDE_OUT,
++ OPEN_WINDOW_ANIMATION_SLIDE_IN,
++ OPEN_WINDOW_ANIMATION_SLIDE_OUT,
+ OPEN_WINDOW_ANIMATION_INVALID,
+ };
+
+@@ -59,6 +59,7 @@ enum wm_support {
+ WM_SUPPORT_AWESOME,
+ WM_SUPPORT_HERB,
+ WM_SUPPORT_DWM,
++ WM_SUPPORT_BSPWM,
+ WM_SUPPORT_LEGACY,
+ WM_SUPPORT_INVALID,
+ };
+diff --git a/src/event.c b/src/event.c
+index acbc82d..bf5bd1d 100644
+--- a/src/event.c
++++ b/src/event.c
+@@ -450,15 +450,15 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
+
+ if (ps->root == ev->window) {
+ // If desktop number property changes
+- // if (ev->atom == ps->atoms->a_NET_CURRENT_DESKTOP) {
+- // auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP,
+- // 1L, XCB_ATOM_CARDINAL, 32);
+-
+- // if (prop.nitems) {
+- // ps->root_desktop_switch_direction = ((int)*prop.c32) - ps->root_desktop_num;
+- // ps->root_desktop_num = (int)*prop.c32;
+- // }
+- // }
++ if (ev->atom == ps->atoms->a_NET_CURRENT_DESKTOP) {
++ auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP,
++ 1L, XCB_ATOM_CARDINAL, 32);
++
++ if (prop.nitems) {
++ ps->root_desktop_switch_direction = ((int)*prop.c32) - ps->root_desktop_num;
++ ps->root_desktop_num = (int)*prop.c32;
++ }
++ }
+
+ if (ps->o.use_ewmh_active_win && ps->atoms->a_NET_ACTIVE_WINDOW == ev->atom) {
+ // to update focus
+diff --git a/src/win.c b/src/win.c
+index 4d96bb7..df3af08 100644
+--- a/src/win.c
++++ b/src/win.c
+@@ -484,13 +484,9 @@ static void init_animation(session_t *ps, struct managed_win *w) {
+ if (ps->o.wintype_option[w->window_type].animation < OPEN_WINDOW_ANIMATION_INVALID)
+ animation = ps->o.wintype_option[w->window_type].animation;
+
+- // if (ps->root_desktop_switch_direction != 0) {
+- // if (ps->o.animation_for_workspace_switch_in == OPEN_WINDOW_ANIMATION_AUTO) {
+- // animation = OPEN_WINDOW_ANIMATION_SLIDE_IN;
+- // } else {
+- // animation = ps->o.animation_for_workspace_switch_in;
+- // }
+- // }
++ if (ps->root_desktop_switch_direction != 0) {
++ animation = OPEN_WINDOW_ANIMATION_SLIDE_IN;
++ }
+
+ if (c2_match(ps, w, ps->o.animation_open_blacklist, NULL)) {
+ animation = OPEN_WINDOW_ANIMATION_NONE;
+@@ -553,28 +549,16 @@ static void init_animation(session_t *ps, struct managed_win *w) {
+ w->animation_h = w->pending_g.height;
+ break;
+ }
+- // case OPEN_WINDOW_ANIMATION_SLIDE_IN: {
+- // w->animation_center_x = w->pending_g.x + w->pending_g.width * 0.5;
+- // w->animation_center_y = w->pending_g.y + w->pending_g.height * 0.5 -
+- // ps->root_height *
+- // ((ps->root_desktop_switch_direction < 0 &&
+- // ps->root_desktop_switch_direction >= -1) ||
+- // ps->root_desktop_switch_direction > 1?1:-1);
+- // w->animation_w = w->pending_g.width;
+- // w->animation_h = w->pending_g.height;
+- // break;
+- // }
+- // case OPEN_WINDOW_ANIMATION_SLIDE_OUT: {
+- // w->animation_dest_center_x = w->pending_g.x + w->pending_g.width * 0.5;
+- // w->animation_dest_center_y = w->pending_g.y + w->pending_g.height * 0.5 -
+- // ps->root_height *
+- // ((ps->root_desktop_switch_direction < 0 &&
+- // ps->root_desktop_switch_direction >= -1) ||
+- // ps->root_desktop_switch_direction > 1?-1:1);
+- // w->animation_dest_w = w->pending_g.width;
+- // w->animation_dest_h = w->pending_g.height;
+- // break;
+- // }
++ case OPEN_WINDOW_ANIMATION_SLIDE_IN: {
++ w->animation_center_x = w->pending_g.x + w->pending_g.width * 0.5 +
++ ps->root_width *
++ (ps->root_desktop_switch_direction < 0?-1:1);
++
++ w->animation_center_y = w->pending_g.y + w->pending_g.height * 0.5;
++ w->animation_w = w->pending_g.width;
++ w->animation_h = w->pending_g.height;
++ break;
++ }
+ case OPEN_WINDOW_ANIMATION_INVALID: assert(false); break;
+ }
+ }
+@@ -599,10 +583,10 @@ static void init_animation_unmap(session_t *ps, struct managed_win *w) {
+ animation = OPEN_WINDOW_ANIMATION_SLIDE_RIGHT;
+ else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_RIGHT)
+ animation = OPEN_WINDOW_ANIMATION_SLIDE_LEFT;
+- // else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_IN)
+- // animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT;
+- // else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_OUT)
+- // animation = OPEN_WINDOW_ANIMATION_SLIDE_IN;
++ else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_IN)
++ animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT;
++ else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_OUT)
++ animation = OPEN_WINDOW_ANIMATION_SLIDE_IN;
+
+ } else {
+ animation = ps->o.animation_for_unmap_window;
+@@ -611,12 +595,9 @@ static void init_animation_unmap(session_t *ps, struct managed_win *w) {
+ animation = ps->o.wintype_option[w->window_type].animation_unmap;
+ }
+
+- // if (ps->root_desktop_switch_direction != 0) {
+- // if (ps->o.animation_for_workspace_switch_out == OPEN_WINDOW_ANIMATION_AUTO)
+- // animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT;
+- // else
+- // animation = ps->o.animation_for_workspace_switch_out;
+- // }
++ if (ps->root_desktop_switch_direction != 0) {
++ animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT;
++ }
+
+ if (c2_match(ps, w, ps->o.animation_unmap_blacklist, NULL)) {
+ animation = OPEN_WINDOW_ANIMATION_NONE;
+@@ -679,28 +660,15 @@ static void init_animation_unmap(session_t *ps, struct managed_win *w) {
+ w->animation_dest_h = w->pending_g.height;
+ break;
+ }
+- // case OPEN_WINDOW_ANIMATION_SLIDE_IN: {
+- // w->animation_center_x = w->pending_g.x + w->pending_g.width * 0.5;
+- // w->animation_center_y = w->pending_g.y + w->pending_g.height * 0.5 -
+- // ps->root_height *
+- // ((ps->root_desktop_switch_direction < 0 &&
+- // ps->root_desktop_switch_direction >= -1) ||
+- // ps->root_desktop_switch_direction > 1?1:-1);
+- // w->animation_w = w->pending_g.width;
+- // w->animation_h = w->pending_g.height;
+- // break;
+- // }
+- // case OPEN_WINDOW_ANIMATION_SLIDE_OUT: {
+- // w->animation_dest_center_x = w->pending_g.x + w->pending_g.width * 0.5;
+- // w->animation_dest_center_y = w->pending_g.y + w->pending_g.height * 0.5 -
+- // ps->root_height *
+- // ((ps->root_desktop_switch_direction < 0 &&
+- // ps->root_desktop_switch_direction >= -1) ||
+- // ps->root_desktop_switch_direction > 1?-1:1);
+- // w->animation_dest_w = w->pending_g.width;
+- // w->animation_dest_h = w->pending_g.height;
+- // break;
+- // }
++ case OPEN_WINDOW_ANIMATION_SLIDE_OUT: {
++ w->animation_dest_center_x = w->pending_g.x + w->pending_g.width * 0.5 -
++ ps->root_width *
++ (ps->root_desktop_switch_direction < 0?-1:1);
++ w->animation_dest_center_y = w->pending_g.y + w->pending_g.height * 0.5;
++ w->animation_dest_w = w->pending_g.width;
++ w->animation_dest_h = w->pending_g.height;
++ break;
++ }
+ case OPEN_WINDOW_ANIMATION_INVALID: assert(false); break;
+ }
+ }
+@@ -1133,11 +1101,11 @@ double win_calc_opacity_target(session_t *ps, const struct managed_win *w) {
+ return 0;
+ }
+ if (w->state == WSTATE_UNMAPPING || w->state == WSTATE_DESTROYING) {
+- // if (ps->root_desktop_switch_direction)
+- // return w->opacity;
++// if (ps->root_desktop_switch_direction)
++// return w->opacity;
+
+- return 0;
+- }
++ return 0;
++ }
+ // Try obeying opacity property and window type opacity firstly
+ if (w->has_opacity_prop) {
+ opacity = ((double)w->opacity_prop) / OPAQUE;