summaryrefslogtreecommitdiff
path: root/src/defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/defs.h')
-rw-r--r--src/defs.h73
1 files changed, 45 insertions, 28 deletions
diff --git a/src/defs.h b/src/defs.h
index 74af271..5796214 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -1,13 +1,13 @@
/* See LICENSE for more information on use */
#pragma once
#include <X11/Xlib.h>
-#define SXWM_VERSION "sxwm ver. 1.6"
-#define SXWM_AUTHOR "(C) Abhinav Prasai 2025"
-#define SXWM_LICINFO "See LICENSE for more info"
+#define SXWM_VERSION "sxwm ver. 1.6"
+#define SXWM_AUTHOR "(C) Abhinav Prasai 2025"
+#define SXWM_LICINFO "See LICENSE for more info"
-#define ALT Mod1Mask
-#define SUPER Mod4Mask
-#define SHIFT ShiftMask
+#define ALT Mod1Mask
+#define SUPER Mod4Mask
+#define SHIFT ShiftMask
#define MARGIN (gaps + BORDER_WIDTH)
#define OUT_IN (2 * BORDER_WIDTH)
@@ -17,18 +17,26 @@
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define LENGTH(X) (sizeof X / sizeof X[0])
-#define UDIST(a,b) abs((int)(a) - (int)(b))
-#define CLAMP(x, lo, hi) (( (x) < (lo) ) ? (lo) : ( (x) > (hi) ) ? (hi) : (x))
-#define MAXCLIENTS 99
-#define BIND(mod, key, cmdstr) { (mod), XK_##key, { cmdstr }, False }
-#define CALL(mod, key, fnptr) { (mod), XK_##key, { .fn = fnptr }, True }
-#define CMD(name, ...) \
- const char *name[] = { __VA_ARGS__, NULL }
+#define UDIST(a, b) abs((int)(a) - (int)(b))
+#define CLAMP(x, lo, hi) (((x) < (lo)) ? (lo) : ((x) > (hi)) ? (hi) : (x))
+#define MAXCLIENTS 99
+#define MAX_SCRATCHPADS 20
+#define MIN_WINDOW_SIZE 20
+#define BIND(mod, key, cmdstr) {(mod), XK_##key, {cmdstr}, False}
+#define CALL(mod, key, fnptr) {(mod), XK_##key, {.fn = fnptr}, True}
+#define CMD(name, ...) const char *name[] = {__VA_ARGS__, NULL}
-#define TYPE_CWKSP 0
-#define TYPE_MWKSP 1
-#define TYPE_FUNC 2
-#define TYPE_CMD 3
+/* workspaces */
+#define TYPE_FUNC 2
+#define TYPE_WS_CHANGE 0
+#define TYPE_WS_MOVE 1
+/* fn/cmd */
+#define TYPE_FUNC 2
+#define TYPE_CMD 3
+/* scratchpads*/
+#define TYPE_SP_REMOVE 4
+#define TYPE_SP_TOGGLE 5
+#define TYPE_SP_CREATE 6
#define NUM_WORKSPACES 9
#define WORKSPACE_NAMES \
@@ -40,21 +48,16 @@
"6" "\0"\
"7" "\0"\
"8" "\0"\
- "9" "\0"\
-
-typedef enum {
- DRAG_NONE,
- DRAG_MOVE,
- DRAG_RESIZE,
- DRAG_SWAP
-} DragMode;
+ "9" "\0"
+typedef enum { DRAG_NONE, DRAG_MOVE, DRAG_RESIZE, DRAG_SWAP } DragMode;
typedef void (*EventHandler)(XEvent *);
typedef union {
const char **cmd;
void (*fn)(void);
- int ws;
+ int ws; /* workspace */
+ int sp; /* scratchpad */
} Action;
typedef struct {
@@ -64,7 +67,7 @@ typedef struct {
int type;
} Binding;
-typedef struct Client{
+typedef struct Client {
Window win;
int x, y, h, w;
int orig_x, orig_y, orig_w, orig_h;
@@ -75,7 +78,10 @@ typedef struct Client{
Bool floating;
Bool fullscreen;
Bool mapped;
+ pid_t pid;
struct Client *next;
+ struct Client *swallowed;
+ struct Client *swallower;
} Client;
typedef struct {
@@ -93,9 +99,14 @@ typedef struct {
int bindsn;
Bool new_win_focus;
Bool warp_cursor;
+ Bool new_win_master;
Binding binds[256];
char **should_float[256];
- char *torun[256];
+ char **can_swallow[256];
+ char **can_be_swallowed[256];
+ char **scratchpads[32];
+ char **open_in_workspace[256];
+ char *torun[256];
} Config;
typedef struct {
@@ -103,6 +114,12 @@ typedef struct {
int w, h;
} Monitor;
+typedef struct {
+ Client *client;
+ Bool enabled;
+} Scratchpad;
+
+extern void centre_window();
extern void close_focused(void);
extern void dec_gaps(void);
extern void focus_next(void);