/* See LICENSE for details. */ #pragma once #include #include #include #include #include #include #include #include #include #include // #include #include #include "vt.h" /* types */ typedef struct Term Term; typedef struct Screen Screen; typedef struct Layout Layout; typedef struct Window Window; typedef struct Client Client; typedef struct Cmd Cmd; typedef struct CmdFifo CmdFifo; typedef struct Register Register; typedef struct Editor Editor; typedef struct Button Button; typedef struct KeyBinding KeyBinding; typedef struct StatusBar StatusBar; struct Screen { Term *backend; float mfact; uint nmaster; int history; int w, h; volatile sig_atomic_t need_resize; }; struct Layout { const char *symbol; void (*arrange)(void); } ; struct Client { Window *window; Vt *term; Vt *editor, *app; /* meta data */ int editor_fds[2]; volatile sig_atomic_t editor_died; const char *cmd; char title[255]; int order; pid_t pid; ushort id; ushort x, y, w, h; bool has_title_line; bool minimized; bool urgent; volatile sig_atomic_t died; Client *next, *prev, *snext; uint tags; }; #if 0 typedef struct { int fg; int bg; int fg256; int bg256; int pair; } Color; typedef struct { const char *title; attr_t attrs; Color *color; } ColorRule; #endif #define ALT(k) ((k) + (161 - 'a')) #if defined CTRL && defined _AIX #undef CTRL #endif #ifndef CTRL #define CTRL(k) ((k) & 0x1F) #endif #define CTRL_ALT(k) ((k) + (129 - 'a')) #define MAX_ARGS 8 typedef struct { void (*cmd)(const char *args[]); const char *args[3]; } Action; #define MAX_KEYS 3 typedef uint KeyCombo[MAX_KEYS]; struct KeyBinding { KeyCombo keys; Action action; }; struct Button { mmask_t mask; Action action; }; struct Cmd { const char *name; Action action; } ; enum { BAR_TOP, BAR_BOTTOM, BAR_OFF }; struct StatusBar { int fd; int pos, lastpos; bool autohide; ushort h; ushort y; char text[512]; const char *file; }; struct CmdFifo { int fd; const char *file; ushort id; }; struct Register { char *data; size_t len; size_t size; }; struct Editor { char *name; const char *argv[4]; bool filter; bool color; }; #define TAGMASK ((1 << arrlen(tags)) - 1) #ifdef NDEBUG #define debug(format, args...) #else #define debug eprint #endif /* commands for use by keybindings */ void create(const char *args[]); void copymode(const char *args[]); void focusn(const char *args[]); void focusid(const char *args[]); void focusnext(const char *args[]); void focusnextnm(const char *args[]); void focusprev(const char *args[]); void focusprevnm(const char *args[]); void focuslast(const char *args[]); void focusup(const char *args[]); void focusdown(const char *args[]); void focusleft(const char *args[]); void focusright(const char *args[]); void killclient(const char *args[]); void paste(const char *args[]); void quit(const char *args[]); void redraw(const char *args[]); void scrollback(const char *args[]); void send(const char *args[]); void setlayout(const char *args[]); void incnmaster(const char *args[]); void setmfact(const char *args[]); void startup(const char *args[]); void tag(const char *args[]); void tagid(const char *args[]); void togglebar(const char *args[]); void togglebarpos(const char *args[]); void toggleminimize(const char *args[]); void togglemouse(const char *args[]); void togglerunall(const char *args[]); void toggletag(const char *args[]); void toggleview(const char *args[]); void viewprevtag(const char *args[]); void view(const char *args[]); void zoom(const char *args[]); /* commands for use by mouse bindings */ void mouse_focus(const char *args[]); void mouse_fullscreen(const char *args[]); void mouse_minimize(const char *args[]); void mouse_zoom(const char *args[]); /* functions and variables available to layouts via config.h */ Client* nextvisible(Client *c); void focus(Client *c); void resize(Client *c, int x, int y, int w, int h); extern Screen screen; extern uint waw, wah, wax, way; extern Client *clients; extern char *title; void fibonacci(int s); void spiral(void); void dwindle(void); void fullscreen(void); void grid(void); void tile(void); void tstack(void); void bstack(void); void vstack(void); #include "config.h"