workspaces

This commit is contained in:
2026-05-10 23:02:22 +07:00
parent afbd0c109c
commit 87cbffd414
8 changed files with 134 additions and 55 deletions
+21 -8
View File
@@ -16,16 +16,24 @@ 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 MSTACK_SIZE 1
#define MSTACK_WIDTH 0.5
#define STACK_SIZE 0.5
#define STACK_COUNT 1
#define OUTPUT_GAP 10
#define LAYOUT_GAP 5
#define OUTPUT_GAP 10
#define LAYOUT_GAP 5
#define ALT WLR_MODIFIER_ALT
#define CTRL WLR_MODIFIER_CTRL
#define SHIFT WLR_MODIFIER_SHIFT
#define LOGO WLR_MODIFIER_LOGO
#define ALT WLR_MODIFIER_ALT
#define CTRL WLR_MODIFIER_CTRL
#define SHIFT WLR_MODIFIER_SHIFT
#define LOGO WLR_MODIFIER_LOGO
static const char *workspaces[] = {
"1",
"2",
"3",
"4",
"5",
};
static const absn_keybind keybinds[] = {
{ ALT, XKB_KEY_Return, &run, { .v = "alacritty" } },
@@ -37,6 +45,11 @@ static const absn_keybind keybinds[] = {
{ ALT, XKB_KEY_l, increase_master_count, { .i = -1 } },
{ ALT | SHIFT, XKB_KEY_h, increase_master_width, { .f = -0.05 } },
{ ALT | SHIFT, XKB_KEY_l, increase_master_width, { .f = +0.05 } },
{ ALT, XKB_KEY_1, switch_workspace, { .v = "1" } },
{ ALT, XKB_KEY_2, switch_workspace, { .v = "2" } },
{ ALT, XKB_KEY_3, switch_workspace, { .v = "3" } },
{ ALT, XKB_KEY_4, switch_workspace, { .v = "4" } },
{ ALT, XKB_KEY_5, switch_workspace, { .v = "5" } },
{ ALT, XKB_KEY_E, quit, { 0 } },
};
+2
View File
@@ -12,6 +12,8 @@ void toggle_fullscreen(absn_server *server, const absn_arg *arg);
void increase_master_width(absn_server *server, const absn_arg *arg);
void increase_master_count(absn_server *server, const absn_arg *arg);
void switch_workspace(absn_server *server, const absn_arg *arg);
void quit(absn_server *server, const absn_arg *arg);
#endif
+16 -12
View File
@@ -78,8 +78,8 @@ static const int layermap[] = {
};
enum {
LAYOUT_FLOAT,
LAYOUT_TILE,
LAYOUT_FLOAT,
LAYOUT_TILELEFT,
LAYOUT_TILETOP,
LAYOUT_TILEBOTTOM,
@@ -93,6 +93,14 @@ enum {
typedef struct absn_output absn_output;
typedef struct absn_toplevel absn_toplevel;
typedef struct {
int layout;
const char *name;
absn_output *output;
int count;
float size;
} absn_workspace;
typedef struct {
struct wl_display *display;
struct wlr_backend *backend;
@@ -151,17 +159,17 @@ typedef struct {
struct wlr_output_manager_v1 *output_mgr;
struct wl_listener mgr_apply;
struct wl_listener mgr_test;
} absn_server;
typedef struct {
int layout;
uint32_t id;
} absn_tag;
int workspaces_count;
absn_workspace *workspaces;
} absn_server;
struct absn_output {
struct wl_list link;
absn_server *server;
absn_workspace *workspace;
struct wlr_box geom;
struct wlr_box usable_area;
@@ -170,12 +178,6 @@ struct absn_output {
struct wl_listener request_state;
struct wl_listener destroy;
float mstack_width;
int mstack_count;
absn_tag *tags;
uint32_t active_tags;
struct wl_list layers[4];
};
@@ -200,8 +202,10 @@ typedef struct {
struct absn_toplevel {
struct wl_list link;
struct wl_list flink; /* link for focus stack */
uint32_t tag;
absn_server *server;
absn_output *output;
absn_workspace *workspace;
struct wlr_scene_tree *scene_tree;
struct wlr_scene_tree *scene_surface;