From 13e4732f9019fc861dec64fab05b0b2dedfac0d7 Mon Sep 17 00:00:00 2001 From: speckitor Date: Mon, 11 May 2026 11:20:12 +0700 Subject: [PATCH] workspaces --- GNUmakefile | 4 ++-- Makefile | 4 ++-- include/config.h | 2 +- src/absinthe.c | 2 +- src/layout.c | 10 ++++++++-- src/server.c | 2 -- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9fae4c0..cda88b3 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,10 +8,10 @@ OBJ_FILES = $(SRC_FILES:src/%.c=build/%.o) all: proto $(TARGET) xdg-shell-protocol.h: - $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h + $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ wlr-layer-shell-unstable-v1-protocol.h: - $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h + $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml $@ proto: xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h diff --git a/Makefile b/Makefile index 5cb71ce..a7365b0 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,10 @@ OBJ_FILES = $(SRC_FILES:src/%.c=build/%.o) all: proto $(TARGET) xdg-shell-protocol.h: - $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h + $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml ${.TARGET} wlr-layer-shell-unstable-v1-protocol.h: - $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h + $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml ${.TARGET} proto: xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h diff --git a/include/config.h b/include/config.h index 518d35b..3f4154a 100644 --- a/include/config.h +++ b/include/config.h @@ -16,8 +16,8 @@ static const float focused_bc[4] = { 0.0, 0.0, 1.0, 1.0 }; static const float urgent_bc[4] = { 1.0, 0.0, 0.0, 1.0 }; static const float unfocused_bc[4] = { 0.28, 0.28, 0.28, 1.0 }; -#define STACK_SIZE 0.5 #define STACK_COUNT 1 +#define STACK_SIZE 0.5 #define OUTPUT_GAP 10 #define LAYOUT_GAP 5 diff --git a/src/absinthe.c b/src/absinthe.c index 1732697..d398e1c 100644 --- a/src/absinthe.c +++ b/src/absinthe.c @@ -118,7 +118,7 @@ setup(absn_server *server) LISTEN(server->new_xdg_popup, new_xdg_popup, server->xdg_shell->events.new_popup); - /* cursor setup */ + /* cursor */ server->cursor = wlr_cursor_create(); wlr_cursor_attach_output_layout(server->cursor, server->output_layout); diff --git a/src/layout.c b/src/layout.c index 171ba11..d5fa83a 100644 --- a/src/layout.c +++ b/src/layout.c @@ -1,3 +1,5 @@ +#include + #include "config.h" #include "toplevel.h" #include "types.h" @@ -50,12 +52,16 @@ layout_arrange(struct absn_output *output) int32_t total_lg; int mcount = output->workspace->count; - int msize = output->workspace->size; + float msize = output->workspace->size; + int32_t main_stack_width = (toplevels_count <= mcount) ? output->geom.width - 2 * og : msize * (output->geom.width - 2 * og); + int32_t w = output->geom.width - main_stack_width - 2 * og - lg; + wlr_log(WLR_ERROR, "%d, %d", main_stack_width, w); + int32_t pure_h; int32_t h; int32_t cur_h; @@ -130,7 +136,7 @@ layout_arrange(struct absn_output *output) og; new_geom.y = output->geom.y + dy; new_geom.width = w; - new_geom.height = h; + new_geom.height = cur_h; toplevel_set_geom(toplevel, &new_geom); diff --git a/src/server.c b/src/server.c index 508361f..2942305 100644 --- a/src/server.c +++ b/src/server.c @@ -50,8 +50,6 @@ new_output(struct wl_listener *listener, void *data) if (!server->workspaces[i].output) { server->workspaces[i].output = output; output->workspace = &server->workspaces[i]; - output->workspace->count = STACK_COUNT; - output->workspace->count = STACK_SIZE; break; } }